How to label shape

조회 수: 2 (최근 30일)
amirul
amirul 2014년 4월 10일
S = imread('test.jpg'); S = im2bw(S); S2 = ~S; imshow(S2); S3 = bwlabel(S2); imagesc(S3); S4 = regionprops(S3,'MinorAxisLength','MajorAxisLength','Area','Perimeter','centroid'); for cnt = 1:length(S4) score1(cnt) = abs(1-(S4(cnt).MajorAxisLength-S4(cnt).MinorAxisLength)... /max([S4(cnt).MajorAxisLength,S4(cnt).MinorAxisLength])); score2(cnt) = abs(1 - abs(pi*((mean([S4(cnt).MajorAxisLength,... S4(cnt).MinorAxisLength]))/2)^2-S4(cnt).Area)/S4(cnt).Area); score3(cnt) = abs(1 - abs(pi*(max([S4(cnt).MajorAxisLength,... S4(cnt).MinorAxisLength]))-S4(cnt).Perimeter)/S4(cnt).Perimeter); end score = mean([score1;score2;score3]); imshow(S2) for cnt = 1:length(S4) text(S4(cnt).Centroid(1),S4(cnt).Centroid(2),num2str(score(cnt)),'color','red'); end
how to label the output result, if the score is higher than 0.92, then the object will have label circle. i try using if-else statement, but couldnt get it work.can someone help me.thank you

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by