当前位置:网站首页>opencv学习笔记四——膨胀/腐蚀/开运算/闭运算
opencv学习笔记四——膨胀/腐蚀/开运算/闭运算
2022-07-07 05:19:00 【我是一个小稻米】
1. 腐蚀
作用: 去毛点
image1 = mpimg.imread('./11.png')
plt.imshow(image1);

kernel = np.ones((3, 3), np.uint8)
image2 = cv2.erode(image1, kernel, iterations = 1)
plt.imshow(image2)

2. 膨胀
将腐蚀的结果,作为膨胀的输入,可以将细小事物变粗大。
kernel = np.ones((3, 3), np.uint8)
image3 = cv2.dilate(image2, kernel, iterations = 1)
plt.imshow(image3)

3. 开运算
先腐蚀再膨胀
image = mpimg.imread('11.png')
kernel = np.ones((3,3), np.uint8)
image1 = cv2.morphologyEx(image, cv2.MORPH_OPEN, kernel)
plt.imshow(image1);

4. 闭运算
先膨胀再腐蚀
image = mpimg.imread('11.png')
kernel = np.ones((3,3), np.uint8)
image1 = cv2.morphologyEx(image, cv2.MORPH_CLOSE, kernel)
plt.imshow(image1);

边栏推荐
- 解读创客思维与数学课程的实际运用
- 【数字IC验证快速入门】10、Verilog RTL设计必会的FIFO
- Linux Installation MySQL 8.0 configuration
- 漏洞复现-easy_tornado
- 2022 Inner Mongolia latest advanced fire facility operator simulation examination question bank and answers
- 云原生存储解决方案Rook-Ceph与Rainbond结合的实践
- It took "7" years to build the robot framework into a micro service
- Zsh shell adds automatic completion and syntax highlighting
- Complex network modeling (II)
- LeetCode中等题之我的日程安排表 I
猜你喜欢
随机推荐
Rainbond 5.6 版本发布,增加多种安装方式,优化拓扑图操作体验
Es FAQ summary
ZCMU--1492: Problem D(C语言)
漏洞复现-easy_tornado
太真实了,原来自己一直没有富裕起来是有原因的
Niu Mei's mathematical problem --- combinatorial number
Network learning (III) -- highly concurrent socket programming (epoll)
BiSeNet的特点
It took "7" years to build the robot framework into a micro service
Who has docker to install MySQL locally?
Application of slip ring of shipborne radar antenna
Example of file segmentation
雅思考试自己的复习进度以及方法使用【日更版】
【數字IC驗證快速入門】15、SystemVerilog學習之基本語法2(操作符、類型轉換、循環、Task/Function...內含實踐練習)
【Go ~ 0到1 】 第七天 获取时间戳,时间比较,时间格式转换,Sleep与定时器
Find the mode in the binary search tree (use medium order traversal as an ordered array)
JS cross browser parsing XML application
Explore dry goods! Apifox construction ideas
Unityhub cracking & unity cracking
青龙面板--整理能用脚本








