opencv-图像腐蚀

/腐蚀:用图像中的暗色部分腐蚀掉图像中的亮色部分/

#include “pch.h”
#include
#include <opencv2/opencv.hpp>
using namespace cv;

int main()
{
Mat image = imread(“C:/Users/csh/Desktop/1.jpg”);
imshow(“原图”, image);
Mat element = getStructuringElement(MORPH_RECT, Size(15, 15));
Mat dstimage;
erode(image, dstimage, element);//进行腐蚀操作
imshow(“效果图”, dstimage);//显示效果图
waitKey(0);
return 0;
}
/getStructuringElement函数的返回值为指定形状和尺寸的结构元素,erode函数为进行图形腐蚀操作的函数/
原图效果图

猜你喜欢

转载自blog.csdn.net/weixin_44270056/article/details/86593196