当前位置:网站首页>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);

边栏推荐
- Implementation of replacement function of shell script
- 船载雷达天线滑环的使用
- 【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
- 复杂网络建模(二)
- The largest 3 same digits in the string of leetcode simple question
- Jmeter 的使用
- buureservewp(2)
- Interview questions (CAS)
- 2022 Inner Mongolia latest advanced fire facility operator simulation examination question bank and answers
- Network learning (I) -- basic model learning
猜你喜欢

Network learning (III) -- highly concurrent socket programming (epoll)

Notes on PHP penetration test topics

漏洞复现-easy_tornado

Avatary的LiveDriver试用体验

Empire CMS collection Empire template program general

Explore dry goods! Apifox construction ideas

eBPF Cilium实战(2) - 底层网络可观测性

机器人教育在动手实践中的真理

OpenVSCode云端IDE加入Rainbond一体化开发体系

【数字IC验证快速入门】10、Verilog RTL设计必会的FIFO
随机推荐
Notes on PHP penetration test topics
解析机器人科技发展观对社会研究论
利用 Helm 在各类 Kubernetes 中安装 Rainbond
藏书馆App基于Rainbond实现云原生DevOps的实践
积分商城管理系统中应包含的四大项
【数字IC验证快速入门】12、SystemVerilog TestBench(SVTB)入门
Empire CMS collection Empire template program general
柯基数据通过Rainbond完成云原生改造,实现离线持续交付客户
The legend about reading the configuration file under SRC
贝叶斯定律
Interview questions (CAS)
Avatary的LiveDriver试用体验
ZCMU--1492: Problem D(C语言)
The element with setfieldsvalue set is obtained as undefined with GetFieldValue
Uniapp mobile terminal forced update function
发挥创客教育空间的广泛实用性
Merging binary trees by recursion
Record a stroke skin bone error of the skirt
Blob object introduction
eBPF Cilium实战(2) - 底层网络可观测性