Góc nhìn phối cảnh
Trong bài này, bạn sẽ phát hiện các góc của một tòa nhà bằng bộ phát hiện góc Harris. Tham số threshold_rel sẽ chỉ định cường độ tối thiểu của các đỉnh.
building_image.Các hàm show_image() và show_image_with_corners() đã được nạp sẵn cho bạn, cùng với mô-đun color để chuyển ảnh sang thang xám.
Bài tập này là một phần của khóa học
Xử lý ảnh bằng Python
Hướng dẫn bài tập
- Import hàm
corner_harris()từ mô-đun feature. - Chuyển
building_imagesang ảnh xám. - Áp dụng bộ phát hiện Harris để thu được ảnh đáp ứng đo lường với các góc khả dĩ.
- Tìm các đỉnh của các góc.
Bài tập tương tác thực hành trực tiếp
Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.
# 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)