본문 바로가기
  • Hello_
Python/Image processing

[Python] Morophological 구현 (모폴로지 연산 그림으로 설명)

by LDwDL 2022. 8. 30.
728x90
반응형

오늘은 영상처리에서 자주 사용되는 모폴리지 처리에 대해 포스팅하겠다. 구현은 scipy 라이브러리의 ndimage 함수를 사용했다.

 

Morphological Operations

An important part of image analysis involves understanding the shape of the objects in that image through morphological operations
 
Morphology means form or structure
 
The goal is to transform the structure or form of the objects using a structuring element
 
Morphological operations can be applied on binary, grayscale and color images
 

- Dilation, Erosion, Opening, and Closing

 

 

Dilation

The dilation of the image I with a structuring element S is denoted as (I + S)
 
1. Foreground pixels in an image grow or expand
 
2. Fill small holes in an object
 
3. Combine objects that are close enough to each other but are not connected
 

Dilation

 

[Dilation 구현]

Dilation 구현

 

Erosion

The erosion of the image I and with a structuring element S is denoted as (I - S)
 

- Shrink objects in an image by removing pixels

 

- Erosion is opposite of dilation.

 

Erosion

 

Erosion 구현

 

Opening and Closing

Opening and closing operations are complex morphological operations
 
They are obtained by combining dilation and erosion

 

Opening and closing can be performed on binary, grayscale and color images.
 

위: Opening, 아래: Closing

 

Opening

Opening = Erosion 후 Dilation 예시

 

Opening generally smooths a contour in an image, breaking narrow isthmuses and eliminating thin protrusions
 

Opening 예시

 

Opening 구현

 

Closing

Opening = Dilation 후 Erosion 예시

 

Closing tends to narrow smooth sections of contours, fusing narrow breaks and long thin gulfs, eliminating small holes, and filling gaps in contours
 

Closing 예시

 

Closing 구현

 

728x90
반응형

댓글