フィルターのクリア

Problem on detect ellipse in the image with many shapes inside

5 ビュー (過去 30 日間)
Chanoknunt Sangsobhon
Chanoknunt Sangsobhon 2022 年 10 月 31 日
Excuse me again. I have adapted the code from Shape Recognition because I also want to detect the ellipse shape
But the result is not satisfied since the program can detect ellipse but it also detected other shape as ellipse and stop detecting rectangle and square. I write new condition based on bounding box and extent. So I want to know why the program detect other shape as ellipse and how to fix that. Is there any condition of ellipse that I missed?
Thank you in advanced
imshow(RGB),
title('Results');
hold on
for i = 1 : length(STATS)
W(i) = uint8(abs(STATS(i).BoundingBox(3)-STATS(i).BoundingBox(4)) < 0.1); %%If width and height of bounding box are equal, W(i)=1, otherwise W(i)=0
W(i) = W(i) + 2 * uint8((STATS(i).Extent - 1) == 0 ); % Extent =1 case; If circle/ellipse, back term=0, rec/sqr back term =2
W(i) = W(i) + 4 * uint8((STATS(i).Extent - 1) <= 0.7854); %Extent = pi/4 case ellipse/circle
centroid = STATS(i).Centroid;
switch W(i)
case 5
plot(centroid(1),centroid(2),'wO');
case 2
plot(centroid(1),centroid(2),'wX');
case 3
plot(centroid(1),centroid(2),'wS');
case 4
plot(centroid(1),centroid(2),'w+');
end
end

採用された回答

DGM
DGM 2022 年 10 月 31 日
編集済み: DGM 2022 年 10 月 31 日
The answers on this post by ImageAnalyst and myself include attempts to identify ellipses.
The example I gave seems fine identifying squares, rectangles, circles, ellipses, but is not very reliable at identifying general irregular polygons when the image is this small. See the comment on my answer.
  1 件のコメント
Chanoknunt Sangsobhon
Chanoknunt Sangsobhon 2022 年 11 月 1 日
This is working well. Thank you so much for your help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by