I have a binary image in a matrix that I obtained by some image processing. When I say Binary Image I mean it has zeros and ones indicating complete black and complete white pixels. The image is mostly white and has some black spots. I now want to expand this black spots by some factor. How can I do it?
As suggested by Matt, you may look into the morphological operations, eg link
The two basic operators in morphological filters are dilation and erosion. In your case whereby your input is a binary image, erosion will reduce the white pixel area (foreground area) and indirectly enlarges the black pixel area (background). Dilation operator does the exact opposite operation.
Using Matlab, you may do this using imdilate( ) or imerode( ) commands
BW = imread('circbw.tiff'); SE = strel('square',3); BW2 = imerode(BW,SE); % or BW2 = imdilate(BW, SE); imshow(BW2)
SE are actually the structure element. It acts like a "filter region". In the example, SE is a 3x3 square "filter". You may change its shape and size according to your requirement. To learn more about structure element, you may refer to the link just now.
Applying imdilate/imerode will affect the entire foreground. If you only want to change size of only the black spots or only the white spots, you may replace the imerode( ) and try with imopen( )/ imclose( )
Play games and win prizes!Learn more