neulab/docprompting-conala huggingface dataset:
skimage.transform.hough_ellipse(image, threshold=4, accuracy=1, min_size=4, max_size=None) [source]
 
Perform an elliptical Hough transform.  Parameters 
 
image(M, N) ndarray 

Input image with nonzero values representing edges.  
thresholdint, optional 

Accumulator threshold value.  
accuracydouble, optional 

Bin size on the minor axis used in the accumulator.  
min_sizeint, optional 

Minimal major axis length.  
max_sizeint, optional 

Maximal minor axis length. If None, the value is set to the half of the smaller image dimension.    Returns 
 
resultndarray with fields [(accumulator, yc, xc, a, b, orientation)]. 

Where (yc, xc) is the center, (a, b) the major and minor axes, respectively. The orientation value follows skimage.draw.ellipse_perimeter convention.     Notes The accuracy must be chosen to produce a peak in the accumulator distribution. In other words, a flat accumulator distribution with low values may be caused by a too low bin size. References  
1  
Xie, Yonghong, and Qiang Ji. “A new efficient ellipse detection method.” Pattern Recognition, 2002. Proceedings. 16th International Conference on. Vol. 2. IEEE, 2002   Examples >>> from skimage.transform import hough_ellipse
>>> from skimage.draw import ellipse_perimeter
>>> img = np.zeros((25, 25), dtype=np.uint8)
>>> rr, cc = ellipse_perimeter(10, 10, 6, 8)
>>> img[cc, rr] = 1
>>> result = hough_ellipse(img, threshold=8)
>>> result.tolist()
[(10, 10.0, 10.0, 8.0, 6.0, 0.0)]
skimage.transform.hough_line(image, theta=None) [source]
 
Perform a straight line Hough transform.  Parameters 
 
image(M, N) ndarray 

Input image with nonzero values representing edges.  
theta1D ndarray of double, optional 

Angles at which to compute the transform, in radians. Defaults to a vector of 180 angles evenly spaced from -pi/2 to pi/2.    Returns 
 
hspace2-D ndarray of uint64 

Hough transform accumulator.  
anglesndarray 

Angles at which the transform is computed, in radians.  
distancesndarray 

Distance values.     Notes The origin is the top left corner of the original image. X and Y axis are horizontal and vertical edges respectively. The distance is the minimal algebraic distance from the origin to the detected line. The angle accuracy can be improved by decreasing the step size in the theta array. Examples Generate a test image: >>> img = np.zeros((100, 150), dtype=bool)
>>> img[30, :] = 1
>>> img[:, 65] = 1
>>> img[35:45, 35:50] = 1
>>> for i in range(90):
...     img[i, i] = 1
>>> img += np.random.random(img.shape) > 0.95
 Apply the Hough transform: >>> out, angles, d = hough_line(img)
 import numpy as np
import matplotlib.pyplot as plt

from skimage.transform import hough_line
from skimage.draw import line

img = np.zeros((100, 150), dtype=bool)
img[30, :] = 1
img[:, 65] = 1
img[35:45, 35:50] = 1
rr, cc = line(60, 130, 80, 10)
img[rr, cc] = 1
img += np.random.random(img.shape) > 0.95

out, angles, d = hough_line(img)

fix, axes = plt.subplots(1, 2, figsize=(7, 4))

axes[0].imshow(img, cmap=plt.cm.gray)
axes[0].set_title('Input image')

axes[1].imshow(
    out, cmap=plt.cm.bone,
    extent=(np.rad2deg(angles[-1]), np.rad2deg(angles[0]), d[-1], d[0]))
axes[1].set_title('Hough transform')
axes[1].set_xlabel('Angle (degree)')
axes[1].set_ylabel('Distance (pixel)')

plt.tight_layout()
plt.show()
 (Source code, png, pdf)
skimage.transform.hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10, threshold=None, num_peaks=inf) [source]
 
Return peaks in a straight line Hough transform. Identifies most prominent lines separated by a certain angle and distance in a Hough transform. Non-maximum suppression with different sizes is applied separately in the first (distances) and second (angles) dimension of the Hough space to identify peaks.  Parameters 
 
hspace(N, M) array 

Hough space returned by the hough_line function.  
angles(M,) array 

Angles returned by the hough_line function. Assumed to be continuous. (angles[-1] - angles[0] == PI).  
dists(N, ) array 

Distances returned by the hough_line function.  
min_distanceint, optional 

