パースペクティブ
この演習では、Harris コーナー検出器を使って建物の角を検出します。threshold_rel パラメータはピークの最小強度を指定します。
building_image として事前に読み込まれています。show_image() と show_image_with_corners() 関数はすでに読み込まれており、グレースケール変換用の color モジュールも使用できます。
この演習はコースの一部です
Pythonで学ぶ画像処理
演習の手順
- feature モジュールから
corner_harris()関数をインポートします。 building_imageをグレースケールに変換します。- Harris 検出器を適用して、コーナー候補を示す応答画像(measure image)を取得します。
- コーナーのピークを見つけます。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# 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)