Skip to content

Commit

Permalink
Merge pull request #3956 from alexandrejaguar/docs_faridderiv
Browse files Browse the repository at this point in the history
Improving documentation and tests for directional filters
  • Loading branch information
sciunto committed Jun 26, 2019
2 parents 44ab69e + b0f2afe commit 7cd1218
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 98 deletions.
19 changes: 10 additions & 9 deletions doc/examples/edges/plot_edge_filter.py
Expand Up @@ -90,21 +90,22 @@
plt.show()

######################################################################
# As in the example above, we illustrate the rotational invariance
# of the filters in this example. The top row shows a
# rotationally invariant image along with the angle of its analytical gradient.
# The other two rows contain the difference between the different gradient
# approximations (Sobel, Prewitt, Scharr & Farid) and analytical gradient.
# As in the previous example, here we illustrate the rotational invariance of
# the filters. The top row shows a rotationally invariant image along with the
# angle of its analytical gradient. The other two rows contain the difference
# between the different gradient approximations (Sobel, Prewitt, Scharr &
# Farid) and analytical gradient.
#
# The Farid & Simoncelli derivative filters [4]_, [5]_ are the most
# rotationally invariant, but require a 5x5 kernel, which is computationally
# more intensive than a 3x3 kernel.
#
# .. [4] Farid, Hany, and Eero P. Simoncelli. "Differentiation of discrete
# multidimensional signals."
# IEEE Transactions on image processing 13.4 (2004): 496-508.
# .. [4] Farid, H. and Simoncelli, E. P., "Differentiation of discrete
# multidimensional signals", IEEE Transactions on Image Processing 13(4):
# 496-508, 2004. :DOI:`10.1109/TIP.2004.823819`
#
# .. [5] https://en.wikipedia.org/wiki/Image_derivatives
# .. [5] Wikipedia, "Farid and Simoncelli Derivatives." Available at:
# <https://en.wikipedia.org/wiki/Image_derivatives#Farid_and_Simoncelli_Derivatives>


x, y = np.mgrid[-10:10:255j, -10:10:255j]
Expand Down
53 changes: 22 additions & 31 deletions skimage/filters/edges.py
Expand Up @@ -548,7 +548,7 @@ def laplace(image, ksize=3, mask=None):


def farid(image, mask=None):
"""Find the edge magnitude using the Farid & Simoncelli transform.
"""Find the edge magnitude using the Farid transform.
Parameters
----------
Expand All @@ -562,7 +562,7 @@ def farid(image, mask=None):
Returns
-------
output : 2-D array
The Farid & Simoncelli edge map.
The Farid edge map.
See also
--------
Expand All @@ -577,13 +577,11 @@ def farid(image, mask=None):
References
----------
.. [1] Farid, Hany, and Eero P. Simoncelli. "Differentiation of discrete
multidimensional signals."
IEEE Transactions on image processing 13.4 (2004): 496-508.
.. [2] https://en.wikipedia.org/wiki/Image_derivatives
#Farid_and_Simoncelli_Derivatives
.. [1] Farid, H. and Simoncelli, E. P., "Differentiation of discrete
multidimensional signals", IEEE Transactions on Image Processing
13(4): 496-508, 2004. :DOI:`10.1109/TIP.2004.823819`
.. [2] Wikipedia, "Farid and Simoncelli Derivatives." Available at:
<https://en.wikipedia.org/wiki/Image_derivatives#Farid_and_Simoncelli_Derivatives>
Examples
--------
Expand All @@ -599,8 +597,7 @@ def farid(image, mask=None):


def farid_h(image, mask=None):
"""Find the horizontal edges of an image using the Farid & Simoncelli
transform.
"""Find the horizontal edges of an image using the Farid transform.
Parameters
----------
Expand All @@ -614,23 +611,20 @@ def farid_h(image, mask=None):
Returns
-------
output : 2-D array
The Farid & Simoncelli edge map.
The Farid edge map.
Notes
-----
The kernel was constructed using the 5-tap weights from [1]
The kernel was constructed using the 5-tap weights from [1].
References
----------
.. [1] Farid, Hany, and Eero P. Simoncelli. "Differentiation of discrete
multidimensional signals."
IEEE Transactions on image processing 13.4 (2004): 496-508.
.. [2] Farid, Hany, and Eero P. Simoncelli. "Optimally
rotation-equivariant directional derivative kernels."
International Conference on Computer Analysis of Images and Patterns.
Springer, Berlin, Heidelberg, 1997.
.. [1] Farid, H. and Simoncelli, E. P., "Differentiation of discrete
multidimensional signals", IEEE Transactions on Image Processing
13(4): 496-508, 2004. :DOI:`10.1109/TIP.2004.823819`
.. [2] Farid, H. and Simoncelli, E. P. "Optimally rotation-equivariant
directional derivative kernels", In: 7th International Conference on
Computer Analysis of Images and Patterns, Kiel, Germany. Sep, 1997.
"""
assert_nD(image, 2)
image = img_as_float(image)
Expand All @@ -639,8 +633,7 @@ def farid_h(image, mask=None):


def farid_v(image, mask=None):
"""Find the vertical edges of an image using the Farid & Simoncelli
transform.
"""Find the vertical edges of an image using the Farid transform.
Parameters
----------
Expand All @@ -654,19 +647,17 @@ def farid_v(image, mask=None):
Returns
-------
output : 2-D array
The Farid & Simoncelli edge map.
The Farid edge map.
Notes
-----
The kernel was constructed using the 5-tap weights from [1]
The kernel was constructed using the 5-tap weights from [1].
References
----------
.. [1] Farid, Hany, and Eero P. Simoncelli. "Differentiation of discrete
multidimensional signals."
IEEE Transactions on image processing 13.4 (2004): 496-508.
.. [1] Farid, H. and Simoncelli, E. P., "Differentiation of discrete
multidimensional signals", IEEE Transactions on Image Processing
13(4): 496-508, 2004. :DOI:`10.1109/TIP.2004.823819`
"""
assert_nD(image, 2)
image = img_as_float(image)
Expand Down

0 comments on commit 7cd1218

Please sign in to comment.