image thumbnail
from Handling Large Images with Image Processing Toolbox Webinar by Alan Hwang
Code demos for the Handling Large Images with Image Processing Toolbox Webinar.

mySegmentation(I,thresh,area)
function y = mySegmentation(I,thresh,area)

BW = edge(I,'sobel',thresh);
BWdil = imdilate(BW,strel('disk',5));
BWfil = imfill(BWdil,'holes');
BWopen = bwareaopen(BWfil,area);
BWfinal = imerode(BWopen,strel('disk',5));
BWoutline = bwperim(BWfinal);
y = I;
y(BWoutline) = 255;

Contact us at files@mathworks.com