-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CircleModel does not minimize squared distances #5186
Comments
thanks for reporting. As a side note, it would be interesting to compare with scikit learn. See #2698 |
I'm on it. |
That's a great reference page @mark-boer, thanks! And thanks @sciunto for tackling this! 💪 |
If you want you can also have look here, it is a sphere fit, which is almost equivalent to the circle fit and the code is a little bit cleaner than the scipy-cookbook code: It contains a fast_fit, which is algebraic and a iterative fit which calculates the Least squared distances. (tho is see it contains a small error, when calculating radius; it uses the changed error function to calculate the center and then the least squares to calculate the radius). I added a code snippit to my PR that solves this: |
I implemented a ransac circlemodel v2 that I'm currently benchmarking. My implementation is based on optimize.leastsq (mentioned to me the most efficient) in the scipy cookbook. So far, my version is 3 times slower than the current scikit-image version, but I notice a significant improvement regarding both the radius and the center coordinates; it is way more reproducible and closer to the expected result, especially for the radius (10 times more accurate). |
Description
While working on the PR #5179 for a integer overflow in
CircleModel
I recognized that theCircleModel
does not properly minimize the square of the residuals. There is an excellent explanation of this in the scipy-cookbook. It currently is extra sensitive to outliers, because it minimizes:sum( (Ri**2 - Rc**2)**2)
I didn't have a look at the
EllipseModel
, there might be a similar problem there as well.Way to reproduce
This results in:
Version information
The text was updated successfully, but these errors were encountered: