Hình thái học

Xử lý ảnh bằng Python

Rebeca Gonzalez

Data Engineer

Ảnh nhị phân

Xử lý ảnh bằng Python

Lọc hình thái

  • Tốt hơn cho ảnh nhị phân
  • Có thể mở rộng cho thang xám

Xử lý ảnh bằng Python

Các phép toán hình thái

  • Giãn nở
  • Xói mòn

Xử lý ảnh bằng Python

Phần tử cấu trúc

Xử lý ảnh bằng Python

Phần tử cấu trúc

Xử lý ảnh bằng Python

Hình trong scikit-image

from skimage import morphology

square = morphology.square(4)
[[1 1 1 1]
 [1 1 1 1]
 [1 1 1 1]
 [1 1 1 1]]
rectangle = morphology.rectangle(4, 2)
[[1 1]
 [1 1]
 [1 1]
 [1 1]]
Xử lý ảnh bằng Python

Xói mòn trong scikit-image

from skimage import morphology

# Set structuring element to the rectangular-shaped selem = rectangle(12,6)
# Obtain the erosed image with binary erosion eroded_image = morphology.binary_erosion(image_horse, selem=selem)
Xử lý ảnh bằng Python

Xói mòn trong scikit-image

# Show result
plot_comparison(image_horse, eroded_image, 'Erosion')

Xử lý ảnh bằng Python

Xói mòn nhị phân với selem mặc định

# Binary erosion with default selem
eroded_image = morphology.binary_erosion(image_horse)

Xử lý ảnh bằng Python

Giãn nở trong scikit-image

from skimage import morphology

# Obtain dilated image, using binary dilation
dilated_image = morphology.binary_dilation(image_horse)

# See results plot_comparison(image_horse, dilated_image, 'Erosion')
Xử lý ảnh bằng Python

Giãn nở trong scikit-image

Xử lý ảnh bằng Python

Ayo berlatih!

Xử lý ảnh bằng Python

Preparing Video For Download...