Ask Your Question

Revision history [back]

Ellipse fitting similar to ImageJ feature

I have captured images from a video camera and have performed some thresholding so I can detect edges. In ImageJ I can successfully select the inner circle of a donut shaped object with the wand tool, and then use the selection ellipse fit feature to select the inner ellipse and then use the measure feature to get the major/minor/orientation attributes of the ellipse.

Now I want to be able to perform the same functions in Python (using opencv, numpy, scipy, PIL, ...).

Does anyone know how to do this or suggest where to look/ask?

My main stumbling block is finding an equivalent of the ellipse points that the ImageJ wand tool does.

Thanks, Brendan.

Ellipse fitting similar to ImageJ feature

I have captured images from a video camera and have performed some thresholding so I can detect edges. In ImageJ I can successfully select the inner circle of a donut shaped object with the wand tool, and then use the selection ellipse fit feature to select the inner ellipse and then use the measure feature to get the major/minor/orientation attributes of the ellipse.

Now I want to be able to perform the same functions in Python (using opencv, numpy, scipy, PIL, ...).

Does anyone know how to do this or suggest where to look/ask?

My main stumbling block is finding an equivalent of the ellipse points that the ImageJ wand tool does.

Thanks, Brendan.

--

What I've tried is the Ellipse Hough Transform referenced here.

https://scikit-image.org/docs/dev/auto_examples/edges/plot_circular_elliptical_hough_transform.html

The article looks like it would be a perfect fit for what I am trying to achieve, however,

(a) it works on the sample image ok, but it takes a long time (many seconds). I would prefer something that is sub-second to get some kind of real-time performace.

(b) it doesn't seem to work at all on my images. The code just seems to "hang" and never return from the call to hough_ellipse()

With ImageJ if I select the wand tool, click in the inner ellipse or on its edge, the yellow highlighted ellipse appears instantaneously.

I then click on the Analyze > Measure menu item to get the measurements (shows area, major, minor, angle attributes) and the results are instantaneous.

Actually there is another step => select menu Edit > Selection > Fit Ellipse, then do the Measure function. Either way pre or post ellipse fit, the results are very similar.

I want to achieve the same with Python, preferably with opencv, but am open to other libraries too. I assume that selecting outlines of shapes/contours etc is quite common image processing for graphical apps and even computer vision, and some helpful functions are likely available in a library somewhere.

At the end of the day I want to get a reasonably accurate measuremnt of major and minor ellipse attributes, so I need to be able to automatically select/detect an ellipse and run it through an algorithm to determine major/minor.

Thanks, Brendan.

Ellipse fitting similar to ImageJ feature

I have captured images from a video camera and have performed some thresholding so I can detect edges. In ImageJ I can successfully select the inner circle of a donut shaped object with the wand tool, and then use the selection ellipse fit feature to select the inner ellipse and then use the measure feature to get the major/minor/orientation attributes of the ellipse.

Now I want to be able to perform the same functions in Python (using opencv, numpy, scipy, PIL, ...).

Does anyone know how to do this or suggest where to look/ask?

My main stumbling block is finding an equivalent of the ellipse points that the ImageJ wand tool does.

Thanks, Brendan.

--Images:

What I've tried is the Ellipse Hough Transform referenced here.image description

https://scikit-image.org/docs/dev/auto_examples/edges/plot_circular_elliptical_hough_transform.htmlimage description

The article looks like it would be a perfect fit for what I am trying to achieve, however,

(a) it works on the sample image ok, but it takes a long time (many seconds). I would prefer something that is sub-second to get some kind of real-time performace.

(b) it doesn't seem to work at all on my images. The code just seems to "hang" and never return from the call to hough_ellipse()

With ImageJ if I select the wand tool, click in the inner ellipse or on its edge, the yellow highlighted ellipse appears instantaneously.

I then click on the Analyze > Measure menu item to get the measurements (shows area, major, minor, angle attributes) and the results are instantaneous.

Actually there is another step => select menu Edit > Selection > Fit Ellipse, then do the Measure function. Either way pre or post ellipse fit, the results are very similar.

I want to achieve the same with Python, preferably with opencv, but am open to other libraries too. I assume that selecting outlines of shapes/contours etc is quite common image processing for graphical apps and even computer vision, and some helpful functions are likely available in a library somewhere.

