当前位置:网站首页>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 .
边栏推荐
- Opencv learning log 12 binarization of Otsu method
- Optimization method of path problem before dynamic planning
- 学习记录:如何进行PWM 输出
- 学习记录:STM32F103 时钟系统概述工作原理
- Flex --- detailed explanation of flex layout attributes
- C语言是低级和高级的分水岭
- 程序员的你,有哪些炫技的代码写法?
- 力扣刷题记录
- 0-1背包問題(一)
- 1010 things that college students majoring in it must do before graduation
猜你喜欢

LeetCode#237. Delete nodes in the linked list

Your wechat nickname may be betraying you

学习记录:TIM—基本定时器

STM32 how to use stlink download program: light LED running light (Library version)

csapp shell lab

LeetCode#36. Effective Sudoku

Take you to use wxpy to create your own chat robot (plus wechat interface basic data visualization)

力扣刷题记录

Learning record: Tim - Basic timer

Borg Maze (BFS+最小生成树)(解题报告)
随机推荐
LeetCode#2062. Count vowel substrings in strings
0-1背包问题(一)
ucorelab3
Research Report on market supply and demand and strategy of China's medical chair industry
Borg Maze (BFS+最小生成树)(解题报告)
Record of brushing questions with force deduction -- complete knapsack problem (I)
数据在内存中的存储&载入内存,让程序运行起来
Research Report on surgical fluid treatment industry - market status analysis and development prospect prediction
Scoring system based on 485 bus
FSM and I2C experiment report
Perinatal Software Industry Research Report - market status analysis and development prospect forecast
Research Report of pharmaceutical solvent industry - market status analysis and development prospect prediction
Matlab comprehensive exercise: application in signal and system
学习记录:如何进行PWM 输出
Accounting regulations and professional ethics [1]
Find 3-friendly Integers
HDU-6025-Coprime Sequence(女生赛)
程序员的你,有哪些炫技的代码写法?
STM32 learning record: LED light flashes (register version)
Stm32 dossiers d'apprentissage: saisie des applications