filters
¶skimage.filters.inverse (data[, …]) 
Apply the filter in reverse to the given data. 
skimage.filters.wiener (data[, …]) 
Minimum Mean Square Error (Wiener) inverse filter. 
skimage.filters.gaussian (image[, sigma, …]) 
Multidimensional Gaussian filter. 
skimage.filters.median (image[, selem, out, …]) 
Return local median of an image. 
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.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.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.roberts (image[, mask]) 
Find the edge magnitude using Roberts’ cross operator. 
skimage.filters.roberts_pos_diag (image[, mask]) 
Find the cross edges of an image 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.laplace (image[, ksize, mask]) 
Find the edges of an image using the Laplace operator. 
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 rankorder value. 
skimage.filters.gabor_kernel (frequency[, …]) 
Return complex 2D Gabor filter kernel. 
skimage.filters.gabor (image, frequency[, …]) 
Return real and imaginary responses to Gabor filter. 
skimage.filters.try_all_threshold (image[, …]) 
Returns a figure comparing the outputs of different thresholding methods. 
skimage.filters.meijering (image[, sigmas, …]) 
Filter an image with the Meijering neuriteness filter. 
skimage.filters.sato (image[, sigmas, …]) 
Filter an image with the Sato tubeness filter. 
skimage.filters.frangi (image[, sigmas, …]) 
Filter an image with the Frangi vesselness filter. 
skimage.filters.hessian (image[, sigmas, …]) 
Filter an image with the Hybrid Hessian filter. 
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.threshold_isodata (image[, …]) 
Return threshold value(s) based on ISODATA method. 
skimage.filters.threshold_li (image, *[, …]) 
Compute threshold value by Li’s iterative Minimum Cross Entropy method. 
skimage.filters.threshold_local (image, …) 
Compute a threshold mask image based on local pixel neighborhood. 
skimage.filters.threshold_minimum (image[, …]) 
Return threshold value based on minimum method. 
skimage.filters.threshold_mean (image) 
Return threshold value based on the mean of grayscale values. 
skimage.filters.threshold_niblack (image[, …]) 
Applies Niblack local threshold to an array. 
skimage.filters.threshold_sauvola (image[, …]) 
Applies Sauvola local threshold to an array. 
skimage.filters.threshold_triangle (image[, …]) 
Return threshold value based on the triangle algorithm. 
skimage.filters.apply_hysteresis_threshold (…) 
Apply hysteresis thresholding to image. 
skimage.filters.unsharp_mask (image[, …]) 
Unsharp masking filter. 
skimage.filters.LPIFilter2D (…) 
Linear PositionInvariant Filter (2dimensional) 
skimage.filters.rank 
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: 


Other Parameters:  

skimage.filters.
wiener
(data, impulse_response=None, filter_params={}, K=0.25, predefined_filter=None)[source]¶Minimum Mean Square Error (Wiener) inverse filter.
Parameters: 


Other Parameters:  

skimage.filters.
gaussian
(image, sigma=1, output=None, mode='nearest', cval=0, multichannel=None, preserve_range=False, truncate=4.0)[source]¶Multidimensional Gaussian filter.
Parameters: 


Returns: 

Notes
This function is a wrapper around scipy.ndi.gaussian_filter()
.
Integer arrays are converted to float.
The multidimensional filter is implemented as a sequence of onedimensional 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 smoothing
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
¶skimage.filters.
median
(image, selem=None, out=None, mask=None, shift_x=False, shift_y=False, mode='nearest', cval=0.0, behavior='rank')[source]¶Return local median of an image.
Parameters: 


Returns: 

See also
skimage.filters.rank.median
Examples
>>> from skimage import data
>>> from skimage.morphology import disk
>>> from skimage.filters import median
>>> img = data.camera()
>>> med = median(img, disk(5))
skimage.filters.
sobel
(image, mask=None)[source]¶Find the edge magnitude using the Sobel transform.
Parameters: 


