#include "cv.h"
#include "highgui.h"
using namespace CV;
int main (int argc, char* argv[])
{
Mat src = imread ("misaka.jpg");
Mat DST;
Input image
//output image
//cell size, here is the 8-bit unit
//corrosion position of the 5*5, a negative core
///Corrosion frequency two times
Erode (Src,dst,mat (5,5,cv_8u), Point ( -1,-1), 2);
Imwrite ("Erode.jpg", DST);
Input image
//output image
//cell size, here is the 5*5 8-bit unit
//expansion position, for negative Core center
//Expansion times two times
dilate (Src,dst,mat (5,5,cv_8u ), point ( -1,-1), 2);
Imwrite ("Dilate.jpg", DST);
Input image
//output image
//definition operation: Morph_open for open operation, Morph_close for closed Operation
//unit size, here is 3*3 8-bit Unit
//opening/closing operation position
// Opening and closing operation number
Morphologyex (Src,dst,morph_open,mat (3,3,cv_8u), point ( -1,-1), 1);
Imwrite ("Open.jpg", DST);
Morphologyex (Src,dst,morph_close,mat (3,3,cv_8u), point ( -1,-1), 1);
Imwrite ("Close.jpg", DST);
Imshow ("DST", DST);
Waitkey ();
return 0;
}