OpenCV C++ image corrosion operation

Procedure description

// Program description: Simple OpenCV image corrosion operation
// Operating system: Windows 10 64bit
// Development language: C++
// IDE version: Visual Studio 2019
// OpenCV version: 4.20

Code

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;

int main()
{
	//载入原图  
	Mat srcImage = imread("20.jpg");
	//显示原图
	imshow("【原图】腐蚀操作", srcImage);
	//进行腐蚀操作 
	Mat element = getStructuringElement(MORPH_RECT, Size(15, 15));
	Mat dstImage;
	erode(srcImage, dstImage, element);
	//显示效果图 
	imshow("【效果图】腐蚀操作", dstImage);
	waitKey(0);

	return 0;
}

operation result

Insert picture description here
Insert picture description here

Novice picture address notes

Reference link .
https://editor.csdn.net/md/?articleId=113690998

Guess you like

Origin blog.csdn.net/m0_51233386/article/details/113683116