Bases: skimage.feature.util.FeatureDetector, skimage.feature.util.DescriptorExtractor
Oriented FAST and rotated BRIEF feature detector and binary descriptor extractor.
Number of keypoints to be returned. The function will return the best n_keypoints according to the Harris corner response if more than n_keypoints are detected. If not, then all the detected keypoints are returned.
The n parameter in skimage.feature.corner_fast. Minimum number of consecutive pixels out of 16 pixels on the circle that should all be either brighter or darker w.r.t test-pixel. A point c on the circle is darker w.r.t test pixel p if Ic < Ip - threshold and brighter if Ic > Ip + threshold. Also stands for the n in FAST-n corner detector.
The threshold parameter in feature.corner_fast. Threshold used to decide whether the pixels on the circle are brighter, darker or similar w.r.t. the test pixel. Decrease the threshold when more corners are desired and vice-versa.
The k parameter in skimage.feature.corner_harris. Sensitivity factor to separate corners from edges, typically in range [0, 0.2]. Small values of k result in detection of sharp corners.
Downscale factor for the image pyramid. Default value 1.2 is chosen so that there are more dense scales which enable robust scale invariance for a subsequent feature description.
Maximum number of scales from the bottom of the image pyramid to extract the features from.
Ethan Rublee, Vincent Rabaud, Kurt Konolige and Gary Bradski “ORB: An efficient alternative to SIFT and SURF” http://www.vision.cs.chubu.ac.jp/CV-R/pdf/Rublee_iccv2011.pdf
Keypoint coordinates as (row, col).
Corresponding scales.
Corresponding orientations in radians.
Corresponding Harris corner responses.
2D array of binary descriptors of size descriptor_size for Q keypoints after filtering out border keypoints with value at an index (i, j) either being True or False representing the outcome of the intensity comparison for i-th keypoint on j-th decision pixel-pair. It is Q == np.sum(mask).
Initialize self. See help(type(self)) for accurate signature.
Detect oriented FAST keypoints along with the corresponding scale.
Input image.
Detect oriented FAST keypoints and extract rBRIEF descriptors.
Note that this is faster than first calling detect and then extract.
Input image.
Extract rBRIEF binary descriptors for given keypoints in image.
Note that the keypoints must be extracted using the same downscale and n_scales parameters. Additionally, if you want to extract both keypoints and descriptors you should use the faster detect_and_extract.
Input image.
Keypoint coordinates as (row, col).
Corresponding scales.
Corresponding orientations in radians.


Detect oriented FAST keypoints along with the corresponding scale.
Input image.


Detect oriented FAST keypoints and extract rBRIEF descriptors.
Note that this is faster than first calling detect and then extract.
Input image.


Extract rBRIEF binary descriptors for given keypoints in image.
Note that the keypoints must be extracted using the same downscale and n_scales parameters. Additionally, if you want to extract both keypoints and descriptors you should use the faster detect_and_extract.
Input image.
Keypoint coordinates as (row, col).
Corresponding scales.
Corresponding orientations in radians.


Initialize self. See help(type(self)) for accurate signature.


Find peaks in an image as coordinate list or boolean mask.
Peaks are the local maxima in a region of 2 * min_distance + 1 (i.e. peaks are separated by at least min_distance).
If both threshold_abs and threshold_rel are provided, the maximum of the two is chosen as the minimum intensity threshold of peaks.
Changed in version 0.18: Prior to version 0.18, peaks of the same height within a radius of min_distance were all returned, but this could cause unexpected behaviour. From 0.18 onwards, an arbitrary peak within the region is returned. See issue gh-2592.
Input image.
The minimal allowed distance separating peaks. To find the maximum number of peaks, use min_distance=1.
Minimum intensity of peaks. By default, the absolute threshold is the minimum intensity of the image.
Minimum intensity of peaks, calculated as max(image) * threshold_rel.
If positive integer, exclude_border excludes peaks from within exclude_border-pixels of the border of the image. If tuple of non-negative ints, the length of the tuple must match the input array’s dimensionality. Each element of the tuple will exclude peaks from within exclude_border-pixels of the border of the image along that dimension. If True, takes the min_distance parameter as value. If zero or False, peaks are identified regardless of their distance from the border.
If True, the output will be an array representing peak coordinates. The coordinates are sorted according to peaks values (Larger first). If False, the output will be a boolean array shaped as image.shape with peaks present at True elements. indices is deprecated and will be removed in version 0.20. Default behavior will be to always return peak coordinates. You can obtain a mask as shown in the example below.
Maximum number of peaks. When the number of peaks exceeds num_peaks, return num_peaks peaks based on highest peak intensity.
If provided, footprint == 1 represents the local region within which to search for peaks at every point in image.
If provided, each unique region labels == value represents a unique region to search for peaks. Zero is reserved for background.
Maximum number of peaks for each label.
Which Minkowski p-norm to use. Should be in the range [1, inf]. A finite large p may cause a ValueError if overflow can occur. inf corresponds to the Chebyshev distance and 2 to the Euclidean distance.
See also
The peak local maximum function returns the coordinates of local peaks (maxima) in an image. Internally, a maximum filter is used for finding local maxima. This operation dilates the original image. After comparison of the dilated and original image, this function returns the coordinates or a mask of the peaks where the dilated image equals the original image.


Plot matched features.
Matches and image are drawn in this ax.
First grayscale or color image.
Second grayscale or color image.
First keypoint coordinates as (row, col).
Second keypoint coordinates as (row, col).
Indices of corresponding matches in first and second set of descriptors, where matches[:, 0] denote the indices in the first and matches[:, 1] the indices in the second set of descriptors.
Color for keypoint locations.
Color for lines which connect keypoint matches. By default the color is chosen randomly.
Whether to only plot matches and not plot the keypoint locations.
Whether to show images side by side, 'horizontal', or one above the other, 'vertical'.


Deprecated function. Use skimage.registration.phase_cross_correlation instead.


Compute the shape index.
The shape index, as defined by Koenderink & van Doorn [1], is a single valued measure of local curvature, assuming the image as a 3D plane with intensities representing heights.
It is derived from the eigen values of the Hessian, and its value ranges from -1 to 1 (and is undefined (=NaN) in flat regions), with following ranges representing following shapes:
Interval (s in …)
Shape
[ -1, -7/8)
Spherical cup
[-7/8, -5/8)
Through
[-5/8, -3/8)
Rut
[-3/8, -1/8)
Saddle rut
[-1/8, +1/8)
Saddle
[+1/8, +3/8)
Saddle ridge
[+3/8, +5/8)
Ridge
[+5/8, +7/8)
Dome
[+7/8, +1]
Spherical cap
Input image.
Standard deviation used for the Gaussian kernel, which is used for smoothing the input data before Hessian eigen value calculation.
How to handle values outside the image borders
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Shape index
Koenderink, J. J. & van Doorn, A. J., “Surface shape and curvature scales”, Image and Vision Computing, 1992, 10, 557-564. DOI:10.1016/0262-8856(92)90076-F


Compute structure tensor using sum of squared differences.
The (2-dimensional) structure tensor A is defined as:
which is approximated by the weighted sum of squared differences in a local window around each pixel in the image. This formula can be extended to a larger number of dimensions (see [1]).
Input image.
Standard deviation used for the Gaussian kernel, which is used as a weighting function for the local summation of squared differences.
How to handle values outside the image borders.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
NOTE: Only applies in 2D. Higher dimensions must always use ‘rc’ order. This parameter allows for the use of reverse or forward order of the image axes in gradient computation. ‘rc’ indicates the use of the first axis initially (Arr, Arc, Acc), whilst ‘xy’ indicates the usage of the last axis initially (Axx, Axy, Ayy).
Upper-diagonal elements of the structure tensor for each pixel in the input image.
See also
https://en.wikipedia.org/wiki/Structure_tensor


