neulab/docprompting-conala huggingface dataset:
skimage.feature.multiblock_lbp(int_image, r, c, width, height) [source]
 
Multi-block local binary pattern (MB-LBP). The features are calculated similarly to local binary patterns (LBPs), (See local_binary_pattern()) except that summed blocks are used instead of individual pixel values. MB-LBP is an extension of LBP that can be computed on multiple scales in constant time using the integral image. Nine equally-sized rectangles are used to compute a feature. For each rectangle, the sum of the pixel intensities is computed. Comparisons of these sums to that of the central rectangle determine the feature, similarly to LBP.  Parameters 
 
int_image(N, M) array 

Integral image.  
rint 

Row-coordinate of top left corner of a rectangle containing feature.  
cint 

Column-coordinate of top left corner of a rectangle containing feature.  
widthint 

Width of one of the 9 equal rectangles that will be used to compute a feature.  
heightint 

Height of one of the 9 equal rectangles that will be used to compute a feature.    Returns 
 
outputint 

8-bit MB-LBP feature descriptor.     References  
1  
Face Detection Based on Multi-Block LBP Representation. Lun Zhang, Rufeng Chu, Shiming Xiang, Shengcai Liao, Stan Z. Li http://www.cbsr.ia.ac.cn/users/scliao/papers/Zhang-ICB07-MBLBP.pdf
skimage.feature.multiscale_basic_features(image, multichannel=False, intensity=True, edges=True, texture=True, sigma_min=0.5, sigma_max=16, num_sigma=None, num_workers=None) [source]
 
Local features for a single- or multi-channel nd image. Intensity, gradient intensity and local structure are computed at different scales thanks to Gaussian blurring.  Parameters 
 
imagendarray 

Input image, which can be grayscale or multichannel.  
multichannelbool, default False 

True if the last dimension corresponds to color channels.  
intensitybool, default True 

If True, pixel intensities averaged over the different scales are added to the feature set.  
edgesbool, default True 

If True, intensities of local gradients averaged over the different scales are added to the feature set.  
texturebool, default True 

If True, eigenvalues of the Hessian matrix after Gaussian blurring at different scales are added to the feature set.  
sigma_minfloat, optional 

Smallest value of the Gaussian kernel used to average local neighbourhoods before extracting features.  
sigma_maxfloat, optional 

Largest value of the Gaussian kernel used to average local neighbourhoods before extracting features.  
num_sigmaint, optional 

Number of values of the Gaussian kernel between sigma_min and sigma_max. If None, sigma_min multiplied by powers of 2 are used.  
num_workersint or None, optional 

The number of parallel threads to use. If set to None, the full set of available cores are used.    Returns 
 
featuresnp.ndarray 

Array of shape image.shape + (n_features,)
detect(image) [source]
 
Detect oriented FAST keypoints along with the corresponding scale.  Parameters 
 
image2D array 

Input image.
detect_and_extract(image) [source]
 
Detect oriented FAST keypoints and extract rBRIEF descriptors. Note that this is faster than first calling detect and then extract.  Parameters 
 
image2D array 

Input image.
extract(image, keypoints, scales, orientations) [source]
 
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.  Parameters 
 
image2D array 

Input image.  
keypoints(N, 2) array 

Keypoint coordinates as (row, col).  
scales(N, ) array 

Corresponding scales.  
orientations(N, ) array 

Corresponding orientations in radians.
__init__(downscale=1.2, n_scales=8, n_keypoints=500, fast_n=9, fast_threshold=0.08, harris_k=0.04) [source]
 
Initialize self. See help(type(self)) for accurate signature.
skimage.feature.plot_matches(ax, image1, image2, keypoints1, keypoints2, matches, keypoints_color='k', matches_color=None, only_matches=False, alignment='horizontal') [source]
 
Plot matched features.  Parameters 
 
axmatplotlib.axes.Axes 

Matches and image are drawn in this ax.  
image1(N, M [, 3]) array 

First grayscale or color image.  
image2(N, M [, 3]) array 

Second grayscale or color image.  
keypoints1(K1, 2) array 

First keypoint coordinates as (row, col).  
keypoints2(K2, 2) array 

Second keypoint coordinates as (row, col).  
matches(Q, 2) array 

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.  
keypoints_colormatplotlib color, optional 

Color for keypoint locations.  
matches_colormatplotlib color, optional 

Color for lines which connect keypoint matches. By default the color is chosen randomly.  
only_matchesbool, optional 

Whether to only plot matches and not plot the keypoint locations.  
alignment{‘horizontal’, ‘vertical’}, optional 

Whether to show images side by side, 'horizontal', or one above the other, 'vertical'.
skimage.feature.register_translation(src_image, target_image, upsample_factor=1, space='real', return_error=True) [source]
 
Deprecated function. Use skimage.registration.phase_cross_correlation instead.
skimage.feature.shape_index(image, sigma=1, mode='constant', cval=0) [source]
 
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:  Ranges of the shape index and corresponding 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    Parameters 
 
imagendarray 

Input image.  
sigmafloat, optional 

Standard deviation used for the Gaussian kernel, which is used for smoothing the input data before Hessian eigen value calculation.  
mode{‘constant’, ‘reflect’, ‘wrap’, ‘nearest’, ‘mirror’}, optional 

How to handle values outside the image borders  
cvalfloat, optional 

Used in conjunction with mode ‘constant’, the value outside the image boundaries.    Returns 
 
sndarray 

Shape index     References  
1  
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   Examples >>> from skimage.feature import shape_index
>>> square = np.zeros((5, 5))
>>> square[2, 2] = 4
>>> s = shape_index(square, sigma=0.1)
>>> s
array([[ nan,  nan, -0.5,  nan,  nan],
       [ nan, -0. ,  nan, -0. ,  nan],
       [-0.5,  nan, -1. ,  nan, -0.5],
       [ nan, -0. ,  nan, -0. ,  nan],
       [ nan,  nan, -0.5,  nan,  nan]])
skimage.feature.structure_tensor(image, sigma=1, mode='constant', cval=0, order=None) [source]
 
Compute structure tensor using sum of squared differences. The (2-dimensional) structure tensor A is defined as: A = [Arr Arc]
    [Arc Acc]
 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]).  Parameters 
 
imagendarray 

Input image.  
sigmafloat, optional 

Standard deviation used for the Gaussian kernel, which is used as a weighting function for the local summation of squared differences.  
mode{‘constant’, ‘reflect’, ‘wrap’, ‘nearest’, ‘mirror’}, optional 

How to handle values outside the image borders.  
cvalfloat, optional 

Used in conjunction with mode ‘constant’, the value outside the image boundaries.  
order{‘rc’, ‘xy’}, optional 

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).    Returns 
 
A_elemslist of ndarray 

Upper-diagonal elements of the structure tensor for each pixel in the input image.      See also  
structure_tensor_eigenvalues

  References  
1  
https://en.wikipedia.org/wiki/Structure_tensor   Examples >>> from skimage.feature import structure_tensor
>>> square = np.zeros((5, 5))
>>> square[2, 2] = 1
>>> Arr, Arc, Acc = structure_tensor(square, sigma=0.1, order='rc')
>>> Acc
array([[0., 0., 0., 0., 0.],
       [0., 1., 0., 1., 0.],
       [0., 4., 0., 4., 0.],
       [0., 1., 0., 1., 0.],
       [0., 0., 0., 0., 0.]])
skimage.feature.structure_tensor_eigenvalues(A_elems) [source]
 
Compute eigenvalues of structure tensor.  Parameters 
 
A_elemslist of ndarray 

The upper-diagonal elements of the structure tensor, as returned by structure_tensor.    Returns 
 ndarray

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  
structure_tensor

  Examples >>> from skimage.feature import structure_tensor
>>> from skimage.feature import structure_tensor_eigenvalues
>>> square = np.zeros((5, 5))
>>> square[2, 2] = 1
>>> A_elems = structure_tensor(square, sigma=0.1, order='rc')
>>> structure_tensor_eigenvalues(A_elems)[0]
array([[0., 0., 0., 0., 0.],
       [0., 2., 4., 2., 0.],
       [0., 4., 0., 4., 0.],
       [0., 2., 4., 2., 0.],
       [0., 0., 0., 0., 0.]])
skimage.feature.structure_tensor_eigvals(Axx, Axy, Ayy) [source]
 
Compute eigenvalues of structure tensor.  Parameters 
 
Axxndarray 

Element of the structure tensor for each pixel in the input image.  
Axyndarray 

Element of the structure tensor for each pixel in the input image.  
Ayyndarray 

Element of the structure tensor for each pixel in the input image.    Returns 
 
l1ndarray 

Larger eigen value for each input matrix.  
l2ndarray 

