1、代码如下:
#include "stdafx.h"
#include <opencv2/opencv.hpp>using namespace cv;int main()
{Mat srcImage = imread("小狗1.jpg");imshow("显示图像", srcImage);Mat element = getStructuringElement(MORPH_RECT, Size(15, 15));Mat dstImage;erode(srcImage, dstImage, element);imshow("效果图", dstImage);waitKey(0);}
2、运行结果如下:
(1)原图
(2)腐蚀后的效果图