www.gusucode.com > images 案例代码 matlab源码程序 > images/UseReconstructionToSegmentAnImageExample.m
%% Use Reconstruction to Segment an Image % %% % Read a logical image into workspace and display it. This is the mask % image. % Copyright 2015 The MathWorks, Inc. mask = imread('text.png'); figure imshow(mask) %% % Create a marker image that identifies the object in the image you want to % extract through segmentation. For this example, identify the "w" in the % word "watershed". marker = false(size(mask)); marker(13,94) = true; %% % Perform segmentation of the mask image using the marker image. im = imreconstruct(marker,mask); figure imshow(im)