Merge pull request #641 from sciunto/example_ht

Example Hough transform (ellipse)
This commit is contained in:
Johannes Schönberger
2013-08-05 12:22:57 -07:00
7 changed files with 171 additions and 78 deletions
+13
View File
@@ -184,3 +184,16 @@ def chelsea():
"""
return load("chelsea.png")
def coffee():
"""Coffee cup.
An example with several shapes (including an ellipse).
Notes
-----
No copyright restrictions. CC0 by the photographer.
"""
return load("coffee.png")
Binary file not shown.

After

Width:  |  Height:  |  Size: 456 KiB

+5
View File
@@ -44,6 +44,11 @@ def test_chelsea():
data.chelsea()
def test_coffee():
""" Test that "coffee" image can be loaded. """
data.coffee()
if __name__ == "__main__":
from numpy.testing import run_module_suite
run_module_suite()
+3 -3
View File
@@ -130,9 +130,9 @@ def hough_ellipse(cnp.ndarray img, int threshold=4, double accuracy=1,
--------
>>> img = np.zeros((25, 25), dtype=int)
>>> rr, cc = draw.ellipse_perimeter(10, 10, 6, 8)
>>> img[rr, cc] = 1
>>> result = hough_ellipse(img, threshold=6)
[(10.0, 10.0, 8.0, 6.0474292058692187, 0.0, 8)]
>>> img[cc, rr] = 1
>>> result = hough_ellipse(img, threshold=8)
[(10.0, 10.0, 8.0, 6.0, 0.0, 10)]
Notes
-----