mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-24 13:20:43 +08:00
Merge pull request #2159 from soupault/depr_013_filt
Remove deprecared {h/v}sobel, {h/v}prewitt, {h/v}scharr, roberts_{positive/negative} filters
This commit is contained in:
@@ -22,9 +22,6 @@ Version 0.14
|
||||
Version 0.13
|
||||
------------
|
||||
* Remove deprecated `None` defaults for `skimage.exposure.rescale_intensity`
|
||||
* Remove deprecated edge filters `hsobel`, `vsobel`, `hscharr`, `vscharr`,
|
||||
`hprewitt`, `vprewitt`, `roberts_positive_diagonal`,
|
||||
`roberts_negative_diagonal` in `skimage/filters/edges.py`
|
||||
* Remove supported for renamed edge mode, 'nearest' (it is now 'edge'). This
|
||||
involves removing the function _mode_deprecations from skimage._shared.utils
|
||||
as well as any uses of _mode_deprecations from restoration/_denoise.py,
|
||||
|
||||
@@ -3,6 +3,9 @@ Version 0.13
|
||||
- `skimage.filter` has been removed. Use `skimage.filters` instead.
|
||||
- `skimage.filters.canny` has been removed.
|
||||
`canny` is available only from `skimage.feature` now.
|
||||
- Deprecated filters `hsobel`, `vsobel`, `hscharr`, `vscharr`, `hprewitt`,
|
||||
`vprewitt`, `roberts_positive_diagonal`, `roberts_negative_diagonal` have
|
||||
been removed from `skimage.filters.edges`.
|
||||
|
||||
Version 0.12
|
||||
------------
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
from .lpi_filter import inverse, wiener, LPIFilter2D
|
||||
from ._gaussian import gaussian
|
||||
from .edges import (sobel, hsobel, vsobel, sobel_h, sobel_v,
|
||||
scharr, hscharr, vscharr, scharr_h, scharr_v,
|
||||
prewitt, hprewitt, vprewitt, prewitt_h, prewitt_v,
|
||||
roberts, roberts_positive_diagonal,
|
||||
roberts_negative_diagonal, roberts_pos_diag,
|
||||
roberts_neg_diag, laplace)
|
||||
from .edges import (sobel, sobel_h, sobel_v,
|
||||
scharr, scharr_h, scharr_v,
|
||||
prewitt, prewitt_h, prewitt_v,
|
||||
roberts, roberts_pos_diag, roberts_neg_diag,
|
||||
laplace)
|
||||
from ._rank_order import rank_order
|
||||
from ._gabor import gabor_kernel, gabor
|
||||
from .thresholding import (threshold_adaptive, threshold_otsu, threshold_yen,
|
||||
@@ -27,23 +26,15 @@ __all__ = ['inverse',
|
||||
'gaussian',
|
||||
'median',
|
||||
'sobel',
|
||||
'hsobel',
|
||||
'vsobel',
|
||||
'sobel_h',
|
||||
'sobel_v',
|
||||
'scharr',
|
||||
'hscharr',
|
||||
'vscharr',
|
||||
'scharr_h',
|
||||
'scharr_v',
|
||||
'prewitt',
|
||||
'hprewitt',
|
||||
'vprewitt',
|
||||
'prewitt_h',
|
||||
'prewitt_v',
|
||||
'roberts',
|
||||
'roberts_positive_diagonal',
|
||||
'roberts_negative_diagonal',
|
||||
'roberts_pos_diag',
|
||||
'roberts_neg_diag',
|
||||
'laplace',
|
||||
|
||||
+1
-263
@@ -11,7 +11,7 @@ Original author: Lee Kamentsky
|
||||
"""
|
||||
import numpy as np
|
||||
from .. import img_as_float
|
||||
from .._shared.utils import assert_nD, deprecated
|
||||
from .._shared.utils import assert_nD
|
||||
from scipy.ndimage import convolve, binary_erosion, generate_binary_structure
|
||||
|
||||
from ..restoration.uft import laplacian
|
||||
@@ -170,69 +170,6 @@ def sobel_v(image, mask=None):
|
||||
return _mask_filter_result(result, mask)
|
||||
|
||||
|
||||
@deprecated("skimage.filters.sobel_h")
|
||||
def hsobel(image, mask=None):
|
||||
"""Find the horizontal edges of an image using the Sobel transform.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
image : 2-D array
|
||||
Image to process.
|
||||
mask : 2-D array, optional
|
||||
An optional mask to limit the application to a certain area.
|
||||
Note that pixels surrounding masked regions are also masked to
|
||||
prevent masked regions from affecting the result.
|
||||
|
||||
Returns
|
||||
-------
|
||||
output : 2-D array
|
||||
The absolute Sobel edge map.
|
||||
|
||||
Notes
|
||||
-----
|
||||
We use the following kernel and return the absolute value of the
|
||||
result at each point::
|
||||
|
||||
1 2 1
|
||||
0 0 0
|
||||
-1 -2 -1
|
||||
|
||||
"""
|
||||
return np.abs(sobel_h(image, mask))
|
||||
|
||||
|
||||
@deprecated("skimage.filters.sobel_v")
|
||||
def vsobel(image, mask=None):
|
||||
"""Find the vertical edges of an image using the Sobel transform.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
image : 2-D array
|
||||
Image to process
|
||||
mask : 2-D array, optional
|
||||
An optional mask to limit the application to a certain area.
|
||||
Note that pixels surrounding masked regions are also masked to
|
||||
prevent masked regions from affecting the result.
|
||||
|
||||
Returns
|
||||
-------
|
||||
output : 2-D array
|
||||
The absolute Sobel edge map.
|
||||
|
||||
Notes
|
||||
-----
|
||||
We use the following kernel and return the absolute value of the
|
||||
result at each point::
|
||||
|
||||
1 0 -1
|
||||
2 0 -2
|
||||
1 0 -1
|
||||
|
||||
"""
|
||||
return np.abs(sobel_v(image, mask))
|
||||
|
||||
|
||||
def scharr(image, mask=None):
|
||||
"""Find the edge magnitude using the Scharr transform.
|
||||
|
||||
@@ -354,78 +291,6 @@ def scharr_v(image, mask=None):
|
||||
return _mask_filter_result(result, mask)
|
||||
|
||||
|
||||
@deprecated("skimage.filters.scharr_h")
|
||||
def hscharr(image, mask=None):
|
||||
"""Find the horizontal edges of an image using the Scharr transform.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
image : 2-D array
|
||||
Image to process.
|
||||
mask : 2-D array, optional
|
||||
An optional mask to limit the application to a certain area.
|
||||
Note that pixels surrounding masked regions are also masked to
|
||||
prevent masked regions from affecting the result.
|
||||
|
||||
Returns
|
||||
-------
|
||||
output : 2-D array
|
||||
The absolute Scharr edge map.
|
||||
|
||||
Notes
|
||||
-----
|
||||
We use the following kernel and return the absolute value of the
|
||||
result at each point::
|
||||
|
||||
3 10 3
|
||||
0 0 0
|
||||
-3 -10 -3
|
||||
|
||||
References
|
||||
----------
|
||||
.. [1] D. Kroon, 2009, Short Paper University Twente, Numerical
|
||||
Optimization of Kernel Based Image Derivatives.
|
||||
|
||||
"""
|
||||
return np.abs(scharr_h(image, mask))
|
||||
|
||||
|
||||
@deprecated("skimage.filters.scharr_v")
|
||||
def vscharr(image, mask=None):
|
||||
"""Find the vertical edges of an image using the Scharr transform.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
image : 2-D array
|
||||
Image to process
|
||||
mask : 2-D array, optional
|
||||
An optional mask to limit the application to a certain area.
|
||||
Note that pixels surrounding masked regions are also masked to
|
||||
prevent masked regions from affecting the result.
|
||||
|
||||
Returns
|
||||
-------
|
||||
output : 2-D array
|
||||
The absolute Scharr edge map.
|
||||
|
||||
Notes
|
||||
-----
|
||||
We use the following kernel and return the absolute value of the
|
||||
result at each point::
|
||||
|
||||
3 0 -3
|
||||
10 0 -10
|
||||
3 0 -3
|
||||
|
||||
References
|
||||
----------
|
||||
.. [1] D. Kroon, 2009, Short Paper University Twente, Numerical
|
||||
Optimization of Kernel Based Image Derivatives.
|
||||
|
||||
"""
|
||||
return np.abs(scharr_v(image, mask))
|
||||
|
||||
|
||||
def prewitt(image, mask=None):
|
||||
"""Find the edge magnitude using the Prewitt transform.
|
||||
|
||||
@@ -534,68 +399,6 @@ def prewitt_v(image, mask=None):
|
||||
return _mask_filter_result(result, mask)
|
||||
|
||||
|
||||
@deprecated("skimage.filters.prewitt_h")
|
||||
def hprewitt(image, mask=None):
|
||||
"""Find the horizontal edges of an image using the Prewitt transform.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
image : 2-D array
|
||||
Image to process.
|
||||
mask : 2-D array, optional
|
||||
An optional mask to limit the application to a certain area.
|
||||
Note that pixels surrounding masked regions are also masked to
|
||||
prevent masked regions from affecting the result.
|
||||
|
||||
Returns
|
||||
-------
|
||||
output : 2-D array
|
||||
The absolute Prewitt edge map.
|
||||
|
||||
Notes
|
||||
-----
|
||||
We use the following kernel and return the absolute value of the
|
||||
result at each point::
|
||||
|
||||
1 1 1
|
||||
0 0 0
|
||||
-1 -1 -1
|
||||
|
||||
"""
|
||||
return np.abs(prewitt_h(image, mask))
|
||||
|
||||
|
||||
@deprecated("skimage.filters.prewitt_v")
|
||||
def vprewitt(image, mask=None):
|
||||
"""Find the vertical edges of an image using the Prewitt transform.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
image : 2-D array
|
||||
Image to process.
|
||||
mask : 2-D array, optional
|
||||
An optional mask to limit the application to a certain area.
|
||||
Note that pixels surrounding masked regions are also masked to
|
||||
prevent masked regions from affecting the result.
|
||||
|
||||
Returns
|
||||
-------
|
||||
output : 2-D array
|
||||
The absolute Prewitt edge map.
|
||||
|
||||
Notes
|
||||
-----
|
||||
We use the following kernel and return the absolute value of the
|
||||
result at each point::
|
||||
|
||||
1 0 -1
|
||||
1 0 -1
|
||||
1 0 -1
|
||||
|
||||
"""
|
||||
return np.abs(prewitt_v(image, mask))
|
||||
|
||||
|
||||
def roberts(image, mask=None):
|
||||
"""Find the edge magnitude using Roberts' cross operator.
|
||||
|
||||
@@ -700,71 +503,6 @@ def roberts_neg_diag(image, mask=None):
|
||||
return _mask_filter_result(result, mask)
|
||||
|
||||
|
||||
@deprecated("skimage.filters.roberts_pos_diag")
|
||||
def roberts_positive_diagonal(image, mask=None):
|
||||
"""Find the cross edges of an image using Roberts' cross operator.
|
||||
|
||||
The kernel is applied to the input image to produce separate measurements
|
||||
of the gradient component one orientation.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
image : 2-D array
|
||||
Image to process.
|
||||
mask : 2-D array, optional
|
||||
An optional mask to limit the application to a certain area.
|
||||
Note that pixels surrounding masked regions are also masked to
|
||||
prevent masked regions from affecting the result.
|
||||
|
||||
Returns
|
||||
-------
|
||||
output : 2-D array
|
||||
The absolute Robert's edge map.
|
||||
|
||||
Notes
|
||||
-----
|
||||
We use the following kernel and return the absolute value of the
|
||||
result at each point::
|
||||
|
||||
1 0
|
||||
0 -1
|
||||
|
||||
"""
|
||||
return np.abs(roberts_pos_diag(image, mask))
|
||||
|
||||
|
||||
@deprecated("skimage.filters.roberts_neg_diag")
|
||||
def roberts_negative_diagonal(image, mask=None):
|
||||
"""Find the cross edges of an image using the Roberts' Cross operator.
|
||||
|
||||
The kernel is applied to the input image to produce separate measurements
|
||||
of the gradient component one orientation.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
image : 2-D array
|
||||
Image to process.
|
||||
mask : 2-D array, optional
|
||||
An optional mask to limit the application to a certain area.
|
||||
Note that pixels surrounding masked regions are also masked to
|
||||
prevent masked regions from affecting the result.
|
||||
|
||||
Returns
|
||||
-------
|
||||
output : 2-D array
|
||||
The absolute Robert's edge map.
|
||||
|
||||
Notes
|
||||
-----
|
||||
We use the following kernel and return the absolute value of the
|
||||
result at each point::
|
||||
|
||||
0 1
|
||||
-1 0
|
||||
|
||||
"""
|
||||
return np.abs(roberts_neg_diag(image, mask))
|
||||
|
||||
def laplace(image, ksize=3, mask=None):
|
||||
"""Find the edges of an image using the Laplace operator.
|
||||
|
||||
|
||||
@@ -67,13 +67,13 @@ def test_sobel_vertical():
|
||||
assert (np.all(result[np.abs(j) > 1] == 0))
|
||||
|
||||
|
||||
def test_hsobel_zeros():
|
||||
def test_sobel_h_zeros():
|
||||
"""Horizontal sobel on an array of all zeros."""
|
||||
result = filters.sobel_h(np.zeros((10, 10)), np.ones((10, 10), bool))
|
||||
assert (np.all(result == 0))
|
||||
|
||||
|
||||
def test_hsobel_mask():
|
||||
def test_sobel_h_mask():
|
||||
"""Horizontal Sobel on a masked array should be zero."""
|
||||
np.random.seed(0)
|
||||
result = filters.sobel_h(np.random.uniform(size=(10, 10)),
|
||||
@@ -81,7 +81,7 @@ def test_hsobel_mask():
|
||||
assert (np.all(result == 0))
|
||||
|
||||
|
||||
def test_hsobel_horizontal():
|
||||
def test_sobel_h_horizontal():
|
||||
"""Horizontal Sobel on an edge should be a horizontal line."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (i >= 0).astype(float)
|
||||
@@ -92,7 +92,7 @@ def test_hsobel_horizontal():
|
||||
assert (np.all(result[np.abs(i) > 1] == 0))
|
||||
|
||||
|
||||
def test_hsobel_vertical():
|
||||
def test_sobel_h_vertical():
|
||||
"""Horizontal Sobel on a vertical edge should be zero."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (j >= 0).astype(float) * np.sqrt(2)
|
||||
@@ -100,13 +100,13 @@ def test_hsobel_vertical():
|
||||
assert_allclose(result, 0, atol=1e-10)
|
||||
|
||||
|
||||
def test_vsobel_zeros():
|
||||
def test_sobel_v_zeros():
|
||||
"""Vertical sobel on an array of all zeros."""
|
||||
result = filters.sobel_v(np.zeros((10, 10)), np.ones((10, 10), bool))
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_vsobel_mask():
|
||||
def test_sobel_v_mask():
|
||||
"""Vertical Sobel on a masked array should be zero."""
|
||||
np.random.seed(0)
|
||||
result = filters.sobel_v(np.random.uniform(size=(10, 10)),
|
||||
@@ -114,7 +114,7 @@ def test_vsobel_mask():
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_vsobel_vertical():
|
||||
def test_sobel_v_vertical():
|
||||
"""Vertical Sobel on an edge should be a vertical line."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (j >= 0).astype(float)
|
||||
@@ -125,7 +125,7 @@ def test_vsobel_vertical():
|
||||
assert (np.all(result[np.abs(j) > 1] == 0))
|
||||
|
||||
|
||||
def test_vsobel_horizontal():
|
||||
def test_sobel_v_horizontal():
|
||||
"""vertical Sobel on a horizontal edge should be zero."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (i >= 0).astype(float)
|
||||
@@ -168,13 +168,13 @@ def test_scharr_vertical():
|
||||
assert (np.all(result[np.abs(j) > 1] == 0))
|
||||
|
||||
|
||||
def test_hscharr_zeros():
|
||||
def test_scharr_h_zeros():
|
||||
"""Horizontal Scharr on an array of all zeros."""
|
||||
result = filters.scharr_h(np.zeros((10, 10)), np.ones((10, 10), bool))
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_hscharr_mask():
|
||||
def test_scharr_h_mask():
|
||||
"""Horizontal Scharr on a masked array should be zero."""
|
||||
np.random.seed(0)
|
||||
result = filters.scharr_h(np.random.uniform(size=(10, 10)),
|
||||
@@ -182,7 +182,7 @@ def test_hscharr_mask():
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_hscharr_horizontal():
|
||||
def test_scharr_h_horizontal():
|
||||
"""Horizontal Scharr on an edge should be a horizontal line."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (i >= 0).astype(float)
|
||||
@@ -193,7 +193,7 @@ def test_hscharr_horizontal():
|
||||
assert (np.all(result[np.abs(i) > 1] == 0))
|
||||
|
||||
|
||||
def test_hscharr_vertical():
|
||||
def test_scharr_h_vertical():
|
||||
"""Horizontal Scharr on a vertical edge should be zero."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (j >= 0).astype(float)
|
||||
@@ -201,13 +201,13 @@ def test_hscharr_vertical():
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_vscharr_zeros():
|
||||
def test_scharr_v_zeros():
|
||||
"""Vertical Scharr on an array of all zeros."""
|
||||
result = filters.scharr_v(np.zeros((10, 10)), np.ones((10, 10), bool))
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_vscharr_mask():
|
||||
def test_scharr_v_mask():
|
||||
"""Vertical Scharr on a masked array should be zero."""
|
||||
np.random.seed(0)
|
||||
result = filters.scharr_v(np.random.uniform(size=(10, 10)),
|
||||
@@ -215,7 +215,7 @@ def test_vscharr_mask():
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_vscharr_vertical():
|
||||
def test_scharr_v_vertical():
|
||||
"""Vertical Scharr on an edge should be a vertical line."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (j >= 0).astype(float)
|
||||
@@ -226,7 +226,7 @@ def test_vscharr_vertical():
|
||||
assert (np.all(result[np.abs(j) > 1] == 0))
|
||||
|
||||
|
||||
def test_vscharr_horizontal():
|
||||
def test_scharr_v_horizontal():
|
||||
"""vertical Scharr on a horizontal edge should be zero."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (i >= 0).astype(float)
|
||||
@@ -269,13 +269,13 @@ def test_prewitt_vertical():
|
||||
assert_allclose(result[np.abs(j) > 1], 0, atol=1e-10)
|
||||
|
||||
|
||||
def test_hprewitt_zeros():
|
||||
def test_prewitt_h_zeros():
|
||||
"""Horizontal prewitt on an array of all zeros."""
|
||||
result = filters.prewitt_h(np.zeros((10, 10)), np.ones((10, 10), bool))
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_hprewitt_mask():
|
||||
def test_prewitt_h_mask():
|
||||
"""Horizontal prewitt on a masked array should be zero."""
|
||||
np.random.seed(0)
|
||||
result = filters.prewitt_h(np.random.uniform(size=(10, 10)),
|
||||
@@ -283,7 +283,7 @@ def test_hprewitt_mask():
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_hprewitt_horizontal():
|
||||
def test_prewitt_h_horizontal():
|
||||
"""Horizontal prewitt on an edge should be a horizontal line."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (i >= 0).astype(float)
|
||||
@@ -294,7 +294,7 @@ def test_hprewitt_horizontal():
|
||||
assert_allclose(result[np.abs(i) > 1], 0, atol=1e-10)
|
||||
|
||||
|
||||
def test_hprewitt_vertical():
|
||||
def test_prewitt_h_vertical():
|
||||
"""Horizontal prewitt on a vertical edge should be zero."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (j >= 0).astype(float)
|
||||
@@ -302,13 +302,13 @@ def test_hprewitt_vertical():
|
||||
assert_allclose(result, 0, atol=1e-10)
|
||||
|
||||
|
||||
def test_vprewitt_zeros():
|
||||
def test_prewitt_v_zeros():
|
||||
"""Vertical prewitt on an array of all zeros."""
|
||||
result = filters.prewitt_v(np.zeros((10, 10)), np.ones((10, 10), bool))
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_vprewitt_mask():
|
||||
def test_prewitt_v_mask():
|
||||
"""Vertical prewitt on a masked array should be zero."""
|
||||
np.random.seed(0)
|
||||
result = filters.prewitt_v(np.random.uniform(size=(10, 10)),
|
||||
@@ -316,7 +316,7 @@ def test_vprewitt_mask():
|
||||
assert_allclose(result, 0)
|
||||
|
||||
|
||||
def test_vprewitt_vertical():
|
||||
def test_prewitt_v_vertical():
|
||||
"""Vertical prewitt on an edge should be a vertical line."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (j >= 0).astype(float)
|
||||
@@ -327,7 +327,7 @@ def test_vprewitt_vertical():
|
||||
assert_allclose(result[np.abs(j) > 1], 0, atol=1e-10)
|
||||
|
||||
|
||||
def test_vprewitt_horizontal():
|
||||
def test_prewitt_v_horizontal():
|
||||
"""Vertical prewitt on a horizontal edge should be zero."""
|
||||
i, j = np.mgrid[-5:6, -5:6]
|
||||
image = (i >= 0).astype(float)
|
||||
|
||||
Reference in New Issue
Block a user