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

    %% Perform Opening-by-Reconstruction to Identify High Intensity Objects
%
%%
% Read a grayscale image and display it.

% Copyright 2015 The MathWorks, Inc.

I = imread('snowflakes.png');
figure
imshow(I)
%%
% Adjust the contast of the image to create the mask image and display
% results.
mask = adapthisteq(I);
figure
imshow(mask)
%%
% Create a marker image that identifies high-intensity objects in the
% image using morphological erosion and display results.
se = strel('disk',5);
marker = imerode(mask,se);
imshow(marker)
%%
% Perform morphological opening on the mask image, using the marker image
% to identify high-intensity objects in the mask.  Display results.
obr = imreconstruct(marker,mask);
figure
imshow(obr,[])