here the code
stats = regionprops(L,'Area','Centroid', 'BoundingBox');threshold = 0.88;for k = 1:length(B)boundary = B{k};delta_sq = diff(boundary).^2;perimeter = sum(sqrt(sum(delta_sq,2)));area = stats(k).Area;metric = 4*pi*area/perimeter^2;metric_string = sprintf('%2.2f',metric);if metric >= threshold centroid = stats(k).Centroid; plot(centroid(1),centroid(2),'ko'); as = sum(metric);end end
Best Answer