Image Processing Toolbox | ![]() ![]() |
Step 4: Exaggerate the Gaps Between Objects
The top-hat image contains the "peaks" of objects that fit the structuring element. The imbothat
function shows the gaps between the objects. To maximize the contrast between the objects and the gaps that separate them from each other, the example adds the top-hat image to the original image, and then subtracts the "bottom-hat" image from the result. The example uses the toolbox image arithmetic functions, imadd
and imsubtract
, to perform these operations.
Ienhance = imsubtract(imadd(Itop, afm), Ibot); figure, imshow(Ienhance), title('original + top-hat - bottom-hat');
![]() | Step 3: Enhance the Image Contrast | Step 5: Convert Objects of Interest | ![]() |