Centroid16

Replace the greyscale shapes (Range 0-65535) in the original image by their respective centroids (commonly used after the Label_16 operators).

 

function call:

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

Arguments:

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

 

Description:

Replace grey scale shape by a single pixel at its centre of gravity. It is also assumes a black background which is ignored in the centroid calculation. This approach is based on the fact that all the shapes must have a distinct grey scale. out_img1 – An image which contains a white pixel representing the centroid of each white blob in the input image.

 

Example:

img1=openimage('blobs.jpg');

[img1] = vsg('Threshold',img1,100);

[out_img1]=vsg('Centroid16',img1);

h=figure;image(uint8(img1));set(h,'Name','Input image');

h=figure; imagesc(uint8(out_img1));set(h,'Name','Centroid image');

 

Notes:

This function can handle up to 65535 individual blobs. The process is slow, but labels won’t be duplicated up to 65535 blobs.
Home       Functions       Back