Smaller eigen value for each input matrix.     Examples >>> from skimage.feature import structure_tensor, structure_tensor_eigvals
>>> square = np.zeros((5, 5))
>>> square[2, 2] = 1
>>> Arr, Arc, Acc = structure_tensor(square, sigma=0.1, order='rc')
>>> structure_tensor_eigvals(Acc, Arc, Arr)[0]
array([[0., 0., 0., 0., 0.],
       [0., 2., 4., 2., 0.],
       [0., 4., 0., 4., 0.],
       [0., 2., 4., 2., 0.],
       [0., 0., 0., 0., 0.]])
skimage.filters.apply_hysteresis_threshold(image, low, high) [source]
 
Apply hysteresis thresholding to image. This algorithm finds regions where image is greater than high OR image is greater than low and that region is connected to a region greater than high.  Parameters 
 
imagearray, shape (M,[ N, …, P]) 

Grayscale input image.  
lowfloat, or array of same shape as image 

Lower threshold.  
highfloat, or array of same shape as image 

Higher threshold.    Returns 
 
thresholdedarray of bool, same shape as image 

Array in which True indicates the locations where image was above the hysteresis threshold.     References  
1  
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   Examples >>> image = np.array([1, 2, 3, 2, 1, 2, 1, 3, 2])
>>> apply_hysteresis_threshold(image, 1.5, 2.5).astype(int)
array([0, 1, 1, 1, 0, 0, 0, 1, 1])
skimage.filters.correlate_sparse(image, kernel, mode='reflect') [source]
 
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.  Parameters 
 
imagendarray, dtype float, shape (M, N,[ …,] P) 

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.  
kernelndarray, dtype float shape (Q, R,[ …,] S) 

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).  
modestring, optional 

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.    Returns 
 
resultarray of float, shape (M, N,[ …,] P) 

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).
skimage.filters.farid(image, *, mask=None) [source]
 
Find the edge magnitude using the Farid transform.  Parameters 
 
image2-D array 

Image to process.  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Farid edge map.      See also  
sobel, prewitt, canny 
  Notes 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. References  
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  
2  
Wikipedia, “Farid and Simoncelli Derivatives.” Available at: <https://en.wikipedia.org/wiki/Image_derivatives#Farid_and_Simoncelli_Derivatives>   Examples >>> from skimage import data
>>> camera = data.camera()
>>> from skimage import filters
>>> edges = filters.farid(camera)
skimage.filters.farid_h(image, *, mask=None) [source]
 
Find the horizontal edges of an image using the Farid transform.  Parameters 
 
image2-D array 

Image to process.  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Farid edge map.     Notes The kernel was constructed using the 5-tap weights from [1]. References  
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  
2  
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.
skimage.filters.farid_v(image, *, mask=None) [source]
 
Find the vertical edges of an image using the Farid transform.  Parameters 
 
image2-D array 

Image to process.  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Farid edge map.     Notes The kernel was constructed using the 5-tap weights from [1]. References  
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
skimage.filters.frangi(image, sigmas=range(1, 10, 2), scale_range=None, scale_step=None, alpha=0.5, beta=0.5, gamma=15, black_ridges=True, mode='reflect', cval=0) [source]
 
Filter an image with the Frangi vesselness filter. This filter can be used to detect continuous ridges, e.g. vessels, wrinkles, rivers. It can be used to calculate the fraction of the whole image containing such objects. Defined only for 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].  Parameters 
 
image(N, M[, P]) ndarray 

Array with input image data.  
sigmasiterable of floats, optional 

Sigmas used as scales of filter, i.e., np.arange(scale_range[0], scale_range[1], scale_step)  
scale_range2-tuple of floats, optional 

The range of sigmas used.  
scale_stepfloat, optional 

Step size between sigmas.  
alphafloat, optional 

Frangi correction constant that adjusts the filter’s sensitivity to deviation from a plate-like structure.  
betafloat, optional 

Frangi correction constant that adjusts the filter’s sensitivity to deviation from a blob-like structure.  
gammafloat, optional 

Frangi correction constant that adjusts the filter’s sensitivity to areas of high variance/texture/structure.  
black_ridgesboolean, optional 

When True (the default), the filter detects black ridges; when False, it detects white ridges.  
mode{‘constant’, ‘reflect’, ‘wrap’, ‘nearest’, ‘mirror’}, optional 

How to handle values outside the image borders.  
cvalfloat, optional 

Used in conjunction with mode ‘constant’, the value outside the image boundaries.    Returns 
 
out(N, M[, P]) ndarray 