Minimum distance separating lines (maximum filter size for first dimension of hough space).  
min_angleint, optional 

Minimum angle separating lines (maximum filter size for second dimension of hough space).  
thresholdfloat, optional 

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

Maximum number of peaks. When the number of peaks exceeds num_peaks, return num_peaks coordinates based on peak intensity.    Returns 
 
accum, angles, diststuple of array 

Peak values in Hough space, angles and distances.     Examples >>> from skimage.transform import hough_line, hough_line_peaks
>>> from skimage.draw import line
>>> img = np.zeros((15, 15), dtype=bool)
>>> rr, cc = line(0, 0, 14, 14)
>>> img[rr, cc] = 1
>>> rr, cc = line(0, 14, 14, 0)
>>> img[cc, rr] = 1
>>> hspace, angles, dists = hough_line(img)
>>> hspace, angles, dists = hough_line_peaks(hspace, angles, dists)
>>> len(angles)
2
skimage.transform.ifrt2(a) [source]
 
Compute the 2-dimensional inverse finite radon transform (iFRT) for an (n+1) x n integer array.  Parameters 
 
aarray_like 

A 2-D (n+1) row x n column integer array.    Returns 
 
iFRT2-D n x n ndarray 

Inverse Finite Radon Transform array of n x n integer coefficients.      See also  
frt2


The two-dimensional FRT    Notes The FRT has a unique inverse if and only if n is prime. See [1] for an overview. The idea for this algorithm is due to Vlad Negnevitski. References  
1  
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 >>> SIZE = 59
>>> img = np.tri(SIZE, dtype=np.int32)
 Apply the Finite Radon Transform: >>> f = frt2(img)
 Apply the Inverse Finite Radon Transform to recover the input >>> fi = ifrt2(f)
 Check that it’s identical to the original >>> assert len(np.nonzero(img-fi)[0]) == 0
skimage.transform.integral_image(image) [source]
 
Integral image / summed area table. The integral image contains the sum of all elements above and to the left of it, i.e.:  \[S[m, n] = \sum_{i \leq m} \sum_{j \leq n} X[i, j]\]  Parameters 
 
imagendarray 

Input image.    Returns 
 
Sndarray 

Integral image/summed area table of same shape as input image.     References  
1  
F.C. Crow, “Summed-area tables for texture mapping,” ACM SIGGRAPH Computer Graphics, vol. 18, 1984, pp. 207-212.
skimage.transform.integrate(ii, start, end) [source]
 
Use an integral image to integrate over a given window.  Parameters 
 
iindarray 

Integral image.  
startList of tuples, each tuple of length equal to dimension of ii 

Coordinates of top left corner of window(s). Each tuple in the list contains the starting row, col, … index i.e [(row_win1, col_win1, …), (row_win2, col_win2,…), …].  
endList of tuples, each tuple of length equal to dimension of ii 

Coordinates of bottom right corner of window(s). Each tuple in the list containing the end row, col, … index i.e [(row_win1, col_win1, …), (row_win2, col_win2, …), …].    Returns 
 
Sscalar or ndarray 

Integral (sum) over the given window(s).     Examples >>> arr = np.ones((5, 6), dtype=float)
>>> ii = integral_image(arr)
>>> integrate(ii, (1, 0), (1, 2))  # sum from (1, 0) to (1, 2)
array([3.])
>>> integrate(ii, [(3, 3)], [(4, 5)])  # sum from (3, 3) to (4, 5)
array([6.])
>>> # sum from (1, 0) to (1, 2) and from (3, 3) to (4, 5)
>>> integrate(ii, [(1, 0), (3, 3)], [(1, 2), (4, 5)])
array([3., 6.])
skimage.transform.iradon(radon_image, theta=None, output_size=None, filter_name='ramp', interpolation='linear', circle=True, preserve_range=True) [source]
 
Inverse radon transform. Reconstruct an image from the radon transform, using the filtered back projection algorithm.  Parameters 
 
radon_imagearray 

Image containing radon transform (sinogram). Each column of the image corresponds to a projection along a different angle. The tomography rotation axis should lie at the pixel index radon_image.shape[0] // 2 along the 0th dimension of radon_image.  
thetaarray_like, optional 

Reconstruction angles (in degrees). Default: m angles evenly spaced between 0 and 180 (if the shape of radon_image is (N, M)).  
output_sizeint, optional 

Number of rows and columns in the reconstruction.  
filter_namestr, optional 

