当前位置:网站首页>Opencv learning log 13 corrosion, expansion, opening and closing operations
Opencv learning log 13 corrosion, expansion, opening and closing operations
2022-07-06 15:43:00 【@Spring sauce】
Preface
This article mainly describes the basic operation of image processing : corrosion 、 Expansion and opening and closing operations .
One 、 Code
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
int main()
{
cv::Mat srcMat = imread("C://Users//john//Desktop//1.jpg", 0);
cv::Mat resMat;
cv::Mat res2Mat;
cv::Mat kernel(5, 5, CV_8UC1);
// imshow("src", srcMat);
//threshold(srcMat, resMat, 100, 255, THRESH_BINARY);
adaptiveThreshold(srcMat, resMat, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY_INV, 15, 10);
imshow("res", resMat);
// morphologyEx(resMat, res2Mat, 0, kernel, Point(-1, -1), 1, BORDER_CONSTANT,morphologyDefaultBorderValue());// corrosion
// morphologyEx(resMat, res2Mat, 1, kernel, Point(-1, -1), 1, BORDER_CONSTANT, morphologyDefaultBorderValue());// inflation
// morphologyEx(resMat, res2Mat, 2, kernel, Point(-1, -1), 1, BORDER_CONSTANT, morphologyDefaultBorderValue());// Open operation
morphologyEx(resMat, res2Mat, 3, kernel, Point(-1, -1), 1, BORDER_CONSTANT, morphologyDefaultBorderValue());// Closed operation
imshow("res2", res2Mat);
waitKey(0);
}
summary
1. The code can run directly , If you don't understand, please leave a message .
边栏推荐
- 区间和------离散化
- LeetCode#53. Maximum subarray sum
- 学习记录:使用STM32外部输入中断
- Perinatal Software Industry Research Report - market status analysis and development prospect forecast
- Research Report of exterior wall insulation system (ewis) industry - market status analysis and development prospect prediction
- Shell脚本编程
- Cost accounting [13]
- 动态规划前路径问题
- ucore lab7
- Accounting regulations and professional ethics [2]
猜你喜欢
随机推荐
Find 3-friendly Integers
CS zero foundation introductory learning record
Record of brushing questions with force deduction -- complete knapsack problem (I)
1010 things that college students majoring in it must do before graduation
LeetCode#53. Maximum subarray sum
VS2019初步使用
Perinatal Software Industry Research Report - market status analysis and development prospect forecast
MATLAB综合练习:信号与系统中的应用
Matlab comprehensive exercise: application in signal and system
Learning records: serial communication and solutions to errors encountered
学习记录:TIM—电容按键检测
Cost accounting [19]
Research Report on surgical fluid treatment industry - market status analysis and development prospect prediction
ucorelab4
学习记录:理解 SysTick系统定时器,编写延时函数
LeetCode#118. Yanghui triangle
编程到底难在哪里?
Research Report on medical toilet industry - market status analysis and development prospect forecast
TCP的三次握手与四次挥手
ucore lab5









