admin管理员组

文章数量:1123160

I am fitting an incomplete ellipse-an ellipse cap (it is an image already processed). the problem is that, as you can see, at the bottom of fitted ellipse, two small parts on the left and right are not included in the fitted ellipse. These two segments are quite important to and I should include them into the fitted ellipse. I tried RANSAC in scikit-image and fitEllipse in opencv2, but none of them can do this, and as I know RANSAC cannot take weight, which I want to put on the two outlined part.

raw ellipse fitted ellipse

I am fitting an incomplete ellipse-an ellipse cap (it is an image already processed). the problem is that, as you can see, at the bottom of fitted ellipse, two small parts on the left and right are not included in the fitted ellipse. These two segments are quite important to and I should include them into the fitted ellipse. I tried RANSAC in scikit-image and fitEllipse in opencv2, but none of them can do this, and as I know RANSAC cannot take weight, which I want to put on the two outlined part.

raw ellipse fitted ellipse

Share Improve this question edited 1 hour ago Christoph Rackwitz 15.2k5 gold badges38 silver badges49 bronze badges asked 5 hours ago qiang yuqiang yu 11 bronze badge New contributor qiang yu is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 2
  • Please provide enough code so others can better understand or reproduce the problem. – Community Bot Commented 5 hours ago
  • I wouldn't call that an ellipse, not even a part of an ellipse. – Christoph Rackwitz Commented 1 hour ago
Add a comment  | 

1 Answer 1

Reset to default 0

To include the missing segments in the fitted ellipse, try these approaches:

  1. Weighted Fitting: Assign higher weights to the points in the missing segments using scipy.optimize.least_squares for weighted ellipse fitting.

  2. Add Missing Points: Manually add synthetic points along the missing segments and refit the ellipse using cv2.fitEllipse.

  3. Custom Optimization: Use scipy.optimize.minimize to define a custom loss function that prioritizes including the missing parts in the fit.

These methods give more control than RANSAC or cv2.fitEllipse.

本文标签: incomplete ellipse image fitting by pythonStack Overflow