![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/188976/image.png)
How can I find circle diameter using arc ?
17 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Syed Sameer Ul Hasan
il 3 Giu 2018
Commentato: Image Analyst
il 6 Giu 2018
I need to find the diameter of a circle. However, the whole circle is not visible in the image, only the arc is shown. How can i find the diameter of the circle using this arc alone ?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190997/image.jpeg)
0 Commenti
Risposta accettata
Image Analyst
il 5 Giu 2018
See attached demo.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/188976/image.png)
6 Commenti
Image Analyst
il 6 Giu 2018
Yes, use a higher resolution camera, and include more of the circle. Improve your lighting. And, depending on the situation and geometry, using a telecentric lens ( a special type of lens that uses parallel rays of light) might help.
Più risposte (4)
sloppydisk
il 3 Giu 2018
Take three points on the arc, draw lines between them and take the bissectors of those lines, where they meet is the center O. The radius is the distance from any of the points to the center O.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/188933/image.png)
10 Commenti
sloppydisk
il 5 Giu 2018
@John D'Errico Yes the picture was only meant as an example to show the general principle of getting the center geometrically. In my example code I did use a least squares fit using the entire curve from fitcircle.m from the file exchange.
Image Analyst
il 4 Giu 2018
Threshold, extract largest blob with bwareafilt(), find perimeter with bwboundaries(), then use the FAQ http://matlab.wikia.com/wiki/FAQ#How_can_I_fit_a_circle_to_a_set_of_XY_data.3F
John D'Errico
il 5 Giu 2018
Modificato: John D'Errico
il 5 Giu 2018
Use the entire curve if possible. Well, all of it that you have. Not just a couple of isolated points.
Extract points from the entire accessible arc, as (x,y) pairs. At this point, it becomes a pure circle fitting problem.
Some years ago, I wrote a circle fitting tool. It tries to produce a fit that does as well as possible, even allowing the use of various solvers like backslash, pinv, or robustfit as alternatives. However, there are many algorithms one might postulate. I'll admit, I'm not in love with the one listed in the FAQ, but it is not that bad either. In some quick tests, it was comparable to the one I wrote. So if your data truly comes from a circle, you probably won't do too much better. And your data should not be too noisy since that arc is quite clear.
Can I do better than that though? Were I to try to do a bit better, I might look to using a maximum likelihood estimation, assuming noise in both x and y on each point. But your data is not that noisy, not that crappy that it is worth the effort.
So where will any "problems" arise? They will come from deviations from pure circularity. Thus, is that arc a perfectly circular arc, with a perfectly fixed radius? I doubt it. In fact, I'll bet that the largest amount of error in your circle parameter estimates come from those deviations from circularity, thus, lack of fit to a true circle, rather than from noise in the fit.
If that is true, then what does it mean to try to do better, fitting a circle perfectly to data that is not perfectly circular? There is a limit beyond which the fit becomes an exercise in absurdity. How can you improve things to best effect? Do a better job of extracting those points on the perimeter of the circle. Improving your data is always a good idea, because that means the algorithms meant to post-process the data will have a far easier time of it.
I would look carefully at the data you have. Compare it to the fit you estimate. Does it have systematic patterns in the residuals between your data and the circle fit. If you see patterns, that means your largest problem lies in lack of fit. And if my conjecture is true, then you won't improve things by making a better circle fit.
0 Commenti
Christine Tobler
il 5 Giu 2018
There's a recent blog post by Loren on fitting a sine wave to a picture by eye:
This won't give you best accuracy, but could be a nice way of doing the fit by hand, and verifying if the final circle you choose fits the picture well.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!