使用形态学滤波对图像进行腐蚀、膨胀运算

#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<iostream>


using namespace std;
using namespace cv;


int main()
{
	Mat image=imread("d:/test/opencv/binary.bmp");
	if(!image.data)
		return 0;
	namedWindow("orginal binary");
	imshow("orginal binary",image);
	Mat eroded,dilated;
	erode(image,eroded,Mat());
	dilate(image,dilated,Mat());
	namedWindow("Eroded Image");
	imshow("Eroded Image",eroded);
	namedWindow("Dilated Image");
	imshow("Dilated Image",dilated);
	waitKey();
	return 0;
}



你可能感兴趣的:(C++,opencv,opencv2)