開始使用免費開始

視角

在這個練習中,你將使用 Harris 角點偵測器來找出建築物的角點。參數 threshold_rel 將用來設定峰值的最小強度。

從下往上視角的建築物
影像已預先載入為 building_image

函式 show_image()show_image_with_corners() 已為你預先載入。color 模組也已可用來將影像轉換為灰階。

本練習屬於課程

Python 影像處理

檢視課程

練習說明

  • 從 feature 模組匯入 corner_harris() 函式。
  • building_image 轉為灰階。
  • 套用 Harris 偵測器以取得包含可能角點的量測回應影像。
  • 找出角點的峰值。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Import the corner detector related functions and module
from skimage.____ import ____, corner_peaks

# Convert image from RGB-3 to grayscale
building_image_gray = ____

# Apply the detector  to measure the possible corners
measure_image = ____

# Find the peaks of the corners using the Harris detector
coords = ____(____, min_distance=20, threshold_rel=0.02)

# Show original and resulting image with corners detected
show_image(building_image, "Original")
show_image_with_corners(building_image, coords)
編輯並執行程式碼