This is example source code.
Mat img; img = imread("moSample.jpg"); Mat element = getStructuringElement(MORPH_RECT, Size(3, 3), Point(1,1) ); Mat rImg; morphologyEx(img, rImg, CV_MOP_CLOSE, element); //morphologyEx(img, img, CV_MOP_CLOSE, element); -> It is also ok. namedWindow("i"); imshow("i",img); namedWindow("r"); imshow("r",rImg); cvWaitKey(0);
In here
We can set filter box size and center point using getStructuringElement function.
-first parameter has
MORPH_RECT, MORPH_CROSS, MORPH_ELLIPSE
They show the shape of the filter box.
-second parameter means size of box.
-third parameter means center point of the box.
This picture is result of morphology processing.
using 9x9 box size / 4,4 center
Thank you.
No comments:
Post a Comment