#include <opencv2/opencv.hpp>
#include<opencv2/core/core.hpp>
#include"opencv2/highgui/highgui.hpp"
#include<opencv2/imgproc/imgproc.hpp>
#include<iostream>
#include<time.h>
using namespace std;
using namespace cv;
int main()
{
Mat image = imread("C:/Users/离子键/source/repos/Project8/1.jpg");
namedWindow("【原图】膨胀操作");
namedWindow("【效果图】膨胀操作");
imshow("【原图】膨胀操作",image);
Mat element = getStructuringElement(MORPH_RECT,Size(15,15));
Mat out;
dilate(image, out, element);
imshow("【效果图】膨胀操作",out);
waitKey(0);
return 0;
}
运行结果如图:
原版介绍:
核心代码: