neulab/docprompting-conala huggingface dataset:
skimage.segmentation.morphological_chan_vese(image, iterations, init_level_set='checkerboard', smoothing=1, lambda1=1, lambda2=1, iter_callback=<function <lambda>>) [source]
 
Morphological Active Contours without Edges (MorphACWE) Active contours without edges implemented with morphological operators. It can be used to segment objects in images and volumes without well defined borders. It is required that the inside of the object looks different on average than the outside (i.e., the inner area of the object should be darker or lighter than the outer area on average).  Parameters 
 
image(M, N) or (L, M, N) array 

Grayscale image or volume to be segmented.  
iterationsuint 

Number of iterations to run  
init_level_setstr, (M, N) array, or (L, M, N) array 

Initial level set. If an array is given, it will be binarized and used as the initial level set. If a string is given, it defines the method to generate a reasonable initial level set with the shape of the image. Accepted values are ‘checkerboard’ and ‘circle’. See the documentation of checkerboard_level_set and circle_level_set respectively for details about how these level sets are created.  
smoothinguint, optional 

Number of times the smoothing operator is applied per iteration. Reasonable values are around 1-4. Larger values lead to smoother segmentations.  
lambda1float, optional 

Weight parameter for the outer region. If lambda1 is larger than lambda2, the outer region will contain a larger range of values than the inner region.  
lambda2float, optional 

Weight parameter for the inner region. If lambda2 is larger than lambda1, the inner region will contain a larger range of values than the outer region.  
iter_callbackfunction, optional 

If given, this function is called once per iteration with the current level set as the only argument. This is useful for debugging or for plotting intermediate results during the evolution.    Returns 
 
out(M, N) or (L, M, N) array 

Final segmentation (i.e., the final level set)      See also  
circle_level_set, checkerboard_level_set

  Notes This is a version of the Chan-Vese algorithm that uses morphological operators instead of solving a partial differential equation (PDE) for the evolution of the contour. The set of morphological operators used in this algorithm are proved to be infinitesimally equivalent to the Chan-Vese PDE (see [1]). However, morphological operators are do not suffer from the numerical stability issues typically found in PDEs (it is not necessary to find the right time step for the evolution), and are computationally faster. The algorithm and its theoretical derivation are described in [1]. References  
1(1,2)  
A Morphological Approach to Curvature-based Evolution of Curves and Surfaces, Pablo Márquez-Neila, Luis Baumela, Luis Álvarez. In IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 2014, DOI:10.1109/TPAMI.2013.106
skimage.segmentation.quickshift(image, ratio=1.0, kernel_size=5, max_dist=10, return_tree=False, sigma=0, convert2lab=True, random_seed=42) [source]
 
Segments image using quickshift clustering in Color-(x,y) space. Produces an oversegmentation of the image using the quickshift mode-seeking algorithm.  Parameters 
 
image(width, height, channels) ndarray 

Input image.  
ratiofloat, optional, between 0 and 1 

Balances color-space proximity and image-space proximity. Higher values give more weight to color-space.  
kernel_sizefloat, optional 

Width of Gaussian kernel used in smoothing the sample density. Higher means fewer clusters.  
max_distfloat, optional 

Cut-off point for data distances. Higher means fewer clusters.  
return_treebool, optional 

Whether to return the full segmentation hierarchy tree and distances.  
sigmafloat, optional 

Width for Gaussian smoothing as preprocessing. Zero means no smoothing.  
convert2labbool, optional 

Whether the input should be converted to Lab colorspace prior to segmentation. For this purpose, the input is assumed to be RGB.  
random_seedint, optional 

Random seed used for breaking ties.    Returns 
 
segment_mask(width, height) ndarray 

Integer mask indicating segment labels.     Notes The authors advocate to convert the image to Lab color space prior to segmentation, though this is not strictly necessary. For this to work, the image must be given in RGB format. References  
1  
Quick shift and kernel methods for mode seeking, Vedaldi, A. and Soatto, S. European Conference on Computer Vision, 2008
skimage.segmentation.relabel_sequential(label_field, offset=1) [source]
 
Relabel arbitrary labels to {offset, … offset + number_of_labels}. This function also returns the forward map (mapping the original labels to the reduced labels) and the inverse map (mapping the reduced labels back to the original ones).  Parameters 
 
label_fieldnumpy array of int, arbitrary shape 

An array of labels, which must be non-negative integers.  
offsetint, optional 

The return labels will start at offset, which should be strictly positive.    Returns 
 
relabelednumpy array of int, same shape as label_field 

The input label field with labels mapped to {offset, …, number_of_labels + offset - 1}. The data type will be the same as label_field, except when offset + number_of_labels causes overflow of the current data type.  
forward_mapArrayMap 

The map from the original label space to the returned label space. Can be used to re-apply the same mapping. See examples for usage. The output data type will be the same as relabeled.  
inverse_mapArrayMap 

The map from the new label space to the original space. This can be used to reconstruct the original label field from the relabeled one. The output data type will be the same as label_field.     Notes The label 0 is assumed to denote the background and is never remapped. The forward map can be extremely big for some inputs, since its length is given by the maximum of the label field. However, in most situations, label_field.max() is much smaller than label_field.size, and in these cases the forward map is guaranteed to be smaller than either the input or output images. Examples >>> from skimage.segmentation import relabel_sequential
>>> label_field = np.array([1, 1, 5, 5, 8, 99, 42])
>>> relab, fw, inv = relabel_sequential(label_field)
>>> relab
array([1, 1, 2, 2, 3, 5, 4])
>>> print(fw)
ArrayMap:
  1 → 1
  5 → 2
  8 → 3
  42 → 4
  99 → 5
>>> np.array(fw)
array([0, 1, 0, 0, 0, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5])
>>> np.array(inv)
array([ 0,  1,  5,  8, 42, 99])
>>> (fw[label_field] == relab).all()
True
>>> (inv[relab] == label_field).all()
True
>>> relab, fw, inv = relabel_sequential(label_field, offset=5)
>>> relab
array([5, 5, 6, 6, 7, 9, 8])
class skimage.transform.AffineTransform(matrix=None, scale=None, rotation=None, shear=None, translation=None) [source]
 
Bases: skimage.transform._geometric.ProjectiveTransform 2D affine transformation. Has the following form: X = a0*x + a1*y + a2 =
  = sx*x*cos(rotation) - sy*y*sin(rotation + shear) + a2

Y = b0*x + b1*y + b2 =
  = sx*x*sin(rotation) + sy*y*cos(rotation + shear) + b2
 where sx and sy are scale factors in the x and y directions, and the homogeneous transformation matrix is: [[a0  a1  a2]
 [b0  b1  b2]
 [0   0    1]]
  Parameters 
 
matrix(3, 3) array, optional 

Homogeneous transformation matrix.  
scale{s as float or (sx, sy) as array, list or tuple}, optional 

Scale factor(s). If a single value, it will be assigned to both sx and sy.  New in version 0.17: Added support for supplying a single scalar value.   
rotationfloat, optional 

Rotation angle in counter-clockwise direction as radians.  
shearfloat, optional 

Shear angle in counter-clockwise direction as radians.  
translation(tx, ty) as array, list or tuple, optional 

Translation parameters.    Attributes 
 
params(3, 3) array 

Homogeneous transformation matrix.      
__init__(matrix=None, scale=None, rotation=None, shear=None, translation=None) [source]
 
Initialize self. See help(type(self)) for accurate signature. 
  
property rotation 
  
property scale 
  
property shear 
  
property translation
__init__(matrix=None, scale=None, rotation=None, shear=None, translation=None) [source]
 
Initialize self. See help(type(self)) for accurate signature.
skimage.transform.downscale_local_mean(image, factors, cval=0, clip=True) [source]
 
Down-sample N-dimensional image by local averaging. The image is padded with cval if it is not perfectly divisible by the integer factors. In contrast to interpolation in skimage.transform.resize and skimage.transform.rescale this function calculates the local mean of elements in each block of size factors in the input image.  Parameters 
 
imagendarray 

N-dimensional input image.  
factorsarray_like 

Array containing down-sampling integer factor along each axis.  
cvalfloat, optional 

Constant padding value if image is not perfectly divisible by the integer factors.  
clipbool, optional 

Unused, but kept here for API consistency with the other transforms in this module. (The local mean will never fall outside the range of values in the input image, assuming the provided cval also falls within that range.)    Returns 
 
