MATLAB: “Fill” Binary Image

binaryfillimage

Hi,
Is there a way to "fill" a binary image such that textured regions become black? As an example, I would like to make this first image:
Look like this second image:
Note how the wall towards the left of the image appears mainly white in the first image. Is there a way to darken it so that it becomes more like that shown in the second image?
I have tried using morphological operators such as:
filled = bwmorph(img, 'fill', 100);
But this doesn't seem to have any affect. I am desperate to hear your thoughts.
Thanks for your help!

Best Answer

I believe you would want to either erode the white or dilate the black, (possibly followed by the reverse operation), so as to remove small features.
Or alternately, you could bwlabel() and regionprops() and remove the regions of sufficiently small area. That might not get all of the texture lines though.
Related Question