Compute eigenvalues of structure tensor.
The upper-diagonal elements of the structure tensor, as returned by structure_tensor.
The eigenvalues of the structure tensor, in decreasing order. The eigenvalues are the leading dimension. That is, the coordinate [i, j, k] corresponds to the ith-largest eigenvalue at position (j, k).
See also


Compute eigenvalues of structure tensor.
Element of the structure tensor for each pixel in the input image.
Element of the structure tensor for each pixel in the input image.
Element of the structure tensor for each pixel in the input image.
Larger eigen value for each input matrix.
Smaller eigen value for each input matrix.


skimage.filters.apply_hysteresis_threshold(…)
Apply hysteresis thresholding to image.
skimage.filters.correlate_sparse(image, kernel)
Compute valid cross-correlation of padded_array and kernel.
skimage.filters.difference_of_gaussians(…)
Find features between low_sigma and high_sigma in size.
skimage.filters.farid(image, *[, mask])
Find the edge magnitude using the Farid transform.
skimage.filters.farid_h(image, *[, mask])
Find the horizontal edges of an image using the Farid transform.
skimage.filters.farid_v(image, *[, mask])
Find the vertical edges of an image using the Farid transform.
skimage.filters.frangi(image[, sigmas, …])
Filter an image with the Frangi vesselness filter.
skimage.filters.gabor(image, frequency[, …])
Return real and imaginary responses to Gabor filter.
skimage.filters.gabor_kernel(frequency[, …])
Return complex 2D Gabor filter kernel.
skimage.filters.gaussian(image[, sigma, …])
Multi-dimensional Gaussian filter.
skimage.filters.hessian(image[, sigmas, …])
Filter an image with the Hybrid Hessian filter.
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.meijering(image[, sigmas, …])
Filter an image with the Meijering neuriteness filter.
skimage.filters.prewitt(image[, mask, axis, …])
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_pos_diag(image[, mask])
Find the cross edges of an image using Roberts’ cross operator.
skimage.filters.sato(image[, sigmas, …])
Filter an image with the Sato tubeness filter.
skimage.filters.scharr(image[, mask, axis, …])
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, axis, …])
Find edges in an image using the Sobel filter.
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_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_mean(image)
Return threshold value based on the mean of grayscale values.
skimage.filters.threshold_minimum([image, …])
Return threshold value based on minimum method.
skimage.filters.threshold_multiotsu(image[, …])
Generate classes-1 threshold values to divide gray levels in image.
skimage.filters.threshold_niblack(image[, …])
Applies Niblack local threshold to an array.
skimage.filters.threshold_otsu([image, …])
Return threshold value based on Otsu’s method.
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.threshold_yen([image, …])
Return threshold value based on Yen’s method.
skimage.filters.try_all_threshold(image[, …])
Returns a figure comparing the outputs of different thresholding methods.
skimage.filters.unsharp_mask(image[, …])
Unsharp masking filter.
skimage.filters.wiener(data[, …])
Minimum Mean Square Error (Wiener) inverse filter.
skimage.filters.window(window_type, shape[, …])
Return an n-dimensional window of a given size and dimensionality.
skimage.filters.LPIFilter2D(…)
Linear Position-Invariant Filter (2-dimensional)
skimage.filters.rank
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.
Grayscale input image.
Lower threshold.
Higher threshold.
Array in which True indicates the locations where image was above the hysteresis threshold.
J. Canny. A computational approach to edge detection. IEEE Transactions on Pattern Analysis and Machine Intelligence. 1986; vol. 8, pp.679-698. DOI:10.1109/TPAMI.1986.4767851
Compute valid cross-correlation of padded_array and kernel.
This function is fast when kernel is large with many zeros.
See scipy.ndimage.correlate for a description of cross-correlation.
The input array. If mode is ‘valid’, this array should already be padded, as a margin of the same shape as kernel will be stripped off.
The kernel to be correlated. Must have the same number of dimensions as padded_array. For high performance, it should be sparse (few nonzero entries).
See scipy.ndimage.correlate for valid modes. Additionally, mode ‘valid’ is accepted, in which case no padding is applied and the result is the result for the smaller image for which the kernel is entirely inside the original data.
The result of cross-correlating image with kernel. If mode ‘valid’ is used, the resulting shape is (M-Q+1, N-R+1,[ …,] P-S+1).
Find features between low_sigma and high_sigma in size.
This function uses the Difference of Gaussians method for applying band-pass filters to multi-dimensional arrays. The input array is blurred with two Gaussian kernels of differing sigmas to produce two intermediate, filtered images. The more-blurred image is then subtracted from the less-blurred image. The final output image will therefore have had high-frequency components attenuated by the smaller-sigma Gaussian, and low frequency components will have been removed due to their presence in the more-blurred intermediate.
Input array to filter.
Standard deviation(s) for the Gaussian kernel with the smaller sigmas across all axes. The standard deviations are given for each axis as a sequence, or as a single number, in which case the single number is used as the standard deviation value for all axes.
Standard deviation(s) for the Gaussian kernel with the larger sigmas across all axes. The standard deviations are given for each axis as a sequence, or as a single number, in which case the single number is used as the standard deviation value for all axes. If None is given (default), sigmas for all axes are calculated as 1.6 * low_sigma.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘nearest’.
Value to fill past edges of input if mode is ‘constant’. Default is 0.0
Whether the last axis of the image is to be interpreted as multiple channels. If True, each channel is filtered separately (channels are not mixed together).
Truncate the filter at this many standard deviations.
the filtered array.
See also
This function will subtract an array filtered with a Gaussian kernel with sigmas given by high_sigma from an array filtered with a Gaussian kernel with sigmas provided by low_sigma. The values for high_sigma must always be greater than or equal to the corresponding values in low_sigma, or a ValueError will be raised.
When high_sigma is none, the values for high_sigma will be calculated as 1.6x the corresponding values in low_sigma. This ratio was originally proposed by Marr and Hildreth (1980) [1] and is commonly used when approximating the inverted Laplacian of Gaussian, which is used in edge and blob detection.
Input image is converted according to the conventions of img_as_float.
Except for sigma values, all parameters are used for both filters.
Marr, D. and Hildreth, E. Theory of Edge Detection. Proc. R. Soc. Lond. Series B 207, 187-217 (1980). https://doi.org/10.1098/rspb.1980.0020
Apply a simple Difference of Gaussians filter to a color image:
Apply a Laplacian of Gaussian filter as approximated by the Difference of Gaussians filter:
Apply a Difference of Gaussians filter to a grayscale image using different sigma values for each axis:
Find the edge magnitude using the Farid transform.
Image to process.
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.
The Farid edge map.
See also
Take the square root of the sum of the squares of the horizontal and vertical derivatives to get a magnitude that is somewhat insensitive to direction. Similar to the Scharr operator, this operator is designed with a rotation invariance constraint.
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
Wikipedia, “Farid and Simoncelli Derivatives.” Available at: <https://en.wikipedia.org/wiki/Image_derivatives#Farid_and_Simoncelli_Derivatives>
Find the horizontal edges of an image using the Farid transform.
Image to process.
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.
The Farid edge map.
The kernel was constructed using the 5-tap weights from [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
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.
Find the vertical edges of an image using the Farid transform.
Image to process.
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.
The Farid edge map.
The kernel was constructed using the 5-tap weights from [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
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 2-D and 3-D images. Calculates the eigenvectors of the Hessian to compute the similarity of an image region to vessels, according to the method described in [1].
Array with input image data.
Sigmas used as scales of filter, i.e., np.arange(scale_range[0], scale_range[1], scale_step)
The range of sigmas used.
Step size between sigmas.
Frangi correction constant that adjusts the filter’s sensitivity to deviation from a plate-like structure.
Frangi correction constant that adjusts the filter’s sensitivity to deviation from a blob-like structure.
Frangi correction constant that adjusts the filter’s sensitivity to areas of high variance/texture/structure.
When True (the default), the filter detects black ridges; when False, it detects white ridges.
How to handle values outside the image borders.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Filtered image (maximum of pixels across all scales).
See also
Written by Marc Schrijver, November 2001 Re-Written by D. J. Kroon, University of Twente, May 2009, [2] Adoption of 3D version from D. G. Ellis, Januar 20017, [3]
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 Computer-Assisted Intervention (pp. 130-137). Springer Berlin Heidelberg. DOI:10.1007/BFb0056195
Kroon, D. J.: Hessian based Frangi vesselness filter.
Ellis, D. G.: https://github.com/ellisdg/frangi3d/tree/master/frangi
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.
Input image.
Spatial frequency of the harmonic function. Specified in pixels.
Orientation in radians. If 0, the harmonic is in the x-direction.
The bandwidth captured by the filter. For fixed bandwidth, sigma_x and sigma_y will decrease with increasing frequency. This value is ignored if sigma_x and sigma_y are set by the user.
Standard deviation in x- and y-directions. These directions apply to the kernel before rotation. If theta = pi/2, then the kernel is rotated 90 degrees so that sigma_x controls the vertical direction.
The linear size of the kernel is n_stds (3 by default) standard deviations.
Phase offset of harmonic function in radians.
Mode used to convolve image with a kernel, passed to ndi.convolve
Value to fill past edges of input if mode of convolution is ‘constant’. The parameter is passed to ndi.convolve.
Filtered images using the real and imaginary parts of the Gabor filter kernel. Images are of the same dimensions as the input one.
https://en.wikipedia.org/wiki/Gabor_filter
https://web.archive.org/web/20180127125930/http://mplab.ucsd.edu/tutorials/gabor.pdf
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.
Spatial frequency of the harmonic function. Specified in pixels.
Orientation in radians. If 0, the harmonic is in the x-direction.
The bandwidth captured by the filter. For fixed bandwidth, sigma_x and sigma_y will decrease with increasing frequency. This value is ignored if sigma_x and sigma_y are set by the user.
Standard deviation in x- and y-directions. These directions apply to the kernel before rotation. If theta = pi/2, then the kernel is rotated 90 degrees so that sigma_x controls the vertical direction.
The linear size of the kernel is n_stds (3 by default) standard deviations
Phase offset of harmonic function in radians.
Complex filter kernel.
https://en.wikipedia.org/wiki/Gabor_filter
https://web.archive.org/web/20180127125930/http://mplab.ucsd.edu/tutorials/gabor.pdf
Multi-dimensional Gaussian filter.
Input image (grayscale or color) to filter.
Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes.
The output parameter passes an array in which to store the filter output.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘nearest’.
Value to fill past edges of input if mode is ‘constant’. Default is 0.0
Whether the last axis of the image is to be interpreted as multiple channels. If True, each channel is filtered separately (channels are not mixed together). Only 3 channels are supported. If None, the function will attempt to guess this, and raise a warning if ambiguous, when the array has shape (M, N, 3).
Whether to keep the original range of values. Otherwise, the input image is converted according to the conventions of img_as_float. Also see https://scikit-image.org/docs/dev/user_guide/data_types.html
Truncate the filter at this many standard deviations.
the filtered array
This function is a wrapper around scipy.ndi.gaussian_filter().
Integer arrays are converted to float.
The output should be floating point data type since gaussian converts to float provided image. If output is not provided, another array will be allocated and returned as the result.
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.
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 2-D and 3-D images. Almost equal to Frangi filter, but uses alternative method of smoothing. Refer to [1] to find the differences between Frangi and Hessian filters.
Array with input image data.
Sigmas used as scales of filter, i.e., np.arange(scale_range[0], scale_range[1], scale_step)
The range of sigmas used.
Step size between sigmas.
Frangi correction constant that adjusts the filter’s sensitivity to deviation from a blob-like structure.
Frangi correction constant that adjusts the filter’s sensitivity to areas of high variance/texture/structure.
When True (the default), the filter detects black ridges; when False, it detects white ridges.
How to handle values outside the image borders.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Filtered image (maximum of pixels across all scales).
See also
Written by Marc Schrijver (November 2001) Re-Written by D. J. Kroon University of Twente (May 2009) [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. 609-622). Springer International Publishing. DOI:10.1007/978-3-319-16811-1_40
Kroon, D. J.: Hessian based Frangi vesselness filter.
Apply the filter in reverse to the given data.
Input data.
Impulse response of the filter. See LPIFilter2D.__init__.
Additional keyword parameters to the impulse_response function.
Limit the filter gain. Often, the filter contains zeros, which would cause the inverse filter to have infinite gain. High gain causes amplification of artefacts, so a conservative limit is recommended.
If you need to apply the same filter multiple times over different images, construct the LPIFilter2D and specify it here.
Find the edges of an image using the Laplace operator.
Image to process.
Define the size of the discrete Laplacian operator such that it will have a size of (ksize,) * image.ndim.
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.
The Laplace edge map.
The Laplacian operator is generated using the function skimage.restoration.uft.laplacian().
Return local median of an image.
Input image.
If behavior=='rank', selem is a 2-D array of 1’s and 0’s. If behavior=='ndimage', selem is a N-D array of 1’s and 0’s with the same number of dimension than image. If None, selem will be a N-D array with 3 elements for each dimension (e.g., vector, square, cube, etc.)
If None, a new array is allocated.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘nearest’.
New in version 0.15: mode is used when behavior='ndimage'.
Value to fill past edges of input if mode is ‘constant’. Default is 0.0
New in version 0.15: cval was added in 0.15 is used when behavior='ndimage'.
Either to use the old behavior (i.e., < 0.15) or the new behavior. The old behavior will call the skimage.filters.rank.median(). The new behavior will call the scipy.ndimage.median_filter(). Default is ‘ndimage’.
New in version 0.15: behavior is introduced in 0.15
Changed in version 0.16: Default behavior has been changed from ‘rank’ to ‘ndimage’
Output image.
See also
Rank-based implementation of the median filtering offering more flexibility with additional parameters but dedicated for unsigned integer images.
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].
Array with input image data.
Sigmas used as scales of filter
Frangi correction constant that adjusts the filter’s sensitivity to deviation from a plate-like structure.
When True (the default), the filter detects black ridges; when False, it detects white ridges.
How to handle values outside the image borders.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Filtered image (maximum of pixels across all scales).
See also
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), 167-176. DOI:10.1002/cyto.a.20022
Find the edge magnitude using the Prewitt transform.
The input image.
Clip the output image to this mask. (Values where mask=0 will be set to 0.)
Compute the edge filter along this axis. If not provided, the edge magnitude is computed. This is defined as:
The magnitude is also computed if axis is a sequence.
The boundary mode for the convolution. See scipy.ndimage.convolve for a description of the modes. This can be either a single boundary mode or one boundary mode per axis.
When mode is 'constant', this is the constant used in values outside the boundary of the image data.
The Prewitt edge map.
See also
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.
Find the horizontal edges of an image using the Prewitt transform.
Image to process.
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.
The Prewitt edge map.
We use the following kernel:
Find the vertical edges of an image using the Prewitt transform.
Image to process.
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.
The Prewitt edge map.
We use the following kernel:
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.
New array where each pixel has the rank-order value of the corresponding pixel in image. Pixel values are between 0 and n - 1, where n is the number of distinct unique values in image.
Unique original values of image
Find the edge magnitude using Roberts’ cross operator.
Image to process.
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.
The Roberts’ Cross edge map.
See also
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.
Image to process.
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.
The Robert’s edge map.
We use the following kernel:
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.
Image to process.
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.
The Robert’s edge map.
We use the following kernel:
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 2-D and 3-D images. Calculates the eigenvectors of the Hessian to compute the similarity of an image region to tubes, according to the method described in [1].
Array with input image data.
Sigmas used as scales of filter.
When True (the default), the filter detects black ridges; when False, it detects white ridges.
How to handle values outside the image borders.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Filtered image (maximum of pixels across all scales).
See also
Sato, Y., Nakajima, S., Shiraga, N., Atsumi, H., Yoshida, S., Koller, T., …, Kikinis, R. (1998). Three-dimensional multi-scale line filter for segmentation and visualization of curvilinear structures in medical images. Medical image analysis, 2(2), 143-168. DOI:10.1016/S1361-8415(98)80009-1
Find the edge magnitude using the Scharr transform.
The input image.
Clip the output image to this mask. (Values where mask=0 will be set to 0.)
Compute the edge filter along this axis. If not provided, the edge magnitude is computed. This is defined as:
The magnitude is also computed if axis is a sequence.
The boundary mode for the convolution. See scipy.ndimage.convolve for a description of the modes. This can be either a single boundary mode or one boundary mode per axis.
When mode is 'constant', this is the constant used in values outside the boundary of the image data.
The Scharr edge map.
See also
The Scharr operator has a better rotation invariance than other edge filters such as the Sobel or the Prewitt operators.
D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives.
https://en.wikipedia.org/wiki/Sobel_operator#Alternative_operators
Find the horizontal edges of an image using the Scharr transform.
Image to process.
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.
The Scharr edge map.
We use the following kernel:
D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives.
Find the vertical edges of an image using the Scharr transform.
Image to process
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.
The Scharr edge map.
We use the following kernel:
D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives.
Find edges in an image using the Sobel filter.
The input image.
Clip the output image to this mask. (Values where mask=0 will be set to 0.)
Compute the edge filter along this axis. If not provided, the edge magnitude is computed. This is defined as:
The magnitude is also computed if axis is a sequence.
The boundary mode for the convolution. See scipy.ndimage.convolve for a description of the modes. This can be either a single boundary mode or one boundary mode per axis.
When mode is 'constant', this is the constant used in values outside the boundary of the image data.
The Sobel edge map.
See also
D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives.
https://en.wikipedia.org/wiki/Sobel_operator
Flood Fill
Find the horizontal edges of an image using the Sobel transform.
Image to process.
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.
The Sobel edge map.
We use the following kernel:
Find the vertical edges of an image using the Sobel transform.
Image to process.
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.
The Sobel edge map.
We use the following kernel:
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.
Either image or hist must be provided. In case hist is given, the actual histogram of the image is ignored.
Input image.
Number of bins used to calculate histogram. This value is ignored for integer arrays.
If False (default), return only the lowest threshold that satisfies the above equality. If True, return all valid thresholds.
Histogram to determine the threshold from and a corresponding array of bin center intensities. Alternatively, only the histogram can be passed.
Threshold value(s).
Ridler, TW & Calvard, S (1978), “Picture thresholding using an iterative selection method” IEEE Transactions on Systems, Man and Cybernetics 8: 630-632, DOI:10.1109/TSMC.1978.4310039
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 DOI:10.1117/1.1631315
ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold
Compute threshold value by Li’s iterative Minimum Cross Entropy method.
Input image.
Finish the computation when the change in the threshold in an iteration is less than this value. By default, this is half the smallest difference between intensity values in image.
Li’s iterative method uses gradient descent to find the optimal threshold. If the image intensity histogram contains more than two modes (peaks), the gradient descent could get stuck in a local optimum. An initial guess for the iteration can help the algorithm find the globally-optimal threshold. A float value defines a specific start point, while a callable should take in an array of image intensities and return a float value. Example valid callables include numpy.mean (default), lambda arr: numpy.quantile(arr, 0.95), or even skimage.filters.threshold_otsu().
A function that will be called on the threshold at every iteration of the algorithm.
Upper threshold value. All pixels with an intensity higher than this value are assumed to be foreground.
Li C.H. and Lee C.K. (1993) “Minimum Cross Entropy Thresholding” Pattern Recognition, 26(4): 617-625 DOI:10.1016/0031-3203(93)90115-D
Li C.H. and Tam P.K.S. (1998) “An Iterative Algorithm for Minimum Cross Entropy Thresholding” Pattern Recognition Letters, 18(8): 771-776 DOI:10.1016/S0167-8655(98)00057-9
Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146-165 DOI:10.1117/1.1631315
ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold
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.
Input image.
Odd size of pixel neighborhood which is used to calculate the threshold value (e.g. 3, 5, 7, …, 21, …).
Method used to determine adaptive threshold for local neighbourhood in weighted mean image.
By default the ‘gaussian’ method is used.
Constant subtracted from weighted mean of neighborhood to calculate the local threshold value. Default offset is 0.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘reflect’.
Either specify sigma for ‘gaussian’ method or function object for ‘generic’ method. This functions takes the flat array of local neighbourhood as a single argument and returns the calculated threshold for the centre pixel.
Value to fill past edges of input if mode is ‘constant’.
Threshold image. All pixels in the input image higher than the corresponding pixel in the threshold image are considered foreground.
https://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=threshold#adaptivethreshold
Return threshold value based on the mean of grayscale values.
Grayscale input image.
Upper threshold value. All pixels with an intensity higher than this value are assumed to be foreground.
C. A. Glasbey, “An analysis of histogram-based thresholding algorithms,” CVGIP: Graphical Models and Image Processing, vol. 55, pp. 532-537, 1993. DOI:10.1006/cgip.1993.1040
Return threshold value based on minimum method.
The histogram of the input image is computed if not provided and smoothed until there are only two maxima. Then the minimum in between is the threshold value.
Either image or hist must be provided. In case hist is given, the actual histogram of the image is ignored.
Input image.
Number of bins used to calculate histogram. This value is ignored for integer arrays.
Maximum number of iterations to smooth the histogram.
Histogram to determine the threshold from and a corresponding array of bin center intensities. Alternatively, only the histogram can be passed.
Upper threshold value. All pixels with an intensity higher than this value are assumed to be foreground.
If unable to find two local maxima in the histogram or if the smoothing takes more than 1e4 iterations.
C. A. Glasbey, “An analysis of histogram-based thresholding algorithms,” CVGIP: Graphical Models and Image Processing, vol. 55, pp. 532-537, 1993.
Prewitt, JMS & Mendelsohn, ML (1966), “The analysis of cell images”, Annals of the New York Academy of Sciences 128: 1035-1053 DOI:10.1111/j.1749-6632.1965.tb11715.x
Generate classes-1 threshold values to divide gray levels in image.
The threshold values are chosen to maximize the total sum of pairwise variances between the thresholded graylevel classes. See Notes and [1] for more details.
Grayscale input image.
Number of classes to be thresholded, i.e. the number of resulting regions.
Number of bins used to calculate the histogram. This value is ignored for integer arrays.
Array containing the threshold values for the desired classes.
If image contains less grayscale value then the desired number of classes.
This implementation relies on a Cython function whose complexity is \(O\left(\frac{Ch^{C-1}}{(C-1)!}\right)\), where \(h\) is the number of histogram bins and \(C\) is the number of classes desired.
The input image must be grayscale.
Liao, P-S., Chen, T-S. and Chung, P-C., “A fast algorithm for multilevel thresholding”, Journal of Information Science and Engineering 17 (5): 713-727, 2001. Available at: <https://ftp.iis.sinica.edu.tw/JISE/2001/200109_01.pdf> DOI:10.6688/JISE.2001.17.5.1
Tosa, Y., “Multi-Otsu Threshold”, a java plugin for ImageJ. Available at: <http://imagej.net/plugins/download/Multi_OtsuThreshold.java>
Multi-Otsu Thresholding
Segment human cells (in mitosis)
Applies Niblack local threshold to an array.
A threshold T is calculated for every pixel in the image using the following formula:
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.
Input image.
Window size specified as a single odd integer (3, 5, 7, …), or an iterable of length image.ndim containing only odd integers (e.g. (1, 5, 5)).
Value of parameter k in threshold formula.
Threshold mask. All pixels with an intensity higher than this value are assumed to be foreground.
This algorithm is originally designed for text recognition.
The Bradley threshold is a particular case of the Niblack one, being equivalent to
for some value q. By default, Bradley and Roth use q=1.
W. Niblack, An introduction to Digital Image Processing, Prentice-Hall, 1986.
D. Bradley and G. Roth, “Adaptive thresholding using Integral Image”, Journal of Graphics Tools 12(2), pp. 13-21, 2007. DOI:10.1080/2151237X.2007.10129236
Return threshold value based on Otsu’s method.
Either image or hist must be provided. If hist is provided, the actual histogram of the image is ignored.
Grayscale input image.
Number of bins used to calculate histogram. This value is ignored for integer arrays.
Histogram from which to determine the threshold, and optionally a corresponding array of bin center intensities. An alternative use of this function is to pass it only hist.
Upper threshold value. All pixels with an intensity higher than this value are assumed to be foreground.
The input image must be grayscale.
Wikipedia, https://en.wikipedia.org/wiki/Otsu’s_Method
Measure region properties
Rank filters
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:
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.
Input image.
Window size specified as a single odd integer (3, 5, 7, …), or an iterable of length image.ndim containing only odd integers (e.g. (1, 5, 5)).
Value of the positive parameter k.
Value of R, the dynamic range of standard deviation. If None, set to the half of the image dtype range.
Threshold mask. All pixels with an intensity higher than this value are assumed to be foreground.
This algorithm is originally designed for text recognition.
J. Sauvola and M. Pietikainen, “Adaptive document image binarization,” Pattern Recognition 33(2), pp. 225-236, 2000. DOI:10.1016/S0031-3203(99)00055-2
Return threshold value based on the triangle algorithm.
Grayscale input image.
Number of bins used to calculate histogram. This value is ignored for integer arrays.
Upper threshold value. All pixels with an intensity higher than this value are assumed to be foreground.
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. 741-753 DOI:10.1177/25.7.70454
ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold
Return threshold value based on Yen’s method. Either image or hist must be provided. In case hist is given, the actual histogram of the image is ignored.
Input image.
Number of bins used to calculate histogram. This value is ignored for integer arrays.
Histogram from which to determine the threshold, and optionally a corresponding array of bin center intensities. An alternative use of this function is to pass it only hist.
Upper threshold value. All pixels with an intensity higher than this value are assumed to be foreground.
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. DOI:10.1109/83.366472
Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146-165, DOI:10.1117/1.1631315 http://www.busim.ee.boun.edu.tr/~sankur/SankurFolder/Threshold_survey.pdf
ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold
Returns a figure comparing the outputs of different thresholding methods.
Input image.
Figure size (in inches).
Print function name for each method.
Matplotlib figure and axes.
The following algorithms are used:
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.
Input image.
If a scalar is given, then its value is used for all dimensions. If sequence is given, then there must be exactly one radius for each dimension except the last dimension for multichannel images. Note that 0 radius means no blurring, and negative values are not allowed.
The details will be amplified with this factor. The factor could be 0 or negative. Typically, it is a small positive number, e.g. 1.0.
If True, the last image dimension is considered as a color channel, otherwise as spatial. Color channels are processed individually.
Whether to keep the original range of values. Otherwise, the input image is converted according to the conventions of img_as_float. Also see https://scikit-image.org/docs/dev/user_guide/data_types.html
Image with unsharp mask applied.
Unsharp masking is an image sharpening technique. It is a linear image operation, and numerically stable, unlike deconvolution which is an ill-posed 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].
Maria Petrou, Costas Petrou “Image Processing: The Fundamentals”, (2010), ed ii., page 357, ISBN 13: 9781119994398 DOI:10.1002/9781119994398
Wikipedia. Unsharp masking https://en.wikipedia.org/wiki/Unsharp_masking
Minimum Mean Square Error (Wiener) inverse filter.
Input data.
Ratio between power spectrum of noise and undegraded image.
Impulse response of the filter. See LPIFilter2D.__init__.
Additional keyword parameters to the impulse_response function.
If you need to apply the same filter multiple times over different images, construct the LPIFilter2D and specify it here.
Return an n-dimensional window of a given size and dimensionality.
The type of window to be created. Any window type supported by scipy.signal.get_window is allowed here. See notes below for a current list, or the SciPy documentation for the version of SciPy on your machine.
The shape of the window along each axis. If an integer is provided, a 1D window is generated.
Keyword arguments passed to skimage.transform.warp (e.g., warp_kwargs={'order':3} to change interpolation method).
A window of the specified shape. dtype is np.double.
This function is based on scipy.signal.get_window and thus can access all of the window types available to that function (e.g., "hann", "boxcar"). Note that certain window types require parameters that have to be supplied with the window name as a tuple (e.g., ("tukey", 0.8)). If only a float is supplied, it is interpreted as the beta parameter of the Kaiser window.
See https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.windows.get_window.html for more details.
Note that this function generates a double precision array of the specified shape and can thus generate very large arrays that consume a large amount of available memory.
The approach taken here to create nD windows is to first calculate the Euclidean distance from the center of the intended nD window to each position in the array. That distance is used to sample, with interpolation, from a 1D window returned from scipy.signal.get_window. The method of interpolation can be changed with the order keyword argument passed to skimage.transform.warp.
Some coordinates in the output window will be outside of the original signal; these will be filled in with zeros.
Window types: - boxcar - triang - blackman - hamming - hann - bartlett - flattop - parzen - bohman - blackmanharris - nuttall - barthann - kaiser (needs beta) - gaussian (needs standard deviation) - general_gaussian (needs power, width) - slepian (needs width) - dpss (needs normalized half-bandwidth) - chebwin (needs attenuation) - exponential (needs decay scale) - tukey (needs taper fraction)
Two-dimensional window design, Wikipedia, https://en.wikipedia.org/wiki/Two_dimensional_window_design
Return a Hann window with shape (512, 512):
Return a Kaiser window with beta parameter of 16 and shape (256, 256, 35):
Return a Tukey window with an alpha parameter of 0.8 and shape (100, 300):
Bases: object
Linear Position-Invariant Filter (2-dimensional)
Function that yields the impulse response. r and c are 1-dimensional vectors that represent row and column positions, in other words coordinates are (r[0],c[0]),(r[0],c[1]) etc. **filter_params are passed through.
In other words, impulse_response would be called like this:
Gaussian filter: Use a 1-D gaussian in each direction without normalization coefficients.


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.
Grayscale input image.
Lower threshold.
Higher threshold.
Array in which True indicates the locations where image was above the hysteresis threshold.
J. Canny. A computational approach to edge detection. IEEE Transactions on Pattern Analysis and Machine Intelligence. 1986; vol. 8, pp.679-698. DOI:10.1109/TPAMI.1986.4767851