imagendarray 

Down-sampled image with same number of dimensions as input image. For integer inputs, the output dtype will be float64. See numpy.mean() for details.     Examples >>> a = np.arange(15).reshape(3, 5)
>>> a
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14]])
>>> downscale_local_mean(a, (2, 3))
array([[3.5, 4. ],
       [5.5, 4.5]])
class skimage.transform.EssentialMatrixTransform(rotation=None, translation=None, matrix=None) [source]
 
Bases: skimage.transform._geometric.FundamentalMatrixTransform Essential matrix transformation. The essential matrix relates corresponding points between a pair of calibrated images. The matrix transforms normalized, homogeneous image points in one image to epipolar lines in the other image. The essential matrix is only defined for a pair of moving images capturing a non-planar scene. In the case of pure rotation or planar scenes, the homography describes the geometric relation between two images (ProjectiveTransform). If the intrinsic calibration of the images is unknown, the fundamental matrix describes the projective relation between the two images (FundamentalMatrixTransform).  Parameters 
 
rotation(3, 3) array, optional 

Rotation matrix of the relative camera motion.  
translation(3, 1) array, optional 

Translation vector of the relative camera motion. The vector must have unit length.  
matrix(3, 3) array, optional 

Essential matrix.     References  
1  
Hartley, Richard, and Andrew Zisserman. Multiple view geometry in computer vision. Cambridge university press, 2003.    Attributes 
 
params(3, 3) array 

Essential matrix.      
__init__(rotation=None, translation=None, matrix=None) [source]
 
Initialize self. See help(type(self)) for accurate signature. 
  
estimate(src, dst) [source]
 
Estimate essential matrix using 8-point algorithm. The 8-point algorithm requires at least 8 corresponding point pairs for a well-conditioned solution, otherwise the over-determined solution is estimated.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.    Returns 
 
successbool 

True, if model estimation succeeds.
estimate(src, dst) [source]
 
Estimate essential matrix using 8-point algorithm. The 8-point algorithm requires at least 8 corresponding point pairs for a well-conditioned solution, otherwise the over-determined solution is estimated.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.    Returns 
 
successbool 

True, if model estimation succeeds.
__init__(rotation=None, translation=None, matrix=None) [source]
 
Initialize self. See help(type(self)) for accurate signature.
skimage.transform.estimate_transform(ttype, src, dst, **kwargs) [source]
 
Estimate 2D geometric transformation parameters. You can determine the over-, well- and under-determined parameters with the total least-squares method. Number of source and destination coordinates must match.  Parameters 
 
ttype{‘euclidean’, similarity’, ‘affine’, ‘piecewise-affine’, ‘projective’, ‘polynomial’} 

Type of transform.  
kwargsarray or int 

Function parameters (src, dst, n, angle): NAME / TTYPE        FUNCTION PARAMETERS
'euclidean'         `src, `dst`
'similarity'        `src, `dst`
'affine'            `src, `dst`
'piecewise-affine'  `src, `dst`
'projective'        `src, `dst`
'polynomial'        `src, `dst`, `order` (polynomial order,
                                          default order is 2)
 Also see examples below.    Returns 
 
tformGeometricTransform 

Transform object containing the transformation parameters and providing access to forward and inverse transformation functions.     Examples >>> import numpy as np
>>> from skimage import transform
 >>> # estimate transformation parameters
>>> src = np.array([0, 0, 10, 10]).reshape((2, 2))
>>> dst = np.array([12, 14, 1, -20]).reshape((2, 2))
 >>> tform = transform.estimate_transform('similarity', src, dst)
 >>> np.allclose(tform.inverse(tform(src)), src)
True
 >>> # warp image using the estimated transformation
>>> from skimage import data
>>> image = data.camera()
 >>> warp(image, inverse_map=tform.inverse) 
 >>> # create transformation with explicit parameters
>>> tform2 = transform.SimilarityTransform(scale=1.1, rotation=1,
...     translation=(10, 20))
 >>> # unite transformations, applied in order from left to right
>>> tform3 = tform + tform2
>>> np.allclose(tform3(src), tform2(tform(src)))
True
class skimage.transform.EuclideanTransform(matrix=None, rotation=None, translation=None) [source]
 
