开始使用免费开始使用

透视

在本练习中,您将使用 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)
编辑并运行代码