Files
Obsidian-Main/04. Programming/OpenCV API.md

30 lines
917 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## cv2.erode()
### 用途
1. Erosion 影像侵蝕對於移除影像中的小白雜點很有幫助,可用來去噪,例如影像中的小雜點,雜訊。
2. 細化影像,消除毛刺。
### Define
```python
cv.erode(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) ->dst
```
### Arguments
`src`: 二值化的影像
`kernel`: 捲積 kernel
`iterations`: 迭代次數預設為1
## cv2.dilate()
### 用途
1. Dilation 影像膨脹通常是配合著影像侵蝕 Erosion 使用,先使用侵蝕的方式使影像中的線條變窄,同時也去除雜訊,之後再透過 Dilation 將影像膨脹回來。
2. 用來連接兩個很靠近但分開的物體。
### Define
```python
cv.dilate(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]]) ->dst
```
### Arguments
`src`: 二值化的影像
`kernel`: 捲積 kernel
`iterations`: 迭代次數預設為1