SmallestBlob

Extract the smallest white blob from a binary image.

 

function call:

[out_img1]=vsg('SmallestBlob',in_img1);

 

Arguments:

in_img1 input image, 3 channel RGB, 1 channel greyscale or binary image.

 

Description:

Find the smallest, non-connecting, white blob in a binary image. out_img1 – returns an image of the same dimensions as the input with the smallest input white blob displayed on it.

 

Example:

img = imread('blobs.jpg'); %color image

h=figure;image(img);set(h,'Name','Input Image');

[out_img1]=vsg('Threshold',img,150);

[out_img1]=vsg('SmallestBlob',out_img1);

h=figure;image(uint8(out_img1));set(h,'Name','Smallest blob');

Notes:

Ensure that binary images have a range {0,255}. For colour images, only the red channel is examined. If two blobs have the same size, only the first blob encountered in a raster scan direction is returned.

Home       Functions       Back