Bases: skimage.transform._geometric.ProjectiveTransform 2D Euclidean transformation. Has the following form: X = a0 * x - b0 * y + a1 =
  = x * cos(rotation) - y * sin(rotation) + a1

Y = b0 * x + a0 * y + b1 =
  = x * sin(rotation) + y * cos(rotation) + b1
 where the homogeneous transformation matrix is: [[a0  b0  a1]
 [b0  a0  b1]
 [0   0    1]]
 The Euclidean transformation is a rigid transformation with rotation and translation parameters. The similarity transformation extends the Euclidean transformation with a single scaling factor.  Parameters 
 
matrix(3, 3) array, optional 

Homogeneous transformation matrix.  
rotationfloat, optional 

Rotation angle in counter-clockwise direction as radians.  
translation(tx, ty) as array, list or tuple, optional 

x, y translation parameters.    Attributes 
 
params(3, 3) array 

Homogeneous transformation matrix.      
__init__(matrix=None, rotation=None, translation=None) [source]
 
Initialize self. See help(type(self)) for accurate signature. 
  
estimate(src, dst) [source]
 
Estimate the transformation from a set of corresponding points. You can determine the over-, well- and under-determined parameters with the total least-squares method. Number of source and destination coordinates must match.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.    Returns 
 
successbool 

True, if model estimation succeeds.     
  
property rotation 
  
property translation
estimate(src, dst) [source]
 
Estimate the transformation from a set of corresponding points. You can determine the over-, well- and under-determined parameters with the total least-squares method. Number of source and destination coordinates must match.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.    Returns 
 
successbool 

True, if model estimation succeeds.
__init__(matrix=None, rotation=None, translation=None) [source]
 
Initialize self. See help(type(self)) for accurate signature.
skimage.transform.frt2(a) [source]
 
Compute the 2-dimensional finite radon transform (FRT) for an n x n integer array.  Parameters 
 
aarray_like 

A 2-D square n x n integer array.    Returns 
 
FRT2-D ndarray 

Finite Radon Transform array of (n+1) x n integer coefficients.      See also  
ifrt2


The two-dimensional inverse FRT.    Notes The FRT has a unique inverse if and only if n is prime. [FRT] The idea for this algorithm is due to Vlad Negnevitski. References  
FRT  
A. Kingston and I. Svalbe, “Projective transforms on periodic discrete image arrays,” in P. Hawkes (Ed), Advances in Imaging and Electron Physics, 139 (2006)   Examples Generate a test image: Use a prime number for the array dimensions >>> SIZE = 59
>>> img = np.tri(SIZE, dtype=np.int32)
 Apply the Finite Radon Transform: >>> f = frt2(img)
class skimage.transform.FundamentalMatrixTransform(matrix=None) [source]
 
Bases: skimage.transform._geometric.GeometricTransform Fundamental matrix transformation. The fundamental matrix relates corresponding points between a pair of uncalibrated images. The matrix transforms homogeneous image points in one image to epipolar lines in the other image. The fundamental matrix is only defined for a pair of moving images. In the case of pure rotation or planar scenes, the homography describes the geometric relation between two images (ProjectiveTransform). If the intrinsic calibration of the images is known, the essential matrix describes the metric relation between the two images (EssentialMatrixTransform).  Parameters 
 
matrix(3, 3) array, optional 

Fundamental matrix.     References  
1  
Hartley, Richard, and Andrew Zisserman. Multiple view geometry in computer vision. Cambridge university press, 2003.    Attributes 
 
params(3, 3) array 

Fundamental matrix.      
__init__(matrix=None) [source]
 
Initialize self. See help(type(self)) for accurate signature. 
  
estimate(src, dst) [source]
 
Estimate fundamental matrix using 8-point algorithm. The 8-point algorithm requires at least 8 corresponding point pairs for a well-conditioned solution, otherwise the over-determined solution is estimated.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.    Returns 
 
successbool 

True, if model estimation succeeds.     
  
inverse(coords) [source]
 
Apply inverse transformation.  Parameters 
 
coords(N, 2) array 

Destination coordinates.    Returns 
 
coords(N, 3) array 

Epipolar lines in the source image.     
  
residuals(src, dst) [source]
 
