Strange result morphological filtering with opening and closing
Hi guys, i try to filter binarized image using closing and opening operation in morphological filtering. But, why the image completely damage ? (note: i have tried to invert the image). Is my kernel / structure element wrong ? Thanks.
invert the image :
Result
as an information, i use 3 x 3 disk structuring element
Mat k = getStructuringElement(MORPH_ELLIPSE,Size(3,3));
here is my opencv code :
Mat k = getStructuringElement(MORPH_ELLIPSE,Size(3,3));
morphologyEx( thresholdImg, openingImg, 3, k );
morphologyEx( openingImg, finalMorph, 2, k );
note, that white things on black bg are expected here, if you have black contours, erode and dilate swap their meaning.
can you explain more detail ? i still don't understand
have a look at the erode / morphology tutorials
you probably have to invert your image (maybe using THRESH_INVERT) before applying the morphology ops.
This result seems consistent with your code. If you are trying to achieve some other result we need to know what it is that you are trying to do :)