当前位置:网站首页>OPENCV学习DAY5
OPENCV学习DAY5
2022-07-24 09:15:00 【SKYWALKERS_2397】
心态学-腐蚀操作
import cv2
import numpy as np
img = cv2.imread('qing.jpg')
cv2.imshow('img',img)
kernel = np.ones((5, 5),np.uint8)#决定每次腐蚀的范围
erosion = cv2.erode(img,kernel,iterations = 1)#iterations为迭代次数,迭代次数越多,腐蚀程度越深
cv2.imshow('erosion', erosion)
cv2.waitKey(0)
cv2.destroyAllWindows()


改变迭代次数
import cv2
import numpy as np
img = cv2.imread('qing.jpg')
cv2.imshow('img',img)
kernel = np.ones((5, 5),np.uint8)#决定每次腐蚀的范围
erosion = cv2.erode(img,kernel,iterations = 3)#iterations为迭代次数,迭代次数越多,腐蚀程度越深
cv2.imshow('erosion', erosion)
cv2.waitKey(0)
cv2.destroyAllWindows()

改变腐蚀范围
import cv2
import numpy as np
img = cv2.imread('qing.jpg')
cv2.imshow('img',img)
kernel = np.ones((9, 9),np.uint8)#决定每次腐蚀的范围
erosion = cv2.erode(img,kernel,iterations = 1)#iterations为迭代次数,迭代次数越多,腐蚀程度越深
cv2.imshow('erosion', erosion)
cv2.waitKey(0)
cv2.destroyAllWindows()

膨胀操作
import cv2
import numpy as np
img = cv2.imread('qing.jpg')
cv2.imshow('img',img)
kernel = np.ones((9, 9),np.uint8)#决定每次腐蚀的范围
erosion = cv2.erode(img,kernel,iterations = 1)#iterations为迭代次数,迭代次数越多,腐蚀程度越深
cv2.imshow('erosion', erosion)
kernel = np.ones((9, 9),np.uint8)#决定每次腐蚀的范围
dilate = cv2.dilate(erosion,kernel,iterations = 1)#iterations为迭代次数,迭代次数越多,腐蚀程度越深
cv2.imshow('dilate', dilate)
cv2.waitKey(0)
cv2.destroyAllWindows()



膨胀操作与腐蚀操作互逆
边栏推荐
- [the first anniversary of my creation] love needs to be commemorated, so does creation
- Nuggets manufacturing industry, digital commerce cloud supply chain collaborative management system to achieve full chain intelligent management and control
- Pulse netizens have a go interview question, can you answer it correctly?
- Unity解决Package Manager“You seem to be offline”
- How to integrate and use log4net logging plug-in in vs2019 class library
- [example of URDF exercise based on ROS] use of four wheeled robot and camera
- Let's test 5million pieces of data. How to use index acceleration reasonably?
- The difference between & &, | and |
- Virtual machine terminator terminal terminator installation tutorial
- Sword finger offer II 024. reverse linked list
猜你喜欢

【基于ROS的URDF练习实例】四轮机器人与摄像头的使用

Aruba学习笔记06-无线控制AC基础配置(CLI)

Tang Yudi opencv background modeling

Description of MATLAB functions

How to use redis' publish subscribe (MQ) in.Netcore 3.1 project

One year after I came to Ali, I ushered in my first job change

FreeRTOS - use of software timer

来阿里一年后我迎来了第一次工作变动....

科目1-2

排序入门—插入排序和希尔排序
随机推荐
PXE principle and configuration
Aruba学习笔记06-无线控制AC基础配置(CLI)
[the first anniversary of my creation] love needs to be commemorated, so does creation
如何通过NFT GO,来简要判断、分析NFT市场?
Map processing background management menu data
Es document CRUD
Description of MATLAB functions
分类与回归的区别
Discuz论坛搭建详细过程,一看就懂
Nuggets manufacturing industry, digital commerce cloud supply chain collaborative management system to achieve full chain intelligent management and control
2021 robocom world robot developer competition - undergraduate group (Preliminary) problem solution
Six pictures show you why TCP shakes three times?
Ansible 常用模块介绍
Tiktok 16 popular categories, tiktok popular products to see which one you are suitable for?
Unity解决Package Manager“You seem to be offline”
Aruba learning notes 06 wireless control AC basic configuration (CLI)
Open source summer interview | learn with problems, Apache dolphin scheduler, Wang Fuzheng
Tiktok live broadcast with goods marketing play
Little dolphin "transformed" into a new intelligent scheduling engine, which can be explained in simple terms in the practical development and application of DDS
Pulse netizens have a go interview question, can you answer it correctly?