Filtered image (maximum of pixels across all scales).      See also  
meijering


sato


hessian

  Notes 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] References  
1  
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  
2  
Kroon, D. J.: Hessian based Frangi vesselness filter.  
3  
Ellis, D. G.: https://github.com/ellisdg/frangi3d/tree/master/frangi
skimage.filters.gabor(image, frequency, theta=0, bandwidth=1, sigma_x=None, sigma_y=None, n_stds=3, offset=0, mode='reflect', cval=0) [source]
 
Return real and imaginary responses to Gabor filter. The real and imaginary parts of the Gabor filter kernel are applied to the image and the response is returned as a pair of arrays. Gabor filter is a linear filter with a Gaussian kernel which is modulated by a sinusoidal plane wave. Frequency and orientation representations of the Gabor filter are similar to those of the human visual system. Gabor filter banks are commonly used in computer vision and image processing. They are especially suitable for edge detection and texture classification.  Parameters 
 
image2-D array 

Input image.  
frequencyfloat 

Spatial frequency of the harmonic function. Specified in pixels.  
thetafloat, optional 

Orientation in radians. If 0, the harmonic is in the x-direction.  
bandwidthfloat, optional 

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.  
sigma_x, sigma_yfloat, optional 

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.  
n_stdsscalar, optional 

The linear size of the kernel is n_stds (3 by default) standard deviations.  
offsetfloat, optional 

Phase offset of harmonic function in radians.  
mode{‘constant’, ‘nearest’, ‘reflect’, ‘mirror’, ‘wrap’}, optional 

Mode used to convolve image with a kernel, passed to ndi.convolve  
cvalscalar, optional 

Value to fill past edges of input if mode of convolution is ‘constant’. The parameter is passed to ndi.convolve.    Returns 
 
real, imagarrays 

Filtered images using the real and imaginary parts of the Gabor filter kernel. Images are of the same dimensions as the input one.     References  
1  
https://en.wikipedia.org/wiki/Gabor_filter  
2  
https://web.archive.org/web/20180127125930/http://mplab.ucsd.edu/tutorials/gabor.pdf   Examples >>> from skimage.filters import gabor
>>> from skimage import data, io
>>> from matplotlib import pyplot as plt  
 >>> image = data.coins()
>>> # detecting edges in a coin image
>>> filt_real, filt_imag = gabor(image, frequency=0.6)
>>> plt.figure()            
>>> io.imshow(filt_real)    
>>> io.show()               
 >>> # less sensitivity to finer details with the lower frequency kernel
>>> filt_real, filt_imag = gabor(image, frequency=0.1)
>>> plt.figure()            
>>> io.imshow(filt_real)    
>>> io.show()
skimage.filters.gabor_kernel(frequency, theta=0, bandwidth=1, sigma_x=None, sigma_y=None, n_stds=3, offset=0) [source]
 
Return complex 2D Gabor filter kernel. Gabor kernel is a Gaussian kernel modulated by a complex harmonic function. Harmonic function consists of an imaginary sine function and a real cosine function. Spatial frequency is inversely proportional to the wavelength of the harmonic and to the standard deviation of a Gaussian kernel. The bandwidth is also inversely proportional to the standard deviation.  Parameters 
 
frequencyfloat 

Spatial frequency of the harmonic function. Specified in pixels.  
thetafloat, optional 

Orientation in radians. If 0, the harmonic is in the x-direction.  
bandwidthfloat, optional 

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.  
sigma_x, sigma_yfloat, optional 

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.  
n_stdsscalar, optional 

The linear size of the kernel is n_stds (3 by default) standard deviations  
offsetfloat, optional 

Phase offset of harmonic function in radians.    Returns 
 
gcomplex array 

Complex filter kernel.     References  
1  
https://en.wikipedia.org/wiki/Gabor_filter  
2  
https://web.archive.org/web/20180127125930/http://mplab.ucsd.edu/tutorials/gabor.pdf   Examples >>> from skimage.filters import gabor_kernel
>>> from skimage import io
>>> from matplotlib import pyplot as plt  
 >>> gk = gabor_kernel(frequency=0.2)
>>> plt.figure()        
>>> io.imshow(gk.real)  
>>> io.show()           
 >>> # more ripples (equivalent to increasing the size of the
>>> # Gaussian spread)
>>> gk = gabor_kernel(frequency=0.2, bandwidth=0.1)
>>> plt.figure()        
>>> io.imshow(gk.real)  
>>> io.show()