开始使用免费开始使用

边缘

在本练习中,您将使用 Canny 算法通过检测边缘来识别西柚图像中的形状。

Grapefruits
图像已预加载为 grapefruit

color 模块已为您预加载。

本练习是课程的一部分

Python 图像处理

查看课程

练习说明

  • 从 feature 模块导入 Canny 边缘检测器。
  • 使用上一章用过的 color 模块方法将图像转换为灰度图。
  • 将 Canny 边缘检测器应用到 grapefruit 图像。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Import the canny edge detector 
from skimage.____ import ____

# Convert image to grayscale
grapefruit = ____(____)

# Apply canny edge detector
canny_edges = ____

# Show resulting image
show_image(canny_edges, "Edges with Canny")
编辑并运行代码