Code covered by the BSD License  

Highlights from
Demos from Image Processing Webinar 2006

image thumbnail
from Demos from Image Processing Webinar 2006 by Bruce Tannenbaum
These demos were used in the Image Webinar recorded on January 19th, 2006

getStatsOnDefects(BW)
% Copyright 2005-2006 The MathWorks, Inc. 
function [statsDefects,stats] = getStatsOnDefects(BW)

%% Use feature analysis to identify broken objects
[labeled,numObjects] = bwlabel(BW,4);
stats = regionprops(labeled,'Eccentricity','Area','BoundingBox');
areas = [stats.Area];
minSize = mean(areas) - 0.25 * std(areas);
eccentricities = [stats.Eccentricity];
idxOfDefects = find(areas < minSize & eccentricities > .5);
statsDefects = stats(idxOfDefects);

Contact us at files@mathworks.com