At the end of the day I want to get a reasonably accurate measuremnt of major and minor ellipse attributes, so I need to be able to automatically select/detect an ellipse and run it through an algorithm to determine major/minor.

Thanks, Brendan.image description

Ellipse fitting similar to ImageJ feature

I have captured images from a video camera and have performed some thresholding so I can detect edges. In ImageJ I can successfully select the inner circle of a donut shaped object with the wand tool, and then use the selection ellipse fit feature to select the inner ellipse and then use the measure feature to get the major/minor/orientation attributes of the ellipse.

Now I want to be able to perform the same functions in Python (using opencv, numpy, scipy, PIL, ...).

Does anyone know how to do this or suggest where to look/ask?

My main stumbling block is finding an equivalent of the ellipse points that the ImageJ wand tool does.

Thanks, Brendan.--

What I've tried is the Ellipse Hough Transform referenced here.

https://scikit-image.org/docs/dev/auto_examples/edges/plot_circular_elliptical_hough_transform.html

The article looks like it would be a perfect fit for what I am trying to achieve, however,

(a) it works on the sample image ok, but it takes a long time (many seconds). I would prefer something that is sub-second to get some kind of real-time performace.

(b) it doesn't seem to work at all on my images. The code just seems to "hang" and never return from the call to hough_ellipse()

With ImageJ if I select the wand tool, click in the inner ellsipse or on its edge, the yellow highlighted circule appears instantaneously.

I then click on the "Analyze > Measure" menu item to get the measurements (shows area, major, minor, angle attributes) and the results are instantaneous.

Actually there is another step => select menu "Edit > Selection > Fit Ellipse", then do the Measure function. Either way pre or post ellipse fit, the results are very similar.

I want to achieve the same with Python, preferably with opencv, but am open to other libraries too. I assume that selecting outlines of shapes/contours etc is quite common image processing for graphical apps and even computer vision, and some helpful functions are likely available in a library somewhere.

At the end of the day I want to get a reasonably accurate measuremnt of major and minor ellipse attributes, so I need to be able to automatically select/detect an ellipse and run it through an algorithm to determine major/minor.

--

Images:

image description

image description

image description

Ellipse fitting similar to ImageJ feature

I have captured images from a video camera and have performed some thresholding so I can detect edges. In ImageJ I can successfully select the inner circle of a donut shaped object with the wand tool, and then use the selection ellipse fit feature to select the inner ellipse and then use the measure feature to get the major/minor/orientation attributes of the ellipse.

Now I want to be able to perform the same functions in Python (using opencv, numpy, scipy, PIL, ...).

Does anyone know how to do this or suggest where to look/ask?

My main stumbling block is finding an equivalent of the ellipse points that the ImageJ wand tool does.

--

What I've tried is the Ellipse Hough Transform referenced here.

https://scikit-image.org/docs/dev/auto_examples/edges/plot_circular_elliptical_hough_transform.html

https://scikit-image.org/docs/dev/auto_examples/edges/plot_circular_elliptical_hough_transform.html

The article looks like it would be a perfect fit for what I am trying to achieve, however,

(a) it works on the sample image ok, but it takes a long time (many seconds). I would prefer something that is sub-second to get some kind of real-time performace.

(b) it doesn't seem to work at all on my images. The code just seems to "hang" and never return from the call to hough_ellipse()

With ImageJ if I select the wand tool, click in the inner ellsipse or on its edge, the yellow highlighted circule appears instantaneously.

I then click on the "Analyze > Measure" menu item to get the measurements (shows area, major, minor, angle attributes) and the results are instantaneous.

Actually there is another step => select menu "Edit > Selection > Fit Ellipse", then do the Measure function. Either way pre or post ellipse fit, the results are very similar.

I want to achieve the same with Python, preferably with opencv, but am open to other libraries too. I assume that selecting outlines of shapes/contours etc is quite common image processing for graphical apps and even computer vision, and some helpful functions are likely available in a library somewhere.

At the end of the day I want to get a reasonably accurate measuremnt of major and minor ellipse attributes, so I need to be able to automatically select/detect an ellipse and run it through an algorithm to determine major/minor.

--

Images:

image description

image description

image description