Compute valid cross-correlation of padded_array and kernel.
This function is fast when kernel is large with many zeros.
See scipy.ndimage.correlate for a description of cross-correlation.
The input array. If mode is ‘valid’, this array should already be padded, as a margin of the same shape as kernel will be stripped off.
The kernel to be correlated. Must have the same number of dimensions as padded_array. For high performance, it should be sparse (few nonzero entries).
See scipy.ndimage.correlate for valid modes. Additionally, mode ‘valid’ is accepted, in which case no padding is applied and the result is the result for the smaller image for which the kernel is entirely inside the original data.
The result of cross-correlating image with kernel. If mode ‘valid’ is used, the resulting shape is (M-Q+1, N-R+1,[ …,] P-S+1).


Find features between low_sigma and high_sigma in size.
This function uses the Difference of Gaussians method for applying band-pass filters to multi-dimensional arrays. The input array is blurred with two Gaussian kernels of differing sigmas to produce two intermediate, filtered images. The more-blurred image is then subtracted from the less-blurred image. The final output image will therefore have had high-frequency components attenuated by the smaller-sigma Gaussian, and low frequency components will have been removed due to their presence in the more-blurred intermediate.
Input array to filter.
Standard deviation(s) for the Gaussian kernel with the smaller sigmas across all axes. The standard deviations are given for each axis as a sequence, or as a single number, in which case the single number is used as the standard deviation value for all axes.
Standard deviation(s) for the Gaussian kernel with the larger sigmas across all axes. The standard deviations are given for each axis as a sequence, or as a single number, in which case the single number is used as the standard deviation value for all axes. If None is given (default), sigmas for all axes are calculated as 1.6 * low_sigma.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘nearest’.
Value to fill past edges of input if mode is ‘constant’. Default is 0.0
Whether the last axis of the image is to be interpreted as multiple channels. If True, each channel is filtered separately (channels are not mixed together).
Truncate the filter at this many standard deviations.
the filtered array.
See also
This function will subtract an array filtered with a Gaussian kernel with sigmas given by high_sigma from an array filtered with a Gaussian kernel with sigmas provided by low_sigma. The values for high_sigma must always be greater than or equal to the corresponding values in low_sigma, or a ValueError will be raised.
When high_sigma is none, the values for high_sigma will be calculated as 1.6x the corresponding values in low_sigma. This ratio was originally proposed by Marr and Hildreth (1980) [1] and is commonly used when approximating the inverted Laplacian of Gaussian, which is used in edge and blob detection.
Input image is converted according to the conventions of img_as_float.
Except for sigma values, all parameters are used for both filters.
Marr, D. and Hildreth, E. Theory of Edge Detection. Proc. R. Soc. Lond. Series B 207, 187-217 (1980). https://doi.org/10.1098/rspb.1980.0020
Apply a simple Difference of Gaussians filter to a color image:
Apply a Laplacian of Gaussian filter as approximated by the Difference of Gaussians filter:
Apply a Difference of Gaussians filter to a grayscale image using different sigma values for each axis:


Find the edge magnitude using the Farid transform.
Image to process.
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.
The Farid edge map.
See also
Take the square root of the sum of the squares of the horizontal and vertical derivatives to get a magnitude that is somewhat insensitive to direction. Similar to the Scharr operator, this operator is designed with a rotation invariance constraint.
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
Wikipedia, “Farid and Simoncelli Derivatives.” Available at: <https://en.wikipedia.org/wiki/Image_derivatives#Farid_and_Simoncelli_Derivatives>


Find the horizontal edges of an image using the Farid transform.
Image to process.
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.
The Farid edge map.
The kernel was constructed using the 5-tap weights from [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
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.


Find the vertical edges of an image using the Farid transform.
Image to process.
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.
The Farid edge map.
The kernel was constructed using the 5-tap weights from [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


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 2-D and 3-D images. Calculates the eigenvectors of the Hessian to compute the similarity of an image region to vessels, according to the method described in [1].
Array with input image data.
Sigmas used as scales of filter, i.e., np.arange(scale_range[0], scale_range[1], scale_step)
The range of sigmas used.
Step size between sigmas.
Frangi correction constant that adjusts the filter’s sensitivity to deviation from a plate-like structure.
Frangi correction constant that adjusts the filter’s sensitivity to deviation from a blob-like structure.
Frangi correction constant that adjusts the filter’s sensitivity to areas of high variance/texture/structure.
When True (the default), the filter detects black ridges; when False, it detects white ridges.
How to handle values outside the image borders.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Filtered image (maximum of pixels across all scales).
See also
Written by Marc Schrijver, November 2001 Re-Written by D. J. Kroon, University of Twente, May 2009, [2] Adoption of 3D version from D. G. Ellis, Januar 20017, [3]
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 Computer-Assisted Intervention (pp. 130-137). Springer Berlin Heidelberg. DOI:10.1007/BFb0056195
Kroon, D. J.: Hessian based Frangi vesselness filter.
Ellis, D. G.: https://github.com/ellisdg/frangi3d/tree/master/frangi


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.
Input image.
Spatial frequency of the harmonic function. Specified in pixels.
Orientation in radians. If 0, the harmonic is in the x-direction.
The bandwidth captured by the filter. For fixed bandwidth, sigma_x and sigma_y will decrease with increasing frequency. This value is ignored if sigma_x and sigma_y are set by the user.
Standard deviation in x- and y-directions. These directions apply to the kernel before rotation. If theta = pi/2, then the kernel is rotated 90 degrees so that sigma_x controls the vertical direction.
The linear size of the kernel is n_stds (3 by default) standard deviations.
Phase offset of harmonic function in radians.
Mode used to convolve image with a kernel, passed to ndi.convolve
Value to fill past edges of input if mode of convolution is ‘constant’. The parameter is passed to ndi.convolve.
Filtered images using the real and imaginary parts of the Gabor filter kernel. Images are of the same dimensions as the input one.
https://en.wikipedia.org/wiki/Gabor_filter
https://web.archive.org/web/20180127125930/http://mplab.ucsd.edu/tutorials/gabor.pdf


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.
Spatial frequency of the harmonic function. Specified in pixels.
Orientation in radians. If 0, the harmonic is in the x-direction.
The bandwidth captured by the filter. For fixed bandwidth, sigma_x and sigma_y will decrease with increasing frequency. This value is ignored if sigma_x and sigma_y are set by the user.
Standard deviation in x- and y-directions. These directions apply to the kernel before rotation. If theta = pi/2, then the kernel is rotated 90 degrees so that sigma_x controls the vertical direction.
The linear size of the kernel is n_stds (3 by default) standard deviations
Phase offset of harmonic function in radians.
Complex filter kernel.
https://en.wikipedia.org/wiki/Gabor_filter
https://web.archive.org/web/20180127125930/http://mplab.ucsd.edu/tutorials/gabor.pdf


Multi-dimensional Gaussian filter.
Input image (grayscale or color) to filter.
Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes.
The output parameter passes an array in which to store the filter output.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘nearest’.
Value to fill past edges of input if mode is ‘constant’. Default is 0.0
Whether the last axis of the image is to be interpreted as multiple channels. If True, each channel is filtered separately (channels are not mixed together). Only 3 channels are supported. If None, the function will attempt to guess this, and raise a warning if ambiguous, when the array has shape (M, N, 3).
Whether to keep the original range of values. Otherwise, the input image is converted according to the conventions of img_as_float. Also see https://scikit-image.org/docs/dev/user_guide/data_types.html
Truncate the filter at this many standard deviations.
the filtered array
This function is a wrapper around scipy.ndi.gaussian_filter().
Integer arrays are converted to float.
The output should be floating point data type since gaussian converts to float provided image. If output is not provided, another array will be allocated and returned as the result.
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.


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 2-D and 3-D images. Almost equal to Frangi filter, but uses alternative method of smoothing. Refer to [1] to find the differences between Frangi and Hessian filters.
Array with input image data.
Sigmas used as scales of filter, i.e., np.arange(scale_range[0], scale_range[1], scale_step)
The range of sigmas used.
Step size between sigmas.
Frangi correction constant that adjusts the filter’s sensitivity to deviation from a blob-like structure.
Frangi correction constant that adjusts the filter’s sensitivity to areas of high variance/texture/structure.
When True (the default), the filter detects black ridges; when False, it detects white ridges.
How to handle values outside the image borders.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Filtered image (maximum of pixels across all scales).
See also
Written by Marc Schrijver (November 2001) Re-Written by D. J. Kroon University of Twente (May 2009) [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. 609-622). Springer International Publishing. DOI:10.1007/978-3-319-16811-1_40
Kroon, D. J.: Hessian based Frangi vesselness filter.


Apply the filter in reverse to the given data.
Input data.
Impulse response of the filter. See LPIFilter2D.__init__.
Additional keyword parameters to the impulse_response function.
Limit the filter gain. Often, the filter contains zeros, which would cause the inverse filter to have infinite gain. High gain causes amplification of artefacts, so a conservative limit is recommended.
If you need to apply the same filter multiple times over different images, construct the LPIFilter2D and specify it here.


Find the edges of an image using the Laplace operator.
Image to process.
Define the size of the discrete Laplacian operator such that it will have a size of (ksize,) * image.ndim.
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.
The Laplace edge map.
The Laplacian operator is generated using the function skimage.restoration.uft.laplacian().


Bases: object
Linear Position-Invariant Filter (2-dimensional)
Function that yields the impulse response. r and c are 1-dimensional vectors that represent row and column positions, in other words coordinates are (r[0],c[0]),(r[0],c[1]) etc. **filter_params are passed through.
In other words, impulse_response would be called like this:
Gaussian filter: Use a 1-D gaussian in each direction without normalization coefficients.


Function that yields the impulse response. r and c are 1-dimensional vectors that represent row and column positions, in other words coordinates are (r[0],c[0]),(r[0],c[1]) etc. **filter_params are passed through.
In other words, impulse_response would be called like this:
Gaussian filter: Use a 1-D gaussian in each direction without normalization coefficients.


Return local median of an image.
Input image.
If behavior=='rank', selem is a 2-D array of 1’s and 0’s. If behavior=='ndimage', selem is a N-D array of 1’s and 0’s with the same number of dimension than image. If None, selem will be a N-D array with 3 elements for each dimension (e.g., vector, square, cube, etc.)
If None, a new array is allocated.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘nearest’.
New in version 0.15: mode is used when behavior='ndimage'.
Value to fill past edges of input if mode is ‘constant’. Default is 0.0
New in version 0.15: cval was added in 0.15 is used when behavior='ndimage'.
Either to use the old behavior (i.e., < 0.15) or the new behavior. The old behavior will call the skimage.filters.rank.median(). The new behavior will call the scipy.ndimage.median_filter(). Default is ‘ndimage’.
New in version 0.15: behavior is introduced in 0.15
Changed in version 0.16: Default behavior has been changed from ‘rank’ to ‘ndimage’
Output image.
See also
Rank-based implementation of the median filtering offering more flexibility with additional parameters but dedicated for unsigned integer images.


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].
Array with input image data.
Sigmas used as scales of filter
Frangi correction constant that adjusts the filter’s sensitivity to deviation from a plate-like structure.
When True (the default), the filter detects black ridges; when False, it detects white ridges.
How to handle values outside the image borders.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Filtered image (maximum of pixels across all scales).
See also
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), 167-176. DOI:10.1002/cyto.a.20022


