mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-06 13:30:21 +08:00
Merge pull request #1113 from jucoste/move_canny
Move canny from filter to feature
This commit is contained in:
@@ -3,6 +3,8 @@ Remember to list any API changes below in `doc/source/api_changes.txt`.
|
||||
Version 0.13
|
||||
------------
|
||||
* Remove deprecated `None` defaults for `skimage.exposure.rescale_intensity`
|
||||
* Remove deprecated `skimage.filter.canny` import in filter/__init__.py file (canny is now in `skimage.feature.canny`).
|
||||
* Don't forget to complete api_changes.txt. (`GitHub discuss <https://github.com/scikit-image/scikit-image/pull/1113>`__ )
|
||||
|
||||
Version 0.12
|
||||
------------
|
||||
|
||||
@@ -57,7 +57,7 @@ segmentation. To do this, we first get the edges of features using the Canny
|
||||
edge-detector.
|
||||
"""
|
||||
|
||||
from skimage.filter import canny
|
||||
from skimage.feature import canny
|
||||
edges = canny(coins/255.)
|
||||
|
||||
fig, ax = plt.subplots(figsize=(4, 3))
|
||||
|
||||
@@ -19,7 +19,7 @@ import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from scipy import ndimage
|
||||
|
||||
from skimage import filter
|
||||
from skimage import feature
|
||||
|
||||
|
||||
# Generate noisy image of a square
|
||||
@@ -31,8 +31,8 @@ im = ndimage.gaussian_filter(im, 4)
|
||||
im += 0.2 * np.random.random(im.shape)
|
||||
|
||||
# Compute the Canny filter for two values of sigma
|
||||
edges1 = filter.canny(im)
|
||||
edges2 = filter.canny(im, sigma=3)
|
||||
edges1 = feature.canny(im)
|
||||
edges2 = feature.canny(im, sigma=3)
|
||||
|
||||
# display results
|
||||
fig, (ax1, ax2, ax3) = plt.subplots(nrows=1, ncols=3, figsize=(8, 3))
|
||||
|
||||
@@ -37,16 +37,16 @@ Its size is extended by two times the larger radius.
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data, filter, color
|
||||
from skimage import data, color
|
||||
from skimage.transform import hough_circle
|
||||
from skimage.feature import peak_local_max
|
||||
from skimage.feature import peak_local_max, canny
|
||||
from skimage.draw import circle_perimeter
|
||||
from skimage.util import img_as_ubyte
|
||||
|
||||
|
||||
# Load picture and detect edges
|
||||
image = img_as_ubyte(data.coins()[0:95, 70:370])
|
||||
edges = filter.canny(image, sigma=3, low_threshold=10, high_threshold=50)
|
||||
edges = canny(image, sigma=3, low_threshold=10, high_threshold=50)
|
||||
|
||||
fig, ax = plt.subplots(ncols=1, nrows=1, figsize=(5, 2))
|
||||
|
||||
@@ -106,14 +106,15 @@ References
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data, filter, color
|
||||
from skimage import data, color
|
||||
from skimage.feature import canny
|
||||
from skimage.transform import hough_ellipse
|
||||
from skimage.draw import ellipse_perimeter
|
||||
|
||||
# Load picture, convert to grayscale and detect edges
|
||||
image_rgb = data.coffee()[0:220, 160:420]
|
||||
image_gray = color.rgb2gray(image_rgb)
|
||||
edges = filter.canny(image_gray, sigma=2.0,
|
||||
edges = canny(image_gray, sigma=2.0,
|
||||
low_threshold=0.55, high_threshold=0.8)
|
||||
|
||||
# Perform a Hough Transform
|
||||
|
||||
@@ -58,7 +58,7 @@ References
|
||||
|
||||
from skimage.transform import (hough_line, hough_line_peaks,
|
||||
probabilistic_hough_line)
|
||||
from skimage.filter import canny
|
||||
from skimage.feature import canny
|
||||
from skimage import data
|
||||
|
||||
import numpy as np
|
||||
|
||||
@@ -38,11 +38,11 @@ Edge-based segmentation
|
||||
|
||||
Let us first try to detect edges that enclose the coins. For edge
|
||||
detection, we use the `Canny detector
|
||||
<http://en.wikipedia.org/wiki/Canny_edge_detector>`_ of ``skimage.filter.canny``
|
||||
<http://en.wikipedia.org/wiki/Canny_edge_detector>`_ of ``skimage.feature.canny``
|
||||
|
||||
::
|
||||
|
||||
>>> from skimage.filter import canny
|
||||
>>> from skimage.feature import canny
|
||||
>>> edges = canny(coins/255.)
|
||||
|
||||
As the background is very smooth, almost all edges are found at the
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from ._canny import canny
|
||||
from ._daisy import daisy
|
||||
from ._hog import hog
|
||||
from .texture import greycomatrix, greycoprops, local_binary_pattern
|
||||
@@ -17,7 +18,8 @@ from .util import plot_matches
|
||||
from .blob import blob_dog, blob_log, blob_doh
|
||||
|
||||
|
||||
__all__ = ['daisy',
|
||||
__all__ = ['canny'
|
||||
'daisy',
|
||||
'hog',
|
||||
'greycomatrix',
|
||||
'greycoprops',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import unittest
|
||||
import numpy as np
|
||||
from scipy.ndimage import binary_dilation, binary_erosion
|
||||
import skimage.filter as F
|
||||
import skimage.feature as F
|
||||
|
||||
|
||||
class TestCanny(unittest.TestCase):
|
||||
@@ -1,6 +1,5 @@
|
||||
from .lpi_filter import inverse, wiener, LPIFilter2D
|
||||
from ._gaussian import gaussian_filter
|
||||
from ._canny import canny
|
||||
from .edges import (sobel, hsobel, vsobel, scharr, hscharr, vscharr, prewitt,
|
||||
hprewitt, vprewitt, roberts, roberts_positive_diagonal,
|
||||
roberts_negative_diagonal)
|
||||
@@ -10,7 +9,6 @@ from .thresholding import (threshold_adaptive, threshold_otsu, threshold_yen,
|
||||
threshold_isodata)
|
||||
from . import rank
|
||||
|
||||
|
||||
from skimage._shared.utils import deprecated
|
||||
from skimage import restoration
|
||||
denoise_bilateral = deprecated('skimage.restoration.denoise_bilateral')\
|
||||
@@ -20,6 +18,13 @@ denoise_tv_bregman = deprecated('skimage.restoration.denoise_tv_bregman')\
|
||||
denoise_tv_chambolle = deprecated('skimage.restoration.denoise_tv_chambolle')\
|
||||
(restoration.denoise_tv_chambolle)
|
||||
|
||||
# Backward compatibility v<0.11
|
||||
@deprecated
|
||||
def canny(*args, **kwargs):
|
||||
# Hack to avoid circular import
|
||||
from skimage.feature._canny import canny as canny_
|
||||
return canny_(*args, **kwargs)
|
||||
|
||||
|
||||
__all__ = ['inverse',
|
||||
'wiener',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
|
||||
import skimage
|
||||
from skimage.filter import canny
|
||||
from skimage.feature import canny
|
||||
from .overlayplugin import OverlayPlugin
|
||||
from ..widgets import Slider, ComboBox
|
||||
|
||||
|
||||
Reference in New Issue
Block a user