Ask Your Question

Jordan's profile - activity

2019-05-13 10:34:23 -0500 marked best answer Fit ellipse with most points on contour (instead of least squares)

I have a binarized image, which I've already used open/close morphology operations on (this is as clean as I can get it, trust me on this) that looks like so: image description

As you can see, there is an obvious ellipse with some distortion on the top. I'm trying to figure out how to fit an ellipse to it, such that it maximizes the number of points on the fitted ellipse that correspond to edges on the shape. That is, I want a result like this: image description

However, I can't seem to find a way in OpenCV to do this. Using the common tools of fitEllipse (blue line) and minAreaRect (green line), I get these results: image description

Which obviously do not represent the actual ellipse I'm trying to detect. Any thoughts as to how I could accomplish this? Happy to see examples in Python or C++.

EDIT: Original image and intermediate processing steps below, as requested: Original image: image description After an Otsu threshold: image description After Opening morph (7x7 kernel): image description

And then the image at the very top of this post is after a Closing morph (7x7 kernel). Obviously, this particular image could be improved by manually setting a threshold level. However, the images I have to process could be substantially different in lighting conditions, which is why I must use something adaptive (like Otsu).

2019-05-03 00:05:10 -0500 received badge  Enthusiast
2019-05-02 13:57:45 -0500 received badge  Supporter (source)
2019-04-29 21:42:49 -0500 commented answer Fit ellipse with most points on contour (instead of least squares)

@sturkmen in your sample code, is "img" the original image, or the thresholded/opened/closed one? I don't think Hough wi

2019-04-29 15:25:26 -0500 commented answer Fit ellipse with most points on contour (instead of least squares)

Thanks for the ideas. Could you post a sample of running the circular Hough transform on a contour? My impression was th

2019-04-29 15:24:48 -0500 commented question Fit ellipse with most points on contour (instead of least squares)

@supra56 Sure, I edited the post with more images.

2019-04-29 15:24:27 -0500 edited question Fit ellipse with most points on contour (instead of least squares)

Fit ellipse with most points on contour (instead of least squares) I have a binarized image, which I've already used ope

2019-04-29 15:16:29 -0500 commented answer Fit ellipse with most points on contour (instead of least squares)

Thanks for the ideas. Could you post a sample of running the circular Hough transform on a contour? My impression was th

2019-04-29 13:20:58 -0500 commented question Fit ellipse with most points on contour (instead of least squares)

OK, interesting. How would I determine which points on a contour are outliers, after fitting an ellipse?

2019-04-29 11:54:19 -0500 received badge  Organizer (source)
2019-04-29 11:52:55 -0500 asked a question Fit ellipse with most points on contour (instead of least squares)

Fit ellipse with most points on contour (instead of least squares) I have a binarized image, which I've already used ope

2019-04-29 10:42:55 -0500 commented question Ellipse detection in noisy images

@Grillteller thank you for the suggestion. I updated my answer with some results of trying CLAHE, unfortunately it was u

2019-04-29 10:42:20 -0500 edited question Ellipse detection in noisy images

Ellipse detection in noisy images I have to detect a single ellipse in a given image. Here are two examples of the image

2019-04-29 10:41:58 -0500 received badge  Editor (source)
2019-04-29 10:41:58 -0500 edited question Ellipse detection in noisy images

Ellipse detection in noisy images I have to detect a single ellipse in a given image. Here are two examples of the image

2019-04-28 22:00:53 -0500 asked a question Ellipse detection in noisy images

Ellipse detection in noisy images I have to detect a single ellipse in a given image. Here are two examples of the image

2019-04-28 20:52:49 -0500 received badge  Scholar (source)
2012-10-10 05:47:21 -0500 received badge  Student (source)
2012-10-08 16:58:07 -0500 asked a question Problems using the math.h class with OpenCV (c++, VS2012)

Hello,

I'm trying to get my software to work with OpenCV, but am having compile issues. My code uses the math.h "min" function, which takes two numerical input parameters. When I include "core.hpp", however, it starts trying to use the xutility "min" function instead (which also seems to be in the "std" namespace?), which takes 3 parameters and seems to be for some other use. I cannot seem to get VS to use the math.h min function instead of the xutility one. Any suggestions?

Thank you!