Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Filling elements

Hello and thank you always.

The question

Is there any function to fill areas product say of a segmentation?

The situation

I have an image in grey. I apply threshold (or adaptive threshold) and I get a black-white image in which some areas are like big Os, (not necessary circular,also elliptical) meaning white with a black spot inside. Now some of these areas are close to each other.

What I want to get are the same areas but without the black spots inside.

What I ve tried

I ve tried to use closing. say

 kernel= getStructuringElement(MORPH_ELLIPSE, Size(7, 7));
 morphologyEx(original,closing,MORPH_CLOSE,kernel,cv::Point(-1,-1),2);

and depending on my structuring element at some point I got them closed. However since some of these areas are close to each other I also get two unrelated areas connected as a side effect. This is undesirable

Can anyone suggest to me a function to fill convex areas? or any other method to get what I want.

Thanks a thousand