How can I find the radius of this object, preferably at multiple x,y points for a consistent output?

3 ビュー (過去 30 日間)
Hi,
Using the grid as a scale and performing spatial calibration on Matlab, I have managed to find the radius using r = s^2+L^2/2*s^2. However this only uses 3 data points. I was looking for a more "robust" method of doing this - i.e fitting multiple points in the image and finding multiple radius/curv values that should ideally all be the same since x^2+y^2 = r^2.
Any advice please?
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2024 年 2 月 7 日
Have you tried searching on the forum for similar questions asked (and answered) before?
Sanam Pun
Sanam Pun 2024 年 2 月 7 日
Hi, I have found some similar topics and have looked into it, however I was unable to apply it to my specific scenario...

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

採用された回答

Matt J
Matt J 2024 年 2 月 7 日
編集済み: Matt J 2024 年 2 月 7 日
You can use circularFit() from this FEX download,
It will allow you to fit the arcs based on more than 3 points. However, it will only fit one object at a time. So, if you have multiple arcs from different objects, you must process them separately.
Also, bear in mind that the circularity of the arcs in your image may be warped depending on the perspective of the camera. The fitting tool doesn't take camera perspective into account.
  10 件のコメント
Sanam Pun
Sanam Pun 2024 年 2 月 7 日
Does viscircles use a particular unit measurement? Or does it automatically scale? Also, from my understanding, all I need is a center points and radius?
imshow(imread('xyz.jpg'));
hold on;
viscircles(centers,radius);
hold off
Matt J
Matt J 2024 年 2 月 7 日
編集済み: Matt J 2024 年 2 月 7 日
viscircles will be in whatever scale the XData and YData of imshow are. You can change the default scale using,
imshow(imread('xyz.jpg') ,XData=[xmin,xmax] , YData=[ymin,ymax]);

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2024 年 2 月 7 日
See the FAQ:
or my attached function.
  2 件のコメント
Sanam Pun
Sanam Pun 2024 年 2 月 7 日
Hi, cheers for this! I used your function and it works perfectly! (doubled checked with a circle I already know the values of i.e xcentre, ycentre ).
Matt J
Matt J 2024 年 2 月 7 日
編集済み: Matt J 2024 年 2 月 7 日
Comparing the fitting performances of the two methods is a bit subjective, I suppose, seeing as it's such a short arc. But, I like mine better ;-)
load xytrial
cf1=circularFit(xy); %Matt J
[xCenter, yCenter, radius] = circlefit(xy(1,:), xy(2,:));
cf2=circularFit.groundtruth([],[xCenter,yCenter], radius); %Image Analyst
%%Compare
H(1)=plot(cf1);
hold on;
H(2)=plot(cf2,{'Color','g','LineStyle','--'});
hold off
legend(H,'Matt J','Image Analyst','Location','SE')
axis([1.2180 3.0 1.6036 3.3441]*1000); axis equal

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by