Returns: 

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 rotationinvariant. 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: 


Returns: 

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: 


Returns: 

Notes
We use the following kernel:
1 0 1
2 0 2
1 0 1
skimage.filters.
scharr
(image, mask=None)[source]¶Find the edge magnitude using the Scharr transform.
Parameters: 


Returns: 

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
[1]  D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives. 
[2]  https://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
¶skimage.filters.
scharr_h
(image, mask=None)[source]¶Find the horizontal edges of an image using the Scharr transform.
Parameters: 


Returns: 

Notes
We use the following kernel:
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. 
skimage.filters.
scharr_v
(image, mask=None)[source]¶Find the vertical edges of an image using the Scharr transform.
Parameters: 


Returns: 

Notes
We use the following kernel:
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. 
skimage.filters.
prewitt
(image, mask=None)[source]¶Find the edge magnitude using the Prewitt transform.
Parameters: 


Returns: 

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
¶skimage.filters.
prewitt_h
(image, mask=None)[source]¶Find the horizontal edges of an image using the Prewitt transform.
Parameters: 


Returns: 

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: 


Returns: 

Notes
We use the following kernel:
1 0 1
1 0 1
1 0 1
skimage.filters.
roberts
(image, mask=None)[source]¶Find the edge magnitude using Roberts’ cross operator.
Parameters: 


Returns: 

Examples
>>> from skimage import data
>>> camera = data.camera()
>>> from skimage import filters
>>> edges = filters.roberts(camera)
skimage.filters.roberts
¶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: 


Returns: 

Notes
We use the following kernel:
1 0
0 1
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: 


Returns: 

Notes
We use the following kernel:
0 1
1 0
skimage.filters.
laplace
(image, ksize=3, mask=None)[source]¶Find the edges of an image using the Laplace operator.
Parameters: 


Returns: 

Notes
The Laplacian operator is generated using the function skimage.restoration.uft.laplacian().
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 rankorder value.
Parameters: 


Returns: 

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.
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: 


Returns: 

References
[1]  https://en.wikipedia.org/wiki/Gabor_filter 
[2]  https://web.archive.org/web/20180127125930/http://mplab.ucsd.edu/tutorials/gabor.pdf 
Examples
>>> from skimage.filters import gabor_kernel
>>> from skimage import io
>>> from matplotlib import pyplot as plt # doctest: +SKIP
>>> gk = gabor_kernel(frequency=0.2)
>>> plt.figure() # doctest: +SKIP
>>> io.imshow(gk.real) # doctest: +SKIP
>>> io.show() # doctest: +SKIP
>>> # more ripples (equivalent to increasing the size of the
>>> # Gaussian spread)
>>> gk = gabor_kernel(frequency=0.2, bandwidth=0.1)
>>> plt.figure() # doctest: +SKIP
>>> io.imshow(gk.real) # doctest: +SKIP
>>> io.show() # doctest: +SKIP
skimage.filters.gabor_kernel
¶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: 


Returns: 

References
[1]  https://en.wikipedia.org/wiki/Gabor_filter 
[2]  https://web.archive.org/web/20180127125930/http://mplab.ucsd.edu/tutorials/gabor.pdf 
Examples
>>> from skimage.filters import gabor
>>> from skimage import data, io
>>> from matplotlib import pyplot as plt # doctest: +SKIP
>>> image = data.coins()
>>> # detecting edges in a coin image
>>> filt_real, filt_imag = gabor(image, frequency=0.6)
>>> plt.figure() # doctest: +SKIP
>>> io.imshow(filt_real) # doctest: +SKIP
>>> io.show() # doctest: +SKIP
>>> # less sensitivity to finer details with the lower frequency kernel
>>> filt_real, filt_imag = gabor(image, frequency=0.1)
>>> plt.figure() # doctest: +SKIP
>>> io.imshow(filt_real) # doctest: +SKIP
>>> io.show() # doctest: +SKIP
skimage.filters.
try_all_threshold
(image, figsize=(8, 5), verbose=True)[source]¶Returns a figure comparing the outputs of different thresholding methods.
Parameters: 


Returns: 

Notes
The following algorithms are used:
Examples
>>> from skimage.data import text
>>> fig, ax = try_all_threshold(text(), figsize=(10, 6), verbose=False)
skimage.filters.
meijering
(image, sigmas=range(1, 10, 2), alpha=None, black_ridges=True)[source]¶Filter an image with the Meijering neuriteness filter.
This filter can be used to detect continuous ridges, e.g. neurites, wrinkles, rivers. It can be used to calculate the fraction of the whole image containing such objects.
Calculates the eigenvectors of the Hessian to compute the similarity of an image region to neurites, according to the method described in [1].
Parameters: 


Returns: 

References
[1]  (1, 2) Meijering, E., Jacob, M., Sarria, J. C., Steiner, P., Hirling, H., Unser, M. (2004). Design and validation of a tool for neurite tracing and analysis in fluorescence microscopy images. Cytometry Part A, 58(2), 167176. DOI:10.1002/cyto.a.20022 
skimage.filters.meijering
¶skimage.filters.
sato
(image, sigmas=range(1, 10, 2), black_ridges=True)[source]¶Filter an image with the Sato tubeness filter.
This filter can be used to detect continuous ridges, e.g. tubes, wrinkles, rivers. It can be used to calculate the fraction of the whole image containing such objects.
Defined only for 2D and 3D images. Calculates the eigenvectors of the Hessian to compute the similarity of an image region to tubes, according to the method described in [1].
Parameters: 


Returns: 

References
[1]  (1, 2) Sato, Y., Nakajima, S., Shiraga, N., Atsumi, H., Yoshida, S., Koller, T., …, Kikinis, R. (1998). Threedimensional multiscale line filter for segmentation and visualization of curvilinear structures in medical images. Medical image analysis, 2(2), 143168. DOI:10.1016/S13618415(98)800091 
skimage.filters.sato
¶skimage.filters.
frangi
(image, sigmas=range(1, 10, 2), scale_range=None, scale_step=None, beta1=None, beta2=None, alpha=0.5, beta=0.5, gamma=15, black_ridges=True)[source]¶Filter an image with the Frangi vesselness filter.
This filter can be used to detect continuous ridges, e.g. vessels, wrinkles, rivers. It can be used to calculate the fraction of the whole image containing such objects.
Defined only for 2D and 3D images. Calculates the eigenvectors of the Hessian to compute the similarity of an image region to vessels, according to the method described in [1].
Parameters: 


Returns: 

Notes
Written by Marc Schrijver, November 2001 ReWritten by D. J. Kroon, University of Twente, May 2009, [2] Adoption of 3D version from D. G. Ellis, Januar 20017, [3]
References
[1]  (1, 2) Frangi, A. F., Niessen, W. J., Vincken, K. L., & Viergever, M. A. (1998,). Multiscale vessel enhancement filtering. In International Conference on Medical Image Computing and ComputerAssisted Intervention (pp. 130137). Springer Berlin Heidelberg. DOI:10.1007/BFb0056195 
[2]  (1, 2) Kroon, D. J.: Hessian based Frangi vesselness filter. 
[3]  (1, 2) Ellis, D. G.: https://github.com/ellisdg/frangi3d/tree/master/frangi 
skimage.filters.frangi
¶skimage.filters.
hessian
(image, sigmas=range(1, 10, 2), scale_range=None, scale_step=None, beta1=None, beta2=None, alpha=0.5, beta=0.5, gamma=15, black_ridges=True)[source]¶Filter an image with the Hybrid Hessian filter.
This filter can be used to detect continuous edges, e.g. vessels, wrinkles, rivers. It can be used to calculate the fraction of the whole image containing such objects.
Defined only for 2D and 3D images. Almost equal to Frangi filter, but uses alternative method of smoothing. Refer to [1] to find the differences between Frangi and Hessian filters.
Parameters: 


Returns: 

Notes
Written by Marc Schrijver (November 2001) ReWritten by D. J. Kroon University of Twente (May 2009) [2]
References
[1]  (1, 2) Ng, C. C., Yap, M. H., Costen, N., & Li, B. (2014,). Automatic wrinkle detection using hybrid Hessian filter. In Asian Conference on Computer Vision (pp. 609622). Springer International Publishing. DOI:10.1007/9783319168111_40 
[2]  (1, 2) Kroon, D. J.: Hessian based Frangi vesselness filter. 
skimage.filters.hessian
¶skimage.filters.
threshold_otsu
(image, nbins=256)[source]¶Return threshold value based on Otsu’s method.
Parameters: 


Returns: 

Raises: 

Notes
The input image must be grayscale.
References
[1]  Wikipedia, https://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: 


Returns: 

References
[1]  Yen J.C., Chang F.J., and Chang S. (1995) “A New Criterion for Automatic Multilevel Thresholding” IEEE Trans. on Image Processing, 4(3): 370378. DOI:10.1109/83.366472 
[2]  Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146165, DOI:10.1117/1.1631315 http://www.busim.ee.boun.edu.tr/~sankur/SankurFolder/Threshold_survey.pdf 
[3]  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.
threshold_isodata
(image, nbins=256, return_all=False)[source]¶Return threshold value(s) based on ISODATA method.
Histogrambased threshold, known as RidlerCalvard method or intermeans. Threshold values returned satisfy the following equality:
threshold = (image[image <= threshold].mean() +
image[image > threshold].mean()) / 2.0
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 binwidth.
Parameters: 


Returns: 

References
[1]  Ridler, TW & Calvard, S (1978), “Picture thresholding using an iterative selection method” IEEE Transactions on Systems, Man and Cybernetics 8: 630632, DOI:10.1109/TSMC.1978.4310039 
[2]  Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146165, http://www.busim.ee.boun.edu.tr/~sankur/SankurFolder/Threshold_survey.pdf DOI:10.1117/1.1631315 
[3]  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, *, tolerance=None)[source]¶Compute threshold value by Li’s iterative Minimum Cross Entropy method.
Parameters: 


Returns: 

References
[1]  Li C.H. and Lee C.K. (1993) “Minimum Cross Entropy Thresholding” Pattern Recognition, 26(4): 617625 DOI:10.1016/00313203(93)90115D 
[2]  Li C.H. and Tam P.K.S. (1998) “An Iterative Algorithm for Minimum Cross Entropy Thresholding” Pattern Recognition Letters, 18(8): 771776 DOI:10.1016/S01678655(98)000579 
[3]  Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146165 DOI:10.1117/1.1631315 
[4]  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_local
(image, block_size, method='gaussian', offset=0, mode='reflect', param=None, cval=0)[source]¶Compute a threshold mask image based on local pixel neighborhood.
Also known as adaptive or dynamic thresholding. 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 given function, using the ‘generic’ method.
Parameters: 


Returns: 

References
[1]  https://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=threshold#adaptivethreshold 
Examples
>>> from skimage.data import camera
>>> image = camera()[:50, :50]
>>> binary_image1 = image > threshold_local(image, 15, 'mean')
>>> func = lambda arr: arr.mean()
>>> binary_image2 = image > threshold_local(image, 15, 'generic',
... param=func)
skimage.filters.threshold_local
¶skimage.filters.
threshold_minimum
(image, nbins=256, max_iter=10000)[source]¶Return threshold value based on minimum method.
The histogram of the input image is computed and smoothed until there are only two maxima. Then the minimum in between is the threshold value.
Parameters: 


Returns: 

Raises: 

References
[1]  C. A. Glasbey, “An analysis of histogrambased thresholding algorithms,” CVGIP: Graphical Models and Image Processing, vol. 55, pp. 532537, 1993. 
[2]  Prewitt, JMS & Mendelsohn, ML (1966), “The analysis of cell images”, Annals of the New York Academy of Sciences 128: 10351053 DOI:10.1111/j.17496632.1965.tb11715.x 
Examples
>>> from skimage.data import camera
>>> image = camera()
>>> thresh = threshold_minimum(image)
>>> binary = image > thresh
skimage.filters.threshold_minimum
¶skimage.filters.
threshold_mean
(image)[source]¶Return threshold value based on the mean of grayscale values.
Parameters: 


Returns: 

References
[1]  C. A. Glasbey, “An analysis of histogrambased thresholding algorithms,” CVGIP: Graphical Models and Image Processing, vol. 55, pp. 532537, 1993. DOI:10.1006/cgip.1993.1040 
Examples
>>> from skimage.data import camera
>>> image = camera()
>>> thresh = threshold_mean(image)
>>> binary = image > thresh
skimage.filters.threshold_mean
¶skimage.filters.
threshold_niblack
(image, window_size=15, k=0.2)[source]¶Applies Niblack local threshold to an array.
A threshold T is calculated for every pixel in the image using the following formula:
T = m(x,y)  k * s(x,y)
where m(x,y) and s(x,y) are the mean and standard deviation of pixel (x,y) neighborhood defined by a rectangular window with size w times w centered around the pixel. k is a configurable parameter that weights the effect of standard deviation.
Parameters: 


Returns: 

Notes
This algorithm is originally designed for text recognition.
References
[1]  Niblack, W (1986), An introduction to Digital Image Processing, PrenticeHall. 
Examples
>>> from skimage import data
>>> image = data.page()
>>> binary_image = threshold_niblack(image, window_size=7, k=0.1)
skimage.filters.threshold_niblack
¶skimage.filters.
threshold_sauvola
(image, window_size=15, k=0.2, r=None)[source]¶Applies Sauvola local threshold to an array. Sauvola is a modification of Niblack technique.
In the original method a threshold T is calculated for every pixel in the image using the following formula:
T = m(x,y) * (1 + k * ((s(x,y) / R)  1))
where m(x,y) and s(x,y) are the mean and standard deviation of pixel (x,y) neighborhood defined by a rectangular window with size w times w centered around the pixel. k is a configurable parameter that weights the effect of standard deviation. R is the maximum standard deviation of a greyscale image.
Parameters: 


Returns: 

Notes
This algorithm is originally designed for text recognition.
References
[1]  J. Sauvola and M. Pietikainen, “Adaptive document image binarization,” Pattern Recognition 33(2), pp. 225236, 2000. DOI:10.1016/S00313203(99)000552 
Examples
>>> from skimage import data
>>> image = data.page()
>>> t_sauvola = threshold_sauvola(image, window_size=15, k=0.2)
>>> binary_image = image > t_sauvola
skimage.filters.threshold_sauvola
¶skimage.filters.
threshold_triangle
(image, nbins=256)[source]¶Return threshold value based on the triangle algorithm.
Parameters: 


Returns: 

References
[1]  Zack, G. W., Rogers, W. E. and Latt, S. A., 1977, Automatic Measurement of Sister Chromatid Exchange Frequency, Journal of Histochemistry and Cytochemistry 25 (7), pp. 741753 DOI:10.1177/25.7.70454 
[2]  ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold 
Examples
>>> from skimage.data import camera
>>> image = camera()
>>> thresh = threshold_triangle(image)
>>> binary = image > thresh
skimage.filters.
apply_hysteresis_threshold
(image, low, high)[source]¶Apply hysteresis thresholding to image.
This algorithm finds regions where image is greater than high OR image is greater than low and that region is connected to a region greater than high.
Parameters: 


Returns: 

References
[1]  J. Canny. A computational approach to edge detection. IEEE Transactions on Pattern Analysis and Machine Intelligence. 1986; vol. 8, pp.679698. DOI:10.1109/TPAMI.1986.4767851 
Examples
>>> image = np.array([1, 2, 3, 2, 1, 2, 1, 3, 2])
>>> apply_hysteresis_threshold(image, 1.5, 2.5).astype(int)
array([0, 1, 1, 1, 0, 0, 0, 1, 1])
skimage.filters.apply_hysteresis_threshold
¶skimage.filters.
unsharp_mask
(image, radius=1.0, amount=1.0, multichannel=False, preserve_range=False)[source]¶Unsharp masking filter.
The sharp details are identified as the difference between the original image and its blurred version. These details are then scaled, and added back to the original image.
Parameters: 


Returns: 

Notes
Unsharp masking is an image sharpening technique. It is a linear image operation, and numerically stable, unlike deconvolution which is an illposed problem. Because of this stability, it is often preferred over deconvolution.
The main idea is as follows: sharp details are identified as the difference between the original image and its blurred version. These details are added back to the original image after a scaling step:
enhanced image = original + amount * (original  blurred)
When applying this filter to several color layers independently, color bleeding may occur. More visually pleasing result can be achieved by processing only the brightness/lightness/intensity channel in a suitable color space such as HSV, HSL, YUV, or YCbCr.
Unsharp masking is described in most introductory digital image processing books. This implementation is based on [1].
References
[1]  (1, 2) Maria Petrou, Costas Petrou “Image Processing: The Fundamentals”, (2010), ed ii., page 357, ISBN 13: 9781119994398 DOI:10.1002/9781119994398 
[2]  Wikipedia. Unsharp masking https://en.wikipedia.org/wiki/Unsharp_masking 
Examples
>>> array = np.ones(shape=(5,5), dtype=np.uint8)*100
>>> array[2,2] = 120
>>> array
array([[100, 100, 100, 100, 100],
[100, 100, 100, 100, 100],
[100, 100, 120, 100, 100],
[100, 100, 100, 100, 100],
[100, 100, 100, 100, 100]], dtype=uint8)
>>> np.around(unsharp_mask(array, radius=0.5, amount=2),2)
array([[ 0.39, 0.39, 0.39, 0.39, 0.39],
[ 0.39, 0.39, 0.38, 0.39, 0.39],
[ 0.39, 0.38, 0.53, 0.38, 0.39],
[ 0.39, 0.39, 0.38, 0.39, 0.39],
[ 0.39, 0.39, 0.39, 0.39, 0.39]])
>>> array = np.ones(shape=(5,5), dtype=np.int8)*100
>>> array[2,2] = 127
>>> np.around(unsharp_mask(array, radius=0.5, amount=2),2)
array([[ 0.79, 0.79, 0.79, 0.79, 0.79],
[ 0.79, 0.78, 0.75, 0.78, 0.79],
[ 0.79, 0.75, 1. , 0.75, 0.79],
[ 0.79, 0.78, 0.75, 0.78, 0.79],
[ 0.79, 0.79, 0.79, 0.79, 0.79]])
>>> np.around(unsharp_mask(array, radius=0.5, amount=2, preserve_range=True), 2)
array([[ 100. , 100. , 99.99, 100. , 100. ],
[ 100. , 99.39, 95.48, 99.39, 100. ],
[ 99.99, 95.48, 147.59, 95.48, 99.99],
[ 100. , 99.39, 95.48, 99.39, 100. ],
[ 100. , 100. , 99.99, 100. , 100. ]])
skimage.filters.unsharp_mask
¶LPIFilter2D
¶skimage.filters.
LPIFilter2D
(impulse_response, **filter_params)[source]¶Bases: object
Linear PositionInvariant Filter (2dimensional)
__init__
(impulse_response, **filter_params)[source]¶Parameters: 


Examples
Gaussian filter: Use a 1D 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)