www.gusucode.com > images 案例代码 matlab源码程序 > images/EnhanceContrastUsingBottomhatAndTophatFilteringExample.m

    %% Enhance Contrast Using Bottom-hat and Top-hat Filtering
% 
%%
% 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)