当前位置:网站首页>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#62. Different paths
- 1010 things that college students majoring in it must do before graduation
- Research Report on surgical fluid treatment industry - market status analysis and development prospect prediction
- Research Report on shell heater industry - market status analysis and development prospect forecast
- Market trend report, technical innovation and market forecast of geosynthetic clay liner in China
- Cost accounting [18]
- LeetCode#204. Count prime
- Report on the market trend, technological innovation and market forecast of printing and decorative paper in China
- STM32学习记录:玩转按键控制蜂鸣器和LED
- Learning record: use STM32 external input interrupt
猜你喜欢
MATLAB综合练习:信号与系统中的应用
Ball Dropping
Learning record: use STM32 external input interrupt
Determine the Photo Position
STM32 how to use stlink download program: light LED running light (Library version)
JS --- all basic knowledge of JS (I)
STM32 learning record: input capture application
C语言是低级和高级的分水岭
Optimization method of path problem before dynamic planning
Flex --- detailed explanation of flex layout attributes
随机推荐
Optimization method of path problem before dynamic planning
Medical colposcope Industry Research Report - market status analysis and development prospect forecast
ucore lab7
初入Redis
China's earthwork equipment market trend report, technical dynamic innovation and market forecast
C语言必背代码大全
Learning record: use STM32 external input interrupt
ucore lab 2
Cost accounting [14]
区间和------离散化
ucore lab 6
CS zero foundation introductory learning record
Hospital privacy screen Industry Research Report - market status analysis and development prospect forecast
Accounting regulations and professional ethics [1]
China potato slicer market trend report, technical dynamic innovation and market forecast
编程到底难在哪里?
ucore lab 6
STM32 learning record: input capture application
Research Report on market supply and demand and strategy of Chinese hospital cleaning chemicals industry
LeetCode#237. Delete nodes in the linked list