開始使用免費開始

邊緣

在這個練習中,你將使用 Canny 演算法偵測邊緣,來辨識葡萄柚影像中的形狀。

Grapefruits
影像已預先載入為 grapefruit

color 模組也已為你預先載入。

本練習屬於課程

Python 影像處理

檢視課程

練習說明

  • 從 feature 模組匯入 Canny 邊緣偵測器。
  • 使用先前章節使用過的 color 模組方法,將影像轉為灰階。
  • grapefruit 影像套用 Canny 邊緣偵測器。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# 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")
編輯並執行程式碼