TopHat

Morphological top hat operation (user specifies the connectivity of the structuring element - 4 or 8) [Default=8].

 

function call:

[out_img1]=vsg('TopHat',in_img1,connected);

 

Arguments:

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

connected – an integer specifying whether 4 or 8 connected morphological operations.

 

Description:

The morphological TopHat uses knowledge about the shape characteristics that are not shared by the relevant image structures. An opening with a structuring element (SE) that does not fit the relevant image structures is then used to remove them from the image. These structures are recovered through the arithmetic difference between the image and its opening.

out_img1 – An image which has dimensions the same as the input image. This is the difference between the original image and the same image after being morphologically opened.

 

Example:

img = openimage('crown.jpg');

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

[out_img1]=vsg('TopHat',img,4);

h=figure;imagesc(out_img1(:,:,1));colormap(gray);set(h,'Name','TopHat');

 

Notes:

1. For DICOM images, the function operates on all slices separately.

2. For RGB images, the function operates on all colour planes separately.

3. If any number other than 4 or 8 is provided to the function, it defaults to 4.

Home       Functions       Back