filters
¶skimage.filters.canny (*args, **kwargs) |
Deprecated function. Use skimage.feature.canny instead. |
skimage.filters.copy_func (f[, name]) |
Create a copy of a function. |
skimage.filters.gabor (image, frequency[, ...]) |
Return real and imaginary responses to Gabor filter. |
skimage.filters.gabor_filter (*args, **kwargs) |
Deprecated function. Use skimage.filters.gabor instead. |
skimage.filters.gabor_kernel (frequency[, ...]) |
Return complex 2D Gabor filter kernel. |
skimage.filters.gaussian (image, sigma[, ...]) |
Multi-dimensional Gaussian filter |
skimage.filters.gaussian_filter (*args, **kwargs) |
Deprecated function. Use skimage.filters.gaussian instead. |
skimage.filters.hprewitt (*args, **kwargs) |
Deprecated function. Use skimage.filters.prewitt_h instead. |
skimage.filters.hscharr (*args, **kwargs) |
Deprecated function. Use skimage.filters.scharr_h instead. |
skimage.filters.hsobel (*args, **kwargs) |
Deprecated function. Use skimage.filters.sobel_h instead. |
skimage.filters.inverse (data[, ...]) |
Apply the filter in reverse to the given data. |
skimage.filters.laplace (image[, ksize, mask]) |
Find the edges of an image using the Laplace operator. |
skimage.filters.median (image, selem[, out, ...]) |
Return local median of an image. |
skimage.filters.prewitt (image[, mask]) |
Find the edge magnitude using the Prewitt transform. |
skimage.filters.prewitt_h (image[, mask]) |
Find the horizontal edges of an image using the Prewitt transform. |
skimage.filters.prewitt_v (image[, mask]) |
Find the vertical edges of an image using the Prewitt transform. |
skimage.filters.rank_order (image) |
Return an image of the same shape where each pixel is the index of the pixel value in the ascending order of the unique values of image, aka the rank-order value. |
skimage.filters.roberts (image[, mask]) |
Find the edge magnitude using Roberts’ cross operator. |
skimage.filters.roberts_neg_diag (image[, mask]) |
Find the cross edges of an image using the Roberts’ Cross operator. |
skimage.filters.roberts_negative_diagonal (...) |
Deprecated function. Use skimage.filters.roberts_neg_diag instead. |
skimage.filters.roberts_pos_diag (image[, mask]) |
Find the cross edges of an image using Roberts’ cross operator. |
skimage.filters.roberts_positive_diagonal (...) |
Deprecated function. Use skimage.filters.roberts_pos_diag instead. |
skimage.filters.scharr (image[, mask]) |
Find the edge magnitude using the Scharr transform. |
skimage.filters.scharr_h (image[, mask]) |
Find the horizontal edges of an image using the Scharr transform. |
skimage.filters.scharr_v (image[, mask]) |
Find the vertical edges of an image using the Scharr transform. |
skimage.filters.sobel (image[, mask]) |
Find the edge magnitude using the Sobel transform. |
skimage.filters.sobel_h (image[, mask]) |
Find the horizontal edges of an image using the Sobel transform. |
skimage.filters.sobel_v (image[, mask]) |
Find the vertical edges of an image using the Sobel transform. |
skimage.filters.threshold_adaptive (image, ...) |
Applies an adaptive threshold to an array. |
skimage.filters.threshold_isodata (image[, ...]) |
Return threshold value(s) based on ISODATA method. |
skimage.filters.threshold_li (image) |
Return threshold value based on adaptation of Li’s Minimum Cross Entropy method. |
skimage.filters.threshold_otsu (image[, nbins]) |
Return threshold value based on Otsu’s method. |
skimage.filters.threshold_yen (image[, nbins]) |
Return threshold value based on Yen’s method. |
skimage.filters.vprewitt (*args, **kwargs) |
Deprecated function. Use skimage.filters.prewitt_v instead. |
skimage.filters.vscharr (*args, **kwargs) |
Deprecated function. Use skimage.filters.scharr_v instead. |
skimage.filters.vsobel (*args, **kwargs) |
Deprecated function. Use skimage.filters.sobel_v instead. |
skimage.filters.wiener (data[, ...]) |
Minimum Mean Square Error (Wiener) inverse filter. |
skimage.filters.LPIFilter2D (...) |
Linear Position-Invariant Filter (2-dimensional) |
skimage.filters.deprecated ([alt_func, behavior]) |
Decorator to mark deprecated functions with warning. |
skimage.filters.
gabor
(image, frequency, theta=0, bandwidth=1, sigma_x=None, sigma_y=None, n_stds=3, offset=0, mode='reflect', cval=0)[source]¶Return real and imaginary responses to Gabor filter.
The real and imaginary parts of the Gabor filter kernel are applied to the image and the response is returned as a pair of arrays.
Gabor filter is a linear filter with a Gaussian kernel which is modulated by a sinusoidal plane wave. Frequency and orientation representations of the Gabor filter are similar to those of the human visual system. Gabor filter banks are commonly used in computer vision and image processing. They are especially suitable for edge detection and texture classification.
Parameters: | image : 2-D array
frequency : float
theta : float, optional
bandwidth : float, optional
sigma_x, sigma_y : float, optional
n_stds : scalar, optional
offset : float, optional
mode : {‘constant’, ‘nearest’, ‘reflect’, ‘mirror’, ‘wrap’}, optional
cval : scalar, optional
|
---|---|
Returns: | real, imag : arrays
|
References
[R186] | http://en.wikipedia.org/wiki/Gabor_filter |
[R187] | http://mplab.ucsd.edu/tutorials/gabor.pdf |
Examples
>>> from skimage.filters import gabor
>>> from skimage import data, io
>>> from matplotlib import pyplot as plt
>>> image = data.coins()
>>> # detecting edges in a coin image
>>> filt_real, filt_imag = gabor(image, frequency=0.6)
>>> plt.figure()
>>> io.imshow(filt_real)
>>> io.show()
>>> # less sensitivity to finer details with the lower frequency kernel
>>> filt_real, filt_imag = gabor(image, frequency=0.1)
>>> plt.figure()
>>> io.imshow(filt_real)
>>> io.show()
skimage.filters.
gabor_filter
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.gabor
instead.
Return real and imaginary responses to Gabor filter.
The real and imaginary parts of the Gabor filter kernel are applied to the image and the response is returned as a pair of arrays.
Gabor filter is a linear filter with a Gaussian kernel which is modulated by a sinusoidal plane wave. Frequency and orientation representations of the Gabor filter are similar to those of the human visual system. Gabor filter banks are commonly used in computer vision and image processing. They are especially suitable for edge detection and texture classification.
Parameters: | image : 2-D array
frequency : float
theta : float, optional
bandwidth : float, optional
sigma_x, sigma_y : float, optional
n_stds : scalar, optional
offset : float, optional
mode : {‘constant’, ‘nearest’, ‘reflect’, ‘mirror’, ‘wrap’}, optional
cval : scalar, optional
|
---|---|
Returns: | real, imag : arrays
|
References
[R188] | http://en.wikipedia.org/wiki/Gabor_filter |
[R189] | http://mplab.ucsd.edu/tutorials/gabor.pdf |
Examples
>>> from skimage.filters import gabor
>>> from skimage import data, io
>>> from matplotlib import pyplot as plt
>>> image = data.coins()
>>> # detecting edges in a coin image
>>> filt_real, filt_imag = gabor(image, frequency=0.6)
>>> plt.figure()
>>> io.imshow(filt_real)
>>> io.show()
>>> # less sensitivity to finer details with the lower frequency kernel
>>> filt_real, filt_imag = gabor(image, frequency=0.1)
>>> plt.figure()
>>> io.imshow(filt_real)
>>> io.show()
skimage.filters.
gabor_kernel
(frequency, theta=0, bandwidth=1, sigma_x=None, sigma_y=None, n_stds=3, offset=0)[source]¶Return complex 2D Gabor filter kernel.
Gabor kernel is a Gaussian kernel modulated by a complex harmonic function. Harmonic function consists of an imaginary sine function and a real cosine function. Spatial frequency is inversely proportional to the wavelength of the harmonic and to the standard deviation of a Gaussian kernel. The bandwidth is also inversely proportional to the standard deviation.
Parameters: | frequency : float
theta : float, optional
bandwidth : float, optional
sigma_x, sigma_y : float, optional
n_stds : scalar, optional
offset : float, optional
|
---|---|
Returns: | g : complex array
|
References
[R190] | http://en.wikipedia.org/wiki/Gabor_filter |
[R191] | http://mplab.ucsd.edu/tutorials/gabor.pdf |
Examples
>>> from skimage.filters import gabor_kernel
>>> from skimage import io
>>> from matplotlib import pyplot as plt
>>> gk = gabor_kernel(frequency=0.2)
>>> plt.figure()
>>> io.imshow(gk.real)
>>> io.show()
>>> # more ripples (equivalent to increasing the size of the
>>> # Gaussian spread)
>>> gk = gabor_kernel(frequency=0.2, bandwidth=0.1)
>>> plt.figure()
>>> io.imshow(gk.real)
>>> io.show()
skimage.filters.
gaussian
(image, sigma, output=None, mode='nearest', cval=0, multichannel=None)[source]¶Multi-dimensional Gaussian filter
Parameters: | image : array-like
sigma : scalar or sequence of scalars
output : array, optional
mode : {‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’}, optional
cval : scalar, optional
multichannel : bool, optional (default: None)
|
---|---|
Returns: | filtered_image : ndarray
|
Notes
This function is a wrapper around scipy.ndi.gaussian_filter()
.
Integer arrays are converted to float.
The multi-dimensional filter is implemented as a sequence of one-dimensional convolution filters. The intermediate arrays are stored in the same data type as the output. Therefore, for output types with a limited precision, the results may be imprecise because intermediate results may be stored with insufficient precision.
Examples
>>> a = np.zeros((3, 3))
>>> a[1, 1] = 1
>>> a
array([[ 0., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 0.]])
>>> gaussian(a, sigma=0.4) # mild smoothing
array([[ 0.00163116, 0.03712502, 0.00163116],
[ 0.03712502, 0.84496158, 0.03712502],
[ 0.00163116, 0.03712502, 0.00163116]])
>>> gaussian(a, sigma=1) # more smooting
array([[ 0.05855018, 0.09653293, 0.05855018],
[ 0.09653293, 0.15915589, 0.09653293],
[ 0.05855018, 0.09653293, 0.05855018]])
>>> # Several modes are possible for handling boundaries
>>> gaussian(a, sigma=1, mode='reflect')
array([[ 0.08767308, 0.12075024, 0.08767308],
[ 0.12075024, 0.16630671, 0.12075024],
[ 0.08767308, 0.12075024, 0.08767308]])
>>> # For RGB images, each is filtered separately
>>> from skimage.data import astronaut
>>> image = astronaut()
>>> filtered_img = gaussian(image, sigma=1, multichannel=True)
skimage.filters.
gaussian_filter
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.gaussian
instead.
Multi-dimensional Gaussian filter
Parameters: | image : array-like
sigma : scalar or sequence of scalars
output : array, optional
mode : {‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’}, optional
cval : scalar, optional
multichannel : bool, optional (default: None)
|
---|---|
Returns: | filtered_image : ndarray
|
Notes
This function is a wrapper around scipy.ndi.gaussian_filter()
.
Integer arrays are converted to float.
The multi-dimensional filter is implemented as a sequence of one-dimensional convolution filters. The intermediate arrays are stored in the same data type as the output. Therefore, for output types with a limited precision, the results may be imprecise because intermediate results may be stored with insufficient precision.
Examples
>>> a = np.zeros((3, 3))
>>> a[1, 1] = 1
>>> a
array([[ 0., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 0.]])
>>> gaussian(a, sigma=0.4) # mild smoothing
array([[ 0.00163116, 0.03712502, 0.00163116],
[ 0.03712502, 0.84496158, 0.03712502],
[ 0.00163116, 0.03712502, 0.00163116]])
>>> gaussian(a, sigma=1) # more smooting
array([[ 0.05855018, 0.09653293, 0.05855018],
[ 0.09653293, 0.15915589, 0.09653293],
[ 0.05855018, 0.09653293, 0.05855018]])
>>> # Several modes are possible for handling boundaries
>>> gaussian(a, sigma=1, mode='reflect')
array([[ 0.08767308, 0.12075024, 0.08767308],
[ 0.12075024, 0.16630671, 0.12075024],
[ 0.08767308, 0.12075024, 0.08767308]])
>>> # For RGB images, each is filtered separately
>>> from skimage.data import astronaut
>>> image = astronaut()
>>> filtered_img = gaussian(image, sigma=1, multichannel=True)
skimage.filters.
hprewitt
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.prewitt_h
instead.
Find the horizontal edges of an image using the Prewitt transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
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
skimage.filters.
hscharr
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.scharr_h
instead.
Find the horizontal edges of an image using the Scharr transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
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
[R192] | D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives. |
skimage.filters.
hsobel
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.sobel_h
instead.
Find the horizontal edges of an image using the Sobel transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
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
skimage.filters.
inverse
(data, impulse_response=None, filter_params={}, max_gain=2, predefined_filter=None)[source]¶Apply the filter in reverse to the given data.
Parameters: | data : (M,N) ndarray
impulse_response : callable f(r, c, **filter_params)
filter_params : dict
max_gain : float
|
---|---|
Other Parameters: | |
predefined_filter : LPIFilter2D
|
skimage.filters.
laplace
(image, ksize=3, mask=None)[source]¶Find the edges of an image using the Laplace operator.
Parameters: | image : ndarray
ksize : int, optional
mask : ndarray, optional
|
---|---|
Returns: | output : ndarray
|
Notes
The Laplacian operator is generated using the function skimage.restoration.uft.laplacian().
skimage.filters.
median
(image, selem, out=None, mask=None, shift_x=False, shift_y=False)[source]¶Return local median of an image.
Parameters: | image : 2-D array (uint8, uint16)
selem : 2-D array
out : 2-D array (same dtype as input)
mask : ndarray
shift_x, shift_y : int
|
---|---|
Returns: | out : 2-D array (same dtype as input image)
|
Examples
>>> from skimage import data
>>> from skimage.morphology import disk
>>> from skimage.filters.rank import median
>>> img = data.camera()
>>> med = median(img, disk(5))
skimage.filters.
prewitt
(image, mask=None)[source]¶Find the edge magnitude using the Prewitt transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
Return the square root of the sum of squares of the horizontal and vertical Prewitt transforms. The edge magnitude depends slightly on edge directions, since the approximation of the gradient operator by the Prewitt operator is not completely rotation invariant. For a better rotation invariance, the Scharr operator should be used. The Sobel operator has a better rotation invariance than the Prewitt operator, but a worse rotation invariance than the Scharr operator.
Examples
>>> from skimage import data
>>> camera = data.camera()
>>> from skimage import filters
>>> edges = filters.prewitt(camera)
skimage.filters.
prewitt_h
(image, mask=None)[source]¶Find the horizontal edges of an image using the Prewitt transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel:
1 1 1
0 0 0
-1 -1 -1
skimage.filters.
prewitt_v
(image, mask=None)[source]¶Find the vertical edges of an image using the Prewitt transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel:
1 0 -1
1 0 -1
1 0 -1
skimage.filters.
rank_order
(image)[source]¶Return an image of the same shape where each pixel is the index of the pixel value in the ascending order of the unique values of image, aka the rank-order value.
Parameters: | image: ndarray |
---|---|
Returns: | labels: ndarray of type np.uint32, of shape image.shape
original_values: 1-D ndarray
|
Examples
>>> a = np.array([[1, 4, 5], [4, 4, 1], [5, 1, 1]])
>>> a
array([[1, 4, 5],
[4, 4, 1],
[5, 1, 1]])
>>> rank_order(a)
(array([[0, 1, 2],
[1, 1, 0],
[2, 0, 0]], dtype=uint32), array([1, 4, 5]))
>>> b = np.array([-1., 2.5, 3.1, 2.5])
>>> rank_order(b)
(array([0, 1, 2, 1], dtype=uint32), array([-1. , 2.5, 3.1]))
skimage.filters.
roberts
(image, mask=None)[source]¶Find the edge magnitude using Roberts’ cross operator.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Examples
>>> from skimage import data
>>> camera = data.camera()
>>> from skimage import filters
>>> edges = filters.roberts(camera)
skimage.filters.
roberts_neg_diag
(image, mask=None)[source]¶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
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel:
0 1
-1 0
skimage.filters.
roberts_negative_diagonal
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.roberts_neg_diag
instead.
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
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel and return the absolute value of the result at each point:
0 1
-1 0
skimage.filters.
roberts_pos_diag
(image, mask=None)[source]¶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
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel:
1 0
0 -1
skimage.filters.
roberts_positive_diagonal
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.roberts_pos_diag
instead.
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
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel and return the absolute value of the result at each point:
1 0
0 -1
skimage.filters.
scharr
(image, mask=None)[source]¶Find the edge magnitude using the Scharr transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
Take the square root of the sum of the squares of the horizontal and vertical Scharrs to get a magnitude that is somewhat insensitive to direction. The Scharr operator has a better rotation invariance than other edge filters such as the Sobel or the Prewitt operators.
References
[R193] | D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives. |
[R194] | http://en.wikipedia.org/wiki/Sobel_operator#Alternative_operators |
Examples
>>> from skimage import data
>>> camera = data.camera()
>>> from skimage import filters
>>> edges = filters.scharr(camera)
skimage.filters.
scharr_h
(image, mask=None)[source]¶Find the horizontal edges of an image using the Scharr transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel:
3 10 3
0 0 0
-3 -10 -3
References
[R195] | D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives. |
skimage.filters.
scharr_v
(image, mask=None)[source]¶Find the vertical edges of an image using the Scharr transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel:
3 0 -3
10 0 -10
3 0 -3
References
[R196] | D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives. |
skimage.filters.
sobel
(image, mask=None)[source]¶Find the edge magnitude using the Sobel transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
Take the square root of the sum of the squares of the horizontal and vertical Sobels to get a magnitude that’s somewhat insensitive to direction.
The 3x3 convolution kernel used in the horizontal and vertical Sobels is an approximation of the gradient of the image (with some slight blurring since 9 pixels are used to compute the gradient at a given pixel). As an approximation of the gradient, the Sobel operator is not completely rotation-invariant. The Scharr operator should be used for a better rotation invariance.
Note that scipy.ndimage.sobel
returns a directional Sobel which
has to be further processed to perform edge detection.
Examples
>>> from skimage import data
>>> camera = data.camera()
>>> from skimage import filters
>>> edges = filters.sobel(camera)
skimage.filters.
sobel_h
(image, mask=None)[source]¶Find the horizontal edges of an image using the Sobel transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel:
1 2 1
0 0 0
-1 -2 -1
skimage.filters.
sobel_v
(image, mask=None)[source]¶Find the vertical edges of an image using the Sobel transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
Notes
We use the following kernel:
1 0 -1
2 0 -2
1 0 -1
skimage.filters.
threshold_adaptive
(image, block_size, method='gaussian', offset=0, mode='reflect', param=None)[source]¶Applies an adaptive threshold to an array.
Also known as local or dynamic thresholding where the threshold value is the weighted mean for the local neighborhood of a pixel subtracted by a constant. Alternatively the threshold can be determined dynamically by a a given function using the ‘generic’ method.
Parameters: | image : (N, M) ndarray
block_size : int
method : {‘generic’, ‘gaussian’, ‘mean’, ‘median’}, optional
offset : float, optional
mode : {‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’}, optional
param : {int, function}, optional
|
---|---|
Returns: | threshold : (N, M) ndarray
|
References
[R197] | http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=threshold#adaptivethreshold |
Examples
>>> from skimage.data import camera
>>> image = camera()[:50, :50]
>>> binary_image1 = threshold_adaptive(image, 15, 'mean')
>>> func = lambda arr: arr.mean()
>>> binary_image2 = threshold_adaptive(image, 15, 'generic', param=func)
skimage.filters.
threshold_isodata
(image, nbins=256, return_all=False)[source]¶Return threshold value(s) based on ISODATA method.
Histogram-based threshold, known as Ridler-Calvard method or inter-means. Threshold values returned satisfy the following equality:
That is, returned thresholds are intensities that separate the image into two groups of pixels, where the threshold intensity is midway between the mean intensities of these groups.
For integer images, the above equality holds to within one; for floating- point images, the equality holds to within the histogram bin-width.
Parameters: | image : array
nbins : int, optional
return_all: bool, optional
|
---|---|
Returns: | threshold : float or int or array
|
References
[R198] | Ridler, TW & Calvard, S (1978), “Picture thresholding using an iterative selection method” |
[R199] | IEEE Transactions on Systems, Man and Cybernetics 8: 630-632, http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4310039 |
[R200] | Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146-165, http://www.busim.ee.boun.edu.tr/~sankur/SankurFolder/Threshold_survey.pdf |
[R201] | ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold |
Examples
>>> from skimage.data import coins
>>> image = coins()
>>> thresh = threshold_isodata(image)
>>> binary = image > thresh
skimage.filters.
threshold_li
(image)[source]¶Return threshold value based on adaptation of Li’s Minimum Cross Entropy method.
Parameters: | image : array
|
---|---|
Returns: | threshold : float
|
References
[R202] | Li C.H. and Lee C.K. (1993) “Minimum Cross Entropy Thresholding” Pattern Recognition, 26(4): 617-625 |
[R203] | Li C.H. and Tam P.K.S. (1998) “An Iterative Algorithm for Minimum Cross Entropy Thresholding” Pattern Recognition Letters, 18(8): 771-776 |
[R204] | Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146-165 http://citeseer.ist.psu.edu/sezgin04survey.html |
[R205] | ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold |
Examples
>>> from skimage.data import camera
>>> image = camera()
>>> thresh = threshold_li(image)
>>> binary = image > thresh
skimage.filters.
threshold_otsu
(image, nbins=256)[source]¶Return threshold value based on Otsu’s method.
Parameters: | image : array
nbins : int, optional
|
---|---|
Returns: | threshold : float
|
Notes
The input image must be grayscale.
References
[R206] | Wikipedia, http://en.wikipedia.org/wiki/Otsu’s_Method |
Examples
>>> from skimage.data import camera
>>> image = camera()
>>> thresh = threshold_otsu(image)
>>> binary = image <= thresh
skimage.filters.
threshold_yen
(image, nbins=256)[source]¶Return threshold value based on Yen’s method.
Parameters: | image : array
nbins : int, optional
|
---|---|
Returns: | threshold : float
|
References
[R207] | Yen J.C., Chang F.J., and Chang S. (1995) “A New Criterion for Automatic Multilevel Thresholding” IEEE Trans. on Image Processing, 4(3): 370-378 |
[R208] | Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146-165, http://www.busim.ee.boun.edu.tr/~sankur/SankurFolder/Threshold_survey.pdf |
[R209] | ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold |
Examples
>>> from skimage.data import camera
>>> image = camera()
>>> thresh = threshold_yen(image)
>>> binary = image <= thresh
skimage.filters.
vprewitt
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.prewitt_v
instead.
Find the vertical edges of an image using the Prewitt transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
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
skimage.filters.
vscharr
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.scharr_v
instead.
Find the vertical edges of an image using the Scharr transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
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
[R210] | D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives. |
skimage.filters.
vsobel
(*args, **kwargs)[source]¶Deprecated function. Use skimage.filters.sobel_v
instead.
Find the vertical edges of an image using the Sobel transform.
Parameters: | image : 2-D array
mask : 2-D array, optional
|
---|---|
Returns: | output : 2-D array
|
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
skimage.filters.
wiener
(data, impulse_response=None, filter_params={}, K=0.25, predefined_filter=None)[source]¶Minimum Mean Square Error (Wiener) inverse filter.
Parameters: | data : (M,N) ndarray
K : float or (M,N) ndarray
impulse_response : callable f(r, c, **filter_params)
filter_params : dict
|
---|---|
Other Parameters: | |
predefined_filter : LPIFilter2D
|
LPIFilter2D
¶skimage.filters.
LPIFilter2D
(impulse_response, **filter_params)[source]¶Bases: object
Linear Position-Invariant Filter (2-dimensional)
__init__
(impulse_response, **filter_params)[source]¶Parameters: | impulse_response : callable f(r, c, **filter_params)
|
---|
Examples
Gaussian filter: Use a 1-D gaussian in each direction without normalization coefficients.
>>> def filt_func(r, c, sigma = 1):
... return np.exp(-np.hypot(r, c)/sigma)
>>> filter = LPIFilter2D(filt_func)
deprecated
¶skimage.filters.
deprecated
(alt_func=None, behavior='warn')[source]¶Bases: object
Decorator to mark deprecated functions with warning.
Adapted from <http://wiki.python.org/moin/PythonDecoratorLibrary>.
Parameters: | alt_func : str
behavior : {‘warn’, ‘raise’}
|
---|