i need to detect objects from an image using rectangularity and I do not know how to implement it please help me

 採用された回答

Matt J
Matt J 2021 年 12 月 22 日

0 投票

Hard to say without any example images, but pgonCorners might help:
You can use it to find the code's idea of the 4 vertices of the objects. If the vertices form a rectangle to within your tolerances, and if there is strong overlap between that rectangle and the actual object, then you would accept the object as rectangular.

5 件のコメント

esraa mohammed
esraa mohammed 2021 年 12 月 22 日
i need to use rectangular to detect qr code object
Matt J
Matt J 2021 年 12 月 22 日
編集済み: Matt J 2021 年 12 月 22 日
My suggestion seems applicable to this image. The detected vertex pattern for the QR code seems very distinctive.
load Image
BW=bwpropfilt(Image,'ConvexArea',[10000,Inf]);
imshow(BW); hold on
reg=regionprops(BW,'ConvexImage','BoundingBox');
N=numel(reg);
for i=1:N
img=reg(i).ConvexImage;
V = fliplr(pgonCorners(img,4))+reg(i).BoundingBox(1:2); %vertices
scatter(V(:,1),V(:,2),'filled','SizeData',80,'MarkerEdgeColor','y');
end
hold off
esraa mohammed
esraa mohammed 2021 年 12 月 22 日
I'm sorry that I tired you. But an ERROR appears in this part
Matt J
Matt J 2021 年 12 月 22 日
It's because you didn't download pgonCorners.
Matt J
Matt J 2022 年 5 月 3 日
編集済み: Matt J 2022 年 5 月 3 日
@Khizar Khalid What about the example code above? Or at the pgonCorners File Exchange site under the Examples tab?

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2021 年 12 月 23 日

0 投票

Lots of QR code finding routines in the File Exchange.
Some of them might be fairly robust, so check them out.

カテゴリ

ヘルプ センター および File ExchangeImage Processing and Computer Vision についてさらに検索

質問済み:

2021 年 12 月 22 日

編集済み:

2022 年 5 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by