边缘检测
在本练习中,您将通过应用 Sobel 滤波器来检测图像中的边缘。
soaps_image。show_image() 函数已为您加载。
让我们看看它是否能找到图像中的所有形状。
本练习是课程的一部分
Python 图像处理
练习说明
- 导入
color模块,以便将图像转换为灰度图。 - 从
filters模块导入sobel()函数。 - 使用
color模块中的合适方法将soaps_image转为灰度图。 - 在得到的灰度图
soaps_image_gray上应用 Sobel 边缘检测滤波器。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Import the color module
from ____ import ____
# Import the filters module and sobel function
from skimage.____ import ____
# Make the image grayscale
soaps_image_gray = ____.____(soaps_image)
# Apply edge detection filter
edge_sobel = ____(____)
# Show original and resulting image to compare
show_image(soaps_image, "Original")
show_image(edge_sobel, "Edges with Sobel")