Repository: scikit-image/scikit-image

Issue:
Can I detect many ellipses in the same picture?
Can I detect many ellipses in the same picture?


Discussion:
https://scikit-image.org/docs/stable/auto_examples/edges/plot_circular_elliptical_hough_transform.html
what is the meaning of the argument "accuracy" of this function?And how to choose the value?Thank you!
You should probably check the [reference paper](https://ieeexplore.ieee.org/document/1048464) and the [implementation](https://github.com/scikit-image/scikit-image/blob/5e74a4a3a5149a8a14566b81a32bb15499aa3857/skimage/transform/_hough_transform.pyx#L103), but the basic idea is:

* Potential ellipses in the edge image are characterized by their major & minor axis length.
* For any pair of edge pixels (p1, p2), an *accumulator* keeps track of the minor axis lengths of potential ellipses formed with the other points (see the illustration in the reference paper).
* If any bin in the histogram of those accumulated minor axis lengths is above a certain threshold, an ellipse is found and added to the results.

The *accuracy* parameters determines the *bin size* (with `bin_size = accuracy * accuracy`). So if you use a *larger accuracy*, you'll have larger bins and it's more likely that one of these bins will catch enough values to pass the threshold, but you lose some precision on the exact value of the minor axis length.

So `accuracy` and `threshold` give you a trade-off between catching more ellipses and having a more precise estimation of the shape of the ellipses.
We'd welcome a PR to clarify the docstring with this information.

Resolving patch:
diff --git a/doc/examples/edges/plot_circular_elliptical_hough_transform.py b/doc/examples/edges/plot_circular_elliptical_hough_transform.py
--- a/doc/examples/edges/plot_circular_elliptical_hough_transform.py
+++ b/doc/examples/edges/plot_circular_elliptical_hough_transform.py
@@ -80,10 +80,11 @@
 # -------------------
 #
 # The algorithm takes two different points belonging to the ellipse. It
-# assumes that it is the main axis. A loop on all the other points determines
-# how much an ellipse passes to them. A good match corresponds to high
-# accumulator values.
-#
+# assumes that these two points form the major axis. A loop on all the
+# other points determines the minor axis length for candidate ellipses.
+# The latter are included in the results if enough 'valid' candidates have
+# similar minor axis lengths. By valid, we mean candidates for which the
+# minor and major axis lengths fall within the prescribed bounds.
 # A full description of the algorithm can be found in reference [1]_.
 #
 # References
@@ -105,9 +106,11 @@
 edges = canny(image_gray, sigma=2.0, low_threshold=0.55, high_threshold=0.8)
 
 # Perform a Hough Transform
-# The accuracy corresponds to the bin size of a major axis.
-# The value is chosen in order to get a single high accumulator.
-# The threshold eliminates low accumulators
+# The accuracy corresponds to the bin size of the histogram for minor axis lengths.
+# A higher `accuracy` value will lead to more ellipses being found, at the
+# cost of a lower precision on the minor axis length estimation.
+# A higher `threshold` will lead to less ellipses being found, filtering out those
+# with fewer edge points (as found above by the Canny detector) on their perimeter.
 result = hough_ellipse(edges, accuracy=20, threshold=250, min_size=100, max_size=120)
 result.sort(order='accumulator')
 
diff --git a/skimage/transform/hough_transform.py b/skimage/transform/hough_transform.py
--- a/skimage/transform/hough_transform.py
+++ b/skimage/transform/hough_transform.py
@@ -132,22 +132,24 @@ def hough_ellipse(image, threshold=4, accuracy=1, min_size=4, max_size=None):
     image : (M, N) ndarray
         Input image with nonzero values representing edges.
     threshold : int, optional
-        Accumulator threshold value.
+        Accumulator threshold value. A lower value will return more ellipses.
     accuracy : double, optional
-        Bin size on the minor axis used in the accumulator.
+        Bin size on the minor axis used in the accumulator. A higher value
+        will return more ellipses, but lead to a less precise estimation of
+        the minor axis lengths.
     min_size : int, optional
         Minimal major axis length.
     max_size : int, optional
         Maximal minor axis length.
-        If None, the value is set to the half of the smaller
+        If None, the value is set to half of the smaller
         image dimension.
 
     Returns
     -------
     result : ndarray with fields [(accumulator, yc, xc, a, b, orientation)].
-          Where ``(yc, xc)`` is the center, ``(a, b)`` the major and minor
-          axes, respectively. The `orientation` value follows
-          `skimage.draw.ellipse_perimeter` convention.
+        Where ``(yc, xc)`` is the center, ``(a, b)`` the major and minor
+        axes, respectively. The `orientation` value follows the
+        `skimage.draw.ellipse_perimeter` convention.
 
     Examples
     --------
@@ -162,9 +164,17 @@ def hough_ellipse(image, threshold=4, accuracy=1, min_size=4, max_size=None):
 
     Notes
     -----
-    The accuracy must be chosen to produce a peak in the accumulator
-    distribution. In other words, a flat accumulator distribution with low
-    values may be caused by a too low bin size.
+    Potential ellipses in the image are characterized by their major and
+    minor axis lengths. For any pair of nonzero pixels in the image that
+    are at least half of `min_size` apart, an accumulator keeps track of
+    the minor axis lengths of potential ellipses formed with all the
+    other nonzero pixels. If any bin (with `bin_size = accuracy * accuracy`)
+    in the histogram of those accumulated minor axis lengths is above
+    `threshold`, the corresponding ellipse is added to the results.
+
+    A higher `accuracy` will therefore lead to more ellipses being found
+    in the image, at the cost of a less precise estimation of the minor
+    axis length.
 
     References
     ----------


Test patch: