1.腐蚀
#include <cv.h>
#include <highgui.h>
#include <cvblob.h>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
//1加载原图
Mat matSrc= imread("/home/mark/Desktop/opencv.jpg", IMREAD_COLOR);
//1.1显示原图
namedWindow("matSrc", WINDOW_NORMAL);
imshow("matSrc", matSrc);
//2把原图转成灰度图
Mat matGray;
cvtColor(matSrc, matGray, CV_BGR2GRAY);
//2.1显示灰度图
namedWindow("matGray", WINDOW_NORMAL);
imshow("matGray", matGray);
//3把灰度图二值化
Mat matBinary;
threshold(matGray, matBinary, 128, 255, THRESH_BINARY);
//3.1显示二值图
namedWindow("matBinary", WINDOW_NORMAL);
imshow("matBinary", matBinary);
//4腐蚀
Mat matResult;
Mat ele