Compute the Sampson distance. The Sampson distance is the first approximation to the geometric error.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.    Returns 
 
residuals(N, ) array 

Sampson distance.
estimate(src, dst) [source]
 
Estimate fundamental matrix using 8-point algorithm. The 8-point algorithm requires at least 8 corresponding point pairs for a well-conditioned solution, otherwise the over-determined solution is estimated.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.    Returns 
 
successbool 

True, if model estimation succeeds.
inverse(coords) [source]
 
Apply inverse transformation.  Parameters 
 
coords(N, 2) array 

Destination coordinates.    Returns 
 
coords(N, 3) array 

Epipolar lines in the source image.
residuals(src, dst) [source]
 
Compute the Sampson distance. The Sampson distance is the first approximation to the geometric error.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.    Returns 
 
residuals(N, ) array 

Sampson distance.
__init__(matrix=None) [source]
 
Initialize self. See help(type(self)) for accurate signature.
skimage.transform.hough_circle(image, radius, normalize=True, full_output=False) [source]
 
Perform a circular Hough transform.  Parameters 
 
image(M, N) ndarray 

Input image with nonzero values representing edges.  
radiusscalar or sequence of scalars 

Radii at which to compute the Hough transform. Floats are converted to integers.  
normalizeboolean, optional (default True) 

Normalize the accumulator with the number of pixels used to draw the radius.  
full_outputboolean, optional (default False) 

Extend the output size by twice the largest radius in order to detect centers outside the input picture.    Returns 
 
H3D ndarray (radius index, (M + 2R, N + 2R) ndarray) 

Hough transform accumulator for each radius. R designates the larger radius if full_output is True. Otherwise, R = 0.     Examples >>> from skimage.transform import hough_circle
>>> from skimage.draw import circle_perimeter
>>> img = np.zeros((100, 100), dtype=bool)
>>> rr, cc = circle_perimeter(25, 35, 23)
>>> img[rr, cc] = 1
>>> try_radii = np.arange(5, 50)
>>> res = hough_circle(img, try_radii)
>>> ridx, r, c = np.unravel_index(np.argmax(res), res.shape)
>>> r, c, try_radii[ridx]
(25, 35, 23)
skimage.transform.hough_circle_peaks(hspaces, radii, min_xdistance=1, min_ydistance=1, threshold=None, num_peaks=inf, total_num_peaks=inf, normalize=False) [source]
 
Return peaks in a circle Hough transform. Identifies most prominent circles separated by certain distances in given Hough spaces. Non-maximum suppression with different sizes is applied separately in the first and second dimension of the Hough space to identify peaks. For circles with different radius but close in distance, only the one with highest peak is kept.  Parameters 
 
hspaces(N, M) array 

Hough spaces returned by the hough_circle function.  
radii(M,) array 

Radii corresponding to Hough spaces.  
min_xdistanceint, optional 

Minimum distance separating centers in the x dimension.  
min_ydistanceint, optional 

Minimum distance separating centers in the y dimension.  
thresholdfloat, optional 

Minimum intensity of peaks in each Hough space. Default is 0.5 * max(hspace).  
num_peaksint, optional 

Maximum number of peaks in each Hough space. When the number of peaks exceeds num_peaks, only num_peaks coordinates based on peak intensity are considered for the corresponding radius.  
total_num_peaksint, optional 

Maximum number of peaks. When the number of peaks exceeds num_peaks, return num_peaks coordinates based on peak intensity.  
normalizebool, optional 

If True, normalize the accumulator by the radius to sort the prominent peaks.    Returns 
 
accum, cx, cy, radtuple of array 

Peak values in Hough space, x and y center coordinates and radii.     Notes Circles with bigger radius have higher peaks in Hough space. If larger circles are preferred over smaller ones, normalize should be False. Otherwise, circles will be returned in the order of decreasing voting number. Examples >>> from skimage import transform, draw
>>> img = np.zeros((120, 100), dtype=int)
>>> radius, x_0, y_0 = (20, 99, 50)
>>> y, x = draw.circle_perimeter(y_0, x_0, radius)
>>> img[x, y] = 1
>>> hspaces = transform.hough_circle(img, radius)
>>> accum, cx, cy, rad = hough_circle_peaks(hspaces, [radius,])