Filter used in frequency domain filtering. Ramp filter used by default. Filters available: ramp, shepp-logan, cosine, hamming, hann. Assign None to use no filter.  
interpolationstr, optional 

Interpolation method used in reconstruction. Methods available: ‘linear’, ‘nearest’, and ‘cubic’ (‘cubic’ is slow).  
circleboolean, optional 

Assume the reconstructed image is zero outside the inscribed circle. Also changes the default output_size to match the behaviour of radon called with circle=True.  
preserve_rangebool, optional 

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    Returns 
 
reconstructedndarray 

Reconstructed image. The rotation axis will be located in the pixel with indices (reconstructed.shape[0] // 2, reconstructed.shape[1] // 2).    Changed in version 0.19: In iradon, filter argument is deprecated in favor of filter_name.    Notes It applies the Fourier slice theorem to reconstruct an image by multiplying the frequency domain of the filter with the FFT of the projection data. This algorithm is called filtered back projection. References  
1  
AC Kak, M Slaney, “Principles of Computerized Tomographic Imaging”, IEEE Press 1988.  
2  
B.R. Ramesh, N. Srinivasa, K. Rajgopal, “An Algorithm for Computing the Discrete Radon Transform With Some Applications”, Proceedings of the Fourth IEEE Region 10 International Conference, TENCON ‘89, 1989
skimage.transform.matrix_transform(coords, matrix) [source]
 
Apply 2D matrix transform.  Parameters 
 
coords(N, 2) array 

x, y coordinates to transform  
matrix(3, 3) array 

Homogeneous transformation matrix.    Returns 
 
coords(N, 2) array 

Transformed coordinates.
skimage.transform.order_angles_golden_ratio(theta) [source]
 
Order angles to reduce the amount of correlated information in subsequent projections.  Parameters 
 
theta1D array of floats 

Projection angles in degrees. Duplicate angles are not allowed.    Returns 
 
indices_generatorgenerator yielding unsigned integers 

The returned generator yields indices into theta such that theta[indices] gives the approximate golden ratio ordering of the projections. In total, len(theta) indices are yielded. All non-negative integers < len(theta) are yielded exactly once.     Notes The method used here is that of the golden ratio introduced by T. Kohler. References  
1  
Kohler, T. “A projection access scheme for iterative reconstruction based on the golden section.” Nuclear Science Symposium Conference Record, 2004 IEEE. Vol. 6. IEEE, 2004.  
2  
Winkelmann, Stefanie, et al. “An optimal radial profile order based on the Golden Ratio for time-resolved MRI.” Medical Imaging, IEEE Transactions on 26.1 (2007): 68-76.
class skimage.transform.PiecewiseAffineTransform [source]
 
Bases: skimage.transform._geometric.GeometricTransform 2D piecewise affine transformation. Control points are used to define the mapping. The transform is based on a Delaunay triangulation of the points to form a mesh. Each triangle is used to find a local affine transform.  Attributes 
 
affineslist of AffineTransform objects 

Affine transformations for each triangle in the mesh.  
inverse_affineslist of AffineTransform objects 

Inverse affine transformations for each triangle in the mesh.      
__init__() [source]
 
Initialize self. See help(type(self)) for accurate signature. 
  
estimate(src, dst) [source]
 
Estimate the transformation from a set of corresponding points. 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.     
  
inverse(coords) [source]
 
Apply inverse transformation. Coordinates outside of the mesh will be set to - 1.  Parameters 
 
coords(N, 2) array 

Source coordinates.    Returns 
 
coords(N, 2) array 

Transformed coordinates.
estimate(src, dst) [source]
 
Estimate the transformation from a set of corresponding points. 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.
inverse(coords) [source]
 
Apply inverse transformation. Coordinates outside of the mesh will be set to - 1.  Parameters 
 
coords(N, 2) array 

Source coordinates.    Returns 
 
coords(N, 2) array 

Transformed coordinates.
class skimage.transform.PolynomialTransform(params=None) [source]
 
Bases: skimage.transform._geometric.GeometricTransform 2D polynomial transformation. Has the following form: X = sum[j=0:order]( sum[i=0:j]( a_ji * x**(j - i) * y**i ))
Y = sum[j=0:order]( sum[i=0:j]( b_ji * x**(j - i) * y**i ))
  Parameters 
 
params(2, N) array, optional 

Polynomial coefficients where N * 2 = (order + 1) * (order + 2). So, a_ji is defined in params[0, :] and b_ji in params[1, :].    Attributes 
 
params(2, N) array 

Polynomial coefficients where N * 2 = (order + 1) * (order + 2). So, a_ji is defined in params[0, :] and b_ji in params[1, :].      
__init__(params=None) [source]
 
Initialize self. See help(type(self)) for accurate signature. 
  
estimate(src, dst, order=2) [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. The transformation is defined as: X = sum[j=0:order]( sum[i=0:j]( a_ji * x**(j - i) * y**i ))
Y = sum[j=0:order]( sum[i=0:j]( b_ji * x**(j - i) * y**i ))
 These equations can be transformed to the following form: 0 = sum[j=0:order]( sum[i=0:j]( a_ji * x**(j - i) * y**i )) - X
0 = sum[j=0:order]( sum[i=0:j]( b_ji * x**(j - i) * y**i )) - Y
 which exist for each set of corresponding points, so we have a set of N * 2 equations. The coefficients appear linearly so we can write A x = 0, where: A   = [[1 x y x**2 x*y y**2 ... 0 ...             0 -X]
       [0 ...                 0 1 x y x**2 x*y y**2 -Y]
        ...
        ...
      ]
x.T = [a00 a10 a11 a20 a21 a22 ... ann
       b00 b10 b11 b20 b21 b22 ... bnn c3]
 In case of total least-squares the solution of this homogeneous system of equations is the right singular vector of A which corresponds to the smallest singular value normed by the coefficient c3.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.  
orderint, optional 

Polynomial order (number of coefficients is order + 1).    Returns 
 
successbool 

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

Destination coordinates.    Returns 
 
coords(N, 2) array 

Source coordinates.
estimate(src, dst, order=2) [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. The transformation is defined as: X = sum[j=0:order]( sum[i=0:j]( a_ji * x**(j - i) * y**i ))
Y = sum[j=0:order]( sum[i=0:j]( b_ji * x**(j - i) * y**i ))
 These equations can be transformed to the following form: 0 = sum[j=0:order]( sum[i=0:j]( a_ji * x**(j - i) * y**i )) - X
0 = sum[j=0:order]( sum[i=0:j]( b_ji * x**(j - i) * y**i )) - Y
 which exist for each set of corresponding points, so we have a set of N * 2 equations. The coefficients appear linearly so we can write A x = 0, where: A   = [[1 x y x**2 x*y y**2 ... 0 ...             0 -X]
       [0 ...                 0 1 x y x**2 x*y y**2 -Y]
        ...
        ...
      ]
x.T = [a00 a10 a11 a20 a21 a22 ... ann
       b00 b10 b11 b20 b21 b22 ... bnn c3]
 In case of total least-squares the solution of this homogeneous system of equations is the right singular vector of A which corresponds to the smallest singular value normed by the coefficient c3.  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.  
orderint, optional 

Polynomial order (number of coefficients is order + 1).    Returns 
 
successbool 

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

Destination coordinates.    Returns 
 
coords(N, 2) array 

Source coordinates.
__init__(params=None) [source]
 
Initialize self. See help(type(self)) for accurate signature.
skimage.transform.probabilistic_hough_line(image, threshold=10, line_length=50, line_gap=10, theta=None, seed=None) [source]
 
Return lines from a progressive probabilistic line Hough transform.  Parameters 
 
image(M, N) ndarray 

Input image with nonzero values representing edges.  
thresholdint, optional 

Threshold  
line_lengthint, optional 

Minimum accepted length of detected lines. Increase the parameter to extract longer lines.  
line_gapint, optional 

Maximum gap between pixels to still form a line. Increase the parameter to merge broken lines more aggressively.  
theta1D ndarray, dtype=double, optional 

Angles at which to compute the transform, in radians. If None, use a range from -pi/2 to pi/2.  
seedint, optional 

Seed to initialize the random number generator.    Returns 
 
lineslist 

List of lines identified, lines in format ((x0, y0), (x1, y1)), indicating line start and end.     References  
1  
C. Galamhos, J. Matas and J. Kittler, “Progressive probabilistic Hough transform for line detection”, in IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 1999.
class skimage.transform.ProjectiveTransform(matrix=None) [source]
 
Bases: skimage.transform._geometric.GeometricTransform Projective transformation. Apply a projective transformation (homography) on coordinates. For each homogeneous coordinate \(\mathbf{x} = [x, y, 1]^T\), its target position is calculated by multiplying with the given matrix, \(H\), to give \(H \mathbf{x}\): [[a0 a1 a2]
 [b0 b1 b2]
 [c0 c1 1 ]].
 E.g., to rotate by theta degrees clockwise, the matrix should be: [[cos(theta) -sin(theta) 0]
 [sin(theta)  cos(theta) 0]
 [0            0         1]]
 or, to translate x by 10 and y by 20: [[1 0 10]
 [0 1 20]
 [0 0 1 ]].
  Parameters 
 
matrix(3, 3) array, optional 

Homogeneous transformation matrix.    Attributes 
 
params(3, 3) array 

Homogeneous transformation matrix.      
__init__(matrix=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. The transformation is defined as: X = (a0*x + a1*y + a2) / (c0*x + c1*y + 1)
Y = (b0*x + b1*y + b2) / (c0*x + c1*y + 1)
 These equations can be transformed to the following form: 0 = a0*x + a1*y + a2 - c0*x*X - c1*y*X - X
0 = b0*x + b1*y + b2 - c0*x*Y - c1*y*Y - Y
 which exist for each set of corresponding points, so we have a set of N * 2 equations. The coefficients appear linearly so we can write A x = 0, where: A   = [[x y 1 0 0 0 -x*X -y*X -X]
       [0 0 0 x y 1 -x*Y -y*Y -Y]
        ...
        ...
      ]
x.T = [a0 a1 a2 b0 b1 b2 c0 c1 c3]
 In case of total least-squares the solution of this homogeneous system of equations is the right singular vector of A which corresponds to the smallest singular value normed by the coefficient c3. In case of the affine transformation the coefficients c0 and c1 are 0. Thus the system of equations is: A   = [[x y 1 0 0 0 -X]
       [0 0 0 x y 1 -Y]
        ...
        ...
      ]
x.T = [a0 a1 a2 b0 b1 b2 c3]
  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, 2) array 

Source coordinates.
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. The transformation is defined as: X = (a0*x + a1*y + a2) / (c0*x + c1*y + 1)
Y = (b0*x + b1*y + b2) / (c0*x + c1*y + 1)
 These equations can be transformed to the following form: 0 = a0*x + a1*y + a2 - c0*x*X - c1*y*X - X
0 = b0*x + b1*y + b2 - c0*x*Y - c1*y*Y - Y
 which exist for each set of corresponding points, so we have a set of N * 2 equations. The coefficients appear linearly so we can write A x = 0, where: A   = [[x y 1 0 0 0 -x*X -y*X -X]
       [0 0 0 x y 1 -x*Y -y*Y -Y]
        ...
        ...
      ]
x.T = [a0 a1 a2 b0 b1 b2 c0 c1 c3]
 In case of total least-squares the solution of this homogeneous system of equations is the right singular vector of A which corresponds to the smallest singular value normed by the coefficient c3. In case of the affine transformation the coefficients c0 and c1 are 0. Thus the system of equations is: A   = [[x y 1 0 0 0 -X]
       [0 0 0 x y 1 -Y]
        ...
        ...
      ]
x.T = [a0 a1 a2 b0 b1 b2 c3]
  Parameters 
 
src(N, 2) array 

Source coordinates.  
dst(N, 2) array 

Destination coordinates.    Returns 
 
successbool 

True, if model estimation succeeds.
skimage.transform.pyramid_expand(image, upscale=2, sigma=None, order=1, mode='reflect', cval=0, multichannel=False, preserve_range=False) [source]
 
Upsample and then smooth image.  Parameters 
 
imagendarray 

Input image.  
upscalefloat, optional 

Upscale factor.  
sigmafloat, optional 

Sigma for Gaussian filter. Default is 2 * upscale / 6.0 which corresponds to a filter mask twice the size of the scale factor that covers more than 99% of the Gaussian distribution.  
orderint, optional 

Order of splines used in interpolation of upsampling. See skimage.transform.warp for detail.  
mode{‘reflect’, ‘constant’, ‘edge’, ‘symmetric’, ‘wrap’}, optional 

The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’.  
cvalfloat, optional 

Value to fill past edges of input if mode is ‘constant’.  
multichannelbool, optional 

Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.  
preserve_rangebool, optional 

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    Returns 
 
outarray 

Upsampled and smoothed float image.     References  
1  
http://persci.mit.edu/pub_pdfs/pyramid83.pdf