Find the edge magnitude using the Prewitt transform.
The input image.
Clip the output image to this mask. (Values where mask=0 will be set to 0.)
Compute the edge filter along this axis. If not provided, the edge magnitude is computed. This is defined as:
The magnitude is also computed if axis is a sequence.
The boundary mode for the convolution. See scipy.ndimage.convolve for a description of the modes. This can be either a single boundary mode or one boundary mode per axis.
When mode is 'constant', this is the constant used in values outside the boundary of the image data.
The Prewitt edge map.
See also
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.


Find the horizontal edges of an image using the Prewitt transform.
Image to process.
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.
The Prewitt edge map.
We use the following kernel:


Find the vertical edges of an image using the Prewitt transform.
Image to process.
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.
The Prewitt edge map.
We use the following kernel:


skimage.filters.rank.autolevel(image, selem)
Auto-level image using local histogram.
skimage.filters.rank.autolevel_percentile(…)
Return greyscale local autolevel of an image.
skimage.filters.rank.bottomhat(image, selem)
Local bottom-hat of an image.
skimage.filters.rank.enhance_contrast(image, …)
Enhance contrast of an image.
skimage.filters.rank.enhance_contrast_percentile(…)
Enhance contrast of an image.
skimage.filters.rank.entropy(image, selem[, …])
Local entropy.
skimage.filters.rank.equalize(image, selem)
Equalize image using local histogram.
skimage.filters.rank.geometric_mean(image, selem)
Return local geometric mean of an image.
skimage.filters.rank.gradient(image, selem)
Return local gradient of an image (i.e.
skimage.filters.rank.gradient_percentile(…)
Return local gradient of an image (i.e.
skimage.filters.rank.majority(image, selem, *)
Majority filter assign to each pixel the most occuring value within its neighborhood.
skimage.filters.rank.maximum(image, selem[, …])
Return local maximum of an image.
skimage.filters.rank.mean(image, selem[, …])
Return local mean of an image.
skimage.filters.rank.mean_bilateral(image, selem)
Apply a flat kernel bilateral filter.
skimage.filters.rank.mean_percentile(image, …)
Return local mean of an image.
skimage.filters.rank.median(image[, selem, …])
Return local median of an image.
skimage.filters.rank.minimum(image, selem[, …])
Return local minimum of an image.
skimage.filters.rank.modal(image, selem[, …])
Return local mode of an image.
skimage.filters.rank.noise_filter(image, selem)
Noise feature.
skimage.filters.rank.otsu(image, selem[, …])
Local Otsu’s threshold value for each pixel.
skimage.filters.rank.percentile(image, selem)
Return local percentile of an image.
skimage.filters.rank.pop(image, selem[, …])
Return the local number (population) of pixels.
skimage.filters.rank.pop_bilateral(image, selem)
Return the local number (population) of pixels.
skimage.filters.rank.pop_percentile(image, selem)
Return the local number (population) of pixels.
skimage.filters.rank.subtract_mean(image, selem)
Return image subtracted from its local mean.
skimage.filters.rank.subtract_mean_percentile(…)
Return image subtracted from its local mean.
skimage.filters.rank.sum(image, selem[, …])
Return the local sum of pixels.
skimage.filters.rank.sum_bilateral(image, selem)
Apply a flat kernel bilateral filter.
skimage.filters.rank.sum_percentile(image, selem)
Return the local sum of pixels.
skimage.filters.rank.threshold(image, selem)
Local threshold of an image.
skimage.filters.rank.threshold_percentile(…)
Local threshold of an image.
skimage.filters.rank.tophat(image, selem[, …])
Local top-hat of an image.
skimage.filters.rank.windowed_histogram(…)
Normalized sliding window histogram
Auto-level image using local histogram.
This filter locally stretches the histogram of gray values to cover the entire range of values from “white” to “black”.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Rank filters
Return greyscale local autolevel of an image.
This filter locally stretches the histogram of greyvalues to cover the entire range of values from “white” to “black”.
Only greyvalues between percentiles [p0, p1] are considered in the filter.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [p0, p1] percentile interval to be considered for computing the value.
Output image.
Rank filters
Local bottom-hat of an image.
This filter computes the morphological closing of the image and then subtracts the result from the original image.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
New in version 0.17.
This function is deprecated and will be removed in scikit-image 0.19. This filter was misnamed and we believe that the usefulness is narrow.
Enhance contrast of an image.
This replaces each pixel by the local maximum if the pixel gray value is closer to the local maximum than the local minimum. Otherwise it is replaced by the local minimum.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image
Rank filters
Enhance contrast of an image.
This replaces each pixel by the local maximum if the pixel greyvalue is closer to the local maximum than the local minimum. Otherwise it is replaced by the local minimum.
Only greyvalues between percentiles [p0, p1] are considered in the filter.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [p0, p1] percentile interval to be considered for computing the value.
Output image.
Rank filters
Local entropy.
The entropy is computed using base 2 logarithm i.e. the filter returns the minimum number of bits needed to encode the local gray level distribution.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
https://en.wikipedia.org/wiki/Entropy_(information_theory)
Tinting gray-scale images
Entropy
Rank filters
Equalize image using local histogram.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Local Histogram Equalization
Rank filters
Return local geometric mean of an image.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Gonzalez, R. C. and Wood, R. E. “Digital Image Processing (3rd Edition).” Prentice-Hall Inc, 2006.
Return local gradient of an image (i.e. local maximum - local minimum).
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Markers for watershed transform
Rank filters
Return local gradient of an image (i.e. local maximum - local minimum).
Only greyvalues between percentiles [p0, p1] are considered in the filter.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [p0, p1] percentile interval to be considered for computing the value.
Output image.
Majority filter assign to each pixel the most occuring value within its neighborhood.
Image array (uint8, uint16 array).
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array will be allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Return local maximum of an image.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
See also
The lower algorithm complexity makes skimage.filters.rank.maximum more efficient for larger images and structuring elements.
Rank filters
Return local mean of an image.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Segment human cells (in mitosis)
Rank filters
Apply a flat kernel bilateral filter.
This is an edge-preserving and noise reducing denoising filter. It averages pixels based on their spatial closeness and radiometric similarity.
Spatial closeness is measured by considering only the local pixel neighborhood given by a structuring element.
Radiometric similarity is defined by the greylevel interval [g-s0, g+s1] where g is the current pixel greylevel.
Only pixels belonging to the structuring element and having a greylevel inside this interval are averaged.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [s0, s1] interval around the greyvalue of the center pixel to be considered for computing the value.
Output image.
See also
Rank filters
Return local mean of an image.
Only greyvalues between percentiles [p0, p1] are considered in the filter.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [p0, p1] percentile interval to be considered for computing the value.
Output image.
Return local median of an image.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s. If None, a full square of size 3 is used.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
See also
Implementation of a median filtering which handles images with floating precision.
Markers for watershed transform
Rank filters
Return local minimum of an image.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
See also
The lower algorithm complexity makes skimage.filters.rank.minimum more efficient for larger images and structuring elements.
Rank filters
Return local mode of an image.
The mode is the value that appears most often in the local histogram.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Noise feature.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
N. Hashimoto et al. Referenceless image quality evaluation for whole slide imaging. J Pathol Inform 2012;3:9.
Local Otsu’s threshold value for each pixel.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
https://en.wikipedia.org/wiki/Otsu’s_method
Rank filters
Return local percentile of an image.
Returns the value of the p0 lower percentile of the local greyvalue distribution.
Only greyvalues between percentiles [p0, p1] are considered in the filter.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Set the percentile value.
Output image.
Return the local number (population) of pixels.
The number of pixels is defined as the number of pixels which are included in the structuring element and the mask.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Return the local number (population) of pixels.
The number of pixels is defined as the number of pixels which are included in the structuring element and the mask. Additionally pixels must have a greylevel inside the interval [g-s0, g+s1] where g is the greyvalue of the center pixel.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [s0, s1] interval around the greyvalue of the center pixel to be considered for computing the value.
Output image.
Return the local number (population) of pixels.
The number of pixels is defined as the number of pixels which are included in the structuring element and the mask.
Only greyvalues between percentiles [p0, p1] are considered in the filter.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [p0, p1] percentile interval to be considered for computing the value.
Output image.
Return image subtracted from its local mean.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Subtracting the mean value may introduce underflow. To compensate this potential underflow, the obtained difference is downscaled by a factor of 2 and shifted by n_bins / 2 - 1, the median value of the local histogram (n_bins = max(3, image.max()) +1 for 16-bits images and 256 otherwise).
Return image subtracted from its local mean.
Only greyvalues between percentiles [p0, p1] are considered in the filter.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [p0, p1] percentile interval to be considered for computing the value.
Output image.
Return the local sum of pixels.
Note that the sum may overflow depending on the data type of the input array.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Apply a flat kernel bilateral filter.
This is an edge-preserving and noise reducing denoising filter. It averages pixels based on their spatial closeness and radiometric similarity.
Spatial closeness is measured by considering only the local pixel neighborhood given by a structuring element (selem).
Radiometric similarity is defined by the greylevel interval [g-s0, g+s1] where g is the current pixel greylevel.
Only pixels belonging to the structuring element AND having a greylevel inside this interval are summed.
Note that the sum may overflow depending on the data type of the input array.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [s0, s1] interval around the greyvalue of the center pixel to be considered for computing the value.
Output image.
See also
Return the local sum of pixels.
Only greyvalues between percentiles [p0, p1] are considered in the filter.
Note that the sum may overflow depending on the data type of the input array.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Define the [p0, p1] percentile interval to be considered for computing the value.
Output image.
Local threshold of an image.
The resulting binary mask is True if the gray value of the center pixel is greater than the local mean.
Input image.
The neighborhood expressed as an ndarray of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
Local threshold of an image.
The resulting binary mask is True if the greyvalue of the center pixel is greater than the local mean.
Only greyvalues between percentiles [p0, p1] are considered in the filter.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Set the percentile value.
Output image.
Local top-hat of an image.
This filter computes the morphological opening of the image and then subtracts the result from the original image.
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
Output image.
New in version 0.17.
This function is deprecated and will be removed in scikit-image 0.19. This filter was misnamed and we believe that the usefulness is narrow.
Normalized sliding window histogram
Input image.
The neighborhood expressed as a 2-D array of 1’s and 0’s.
If None, a new array is allocated.
Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).
Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).
The number of histogram bins. Will default to image.max() + 1 if None is passed.
Array of dimensions (H,W,N), where (H,W) are the dimensions of the input image and N is n_bins or image.max() + 1 if no value is provided as a parameter. Effectively, each pixel is a N-D feature vector that is the histogram. The sum of the elements in the feature vector will be 1, unless no pixels in the window were covered by both selem and mask, in which case all elements will be 0.