Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

imbothat

Bottom-hat filtering

Syntax

IM2 = imbothat(IM,SE)
IM2 = imbothat(IM,NHOOD)
gpuarrayIM2 = imbothat(gpuarrayIM,___)

Description

IM2 = imbothat(IM,SE) performs morphological bottom-hat filtering on the grayscale or binary input image, IM, returning the filtered image, IM2. SE is a structuring element returned by the strel function. SE must be a single structuring element object, not an array containing multiple structuring element objects.

IM2 = imbothat(IM,NHOOD) performs morphological bottom-hat filtering where NHOOD is an array of 0's and 1's that specifies the size and shape of the structuring element. This is equivalent to imbothat(IM,strel(NHOOD)).

gpuarrayIM2 = imbothat(gpuarrayIM,___) performs operation on a graphics processing unit (GPU), where gpuarrayIM is a gpuArray of class uint8 or logical. This syntax requires the Parallel Computing Toolbox™.

Class Support

IM can be numeric or logical and must be nonsparse. If the input is binary (logical), then the structuring element must be flat.

gpuarrayIM must be a gpuArray of type uint8 or logical. When used with a gpuarray, the structuring element must be flat and two-dimensional.

The output has the same class as the input.

Examples

collapse all

Read image into the workspace and display it.

I = imread('pout.tif');
imshow(I)

Create a disk-shaped structuring element.

se = strel('disk',3);

Add the original image I to the top-hat filtered image, and then subtract the bottom-hat filtered image.

J = imsubtract(imadd(I,imtophat(I,se)),imbothat(I,se));
figure
imshow(J)

Read the image into a gpuArray.

 original = gpuArray(imread('pout.tif'));

Create a disk-shaped structuring element, needed for morphological processing.

se = strel('disk',3);

Add the original image I to the top-hat filtered image, and then subtract the bottom-hat filtered image.

contrastFiltered = ...
       (original+imtophat(original,se))-imbothat(original,se);

Extended Capabilities

Introduced before R2006a

Was this topic helpful?