erode(sourceImage,dstImage,element); // 图像腐蚀处理函数
图像腐蚀处理函数 sourceImage 是原始图像 ,dstImage 是目标图像
element 是通过getStructuringElement(MORPH_RECT,Size(15,15))获得的图像元素。
#include <highgui.hpp>
#include <imgproc.hpp>
using namespace cv;
int main()
{
Mat sourceImage = imread("001.jpg");
imshow("原始图",sourceImage);
Mat element = getStructuingElement(MORPH_RECT,Size(15,15);
Mat dstImage;
erode(sourceImage,dstImage,element);
imshow("效果图",dstImage);
waitKey(0);
return 0;
]
原文:http://www.cnblogs.com/whlook/p/6476826.html