skimage.transform.downscale_local_mean(…)
Down-sample N-dimensional image by local averaging.
skimage.transform.estimate_transform(ttype, …)
Estimate 2D geometric transformation parameters.
skimage.transform.frt2(a)
Compute the 2-dimensional finite radon transform (FRT) for an n x n integer array.
skimage.transform.hough_circle(image, radius)
Perform a circular Hough transform.
skimage.transform.hough_circle_peaks(…[, …])
Return peaks in a circle Hough transform.
skimage.transform.hough_ellipse(image[, …])
Perform an elliptical Hough transform.
skimage.transform.hough_line(image[, theta])
Perform a straight line Hough transform.
skimage.transform.hough_line_peaks(hspace, …)
Return peaks in a straight line Hough transform.
skimage.transform.ifrt2(a)
Compute the 2-dimensional inverse finite radon transform (iFRT) for an (n+1) x n integer array.
skimage.transform.integral_image(image)
Integral image / summed area table.
skimage.transform.integrate(ii, start, end)
Use an integral image to integrate over a given window.
skimage.transform.iradon(radon_image[, …])
Inverse radon transform.
skimage.transform.iradon_sart(radon_image[, …])
Inverse radon transform.
skimage.transform.matrix_transform(coords, …)
Apply 2D matrix transform.
skimage.transform.order_angles_golden_ratio(theta)
Order angles to reduce the amount of correlated information in subsequent projections.
skimage.transform.probabilistic_hough_line(image)
Return lines from a progressive probabilistic line Hough transform.
skimage.transform.pyramid_expand(image[, …])
Upsample and then smooth image.
skimage.transform.pyramid_gaussian(image[, …])
Yield images of the Gaussian pyramid formed by the input image.
skimage.transform.pyramid_laplacian(image[, …])
Yield images of the laplacian pyramid formed by the input image.
skimage.transform.pyramid_reduce(image[, …])
Smooth and then downsample image.
skimage.transform.radon(image[, theta, …])
Calculates the radon transform of an image given specified projection angles.
skimage.transform.rescale(image, scale[, …])
Scale image by a certain factor.
skimage.transform.resize(image, output_shape)
Resize image to match a certain size.
skimage.transform.rotate(image, angle[, …])
Rotate image by a certain angle around its center.
skimage.transform.swirl(image[, center, …])
Perform a swirl transformation.
skimage.transform.warp(image, inverse_map[, …])
Warp an image according to a given coordinate transformation.
skimage.transform.warp_coords(coord_map, shape)
Build the source coordinates for the output of a 2-D image warp.
skimage.transform.warp_polar(image[, …])
Remap image to polar or log-polar coordinates space.
skimage.transform.AffineTransform([matrix, …])
2D affine transformation.
skimage.transform.EssentialMatrixTransform([…])
Essential matrix transformation.
skimage.transform.EuclideanTransform([…])
2D Euclidean transformation.
skimage.transform.FundamentalMatrixTransform([…])
Fundamental matrix transformation.
skimage.transform.PiecewiseAffineTransform()
2D piecewise affine transformation.
skimage.transform.PolynomialTransform([params])
2D polynomial transformation.
skimage.transform.ProjectiveTransform([matrix])
Projective transformation.
skimage.transform.SimilarityTransform([…])
2D similarity transformation.
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.
N-dimensional input image.
Array containing down-sampling integer factor along each axis.
Constant padding value if image is not perfectly divisible by the integer factors.
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.)
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.
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.
Type of transform.
Function parameters (src, dst, n, angle):
Also see examples below.
Transform object containing the transformation parameters and providing access to forward and inverse transformation functions.
Compute the 2-dimensional finite radon transform (FRT) for an n x n integer array.
A 2-D square n x n integer array.
Finite Radon Transform array of (n+1) x n integer coefficients.
See also
The two-dimensional inverse FRT.
The FRT has a unique inverse if and only if n is prime. [FRT] The idea for this algorithm is due to Vlad Negnevitski.
A. Kingston and I. Svalbe, “Projective transforms on periodic discrete image arrays,” in P. Hawkes (Ed), Advances in Imaging and Electron Physics, 139 (2006)
Generate a test image: Use a prime number for the array dimensions
Apply the Finite Radon Transform:
Perform a circular Hough transform.
Input image with nonzero values representing edges.
Radii at which to compute the Hough transform. Floats are converted to integers.
Normalize the accumulator with the number of pixels used to draw the radius.
Extend the output size by twice the largest radius in order to detect centers outside the input picture.
Hough transform accumulator for each radius. R designates the larger radius if full_output is True. Otherwise, R = 0.
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.
Hough spaces returned by the hough_circle function.
Radii corresponding to Hough spaces.
Minimum distance separating centers in the x dimension.
Minimum distance separating centers in the y dimension.
Minimum intensity of peaks in each Hough space. Default is 0.5 * max(hspace).
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.
Maximum number of peaks. When the number of peaks exceeds num_peaks, return num_peaks coordinates based on peak intensity.
If True, normalize the accumulator by the radius to sort the prominent peaks.
Peak values in Hough space, x and y center coordinates and radii.
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.
Perform an elliptical Hough transform.
Input image with nonzero values representing edges.
Accumulator threshold value.
Bin size on the minor axis used in the accumulator.
Minimal major axis length.
Maximal minor axis length. If None, the value is set to the half of the smaller image dimension.
Where (yc, xc) is the center, (a, b) the major and minor axes, respectively. The orientation value follows skimage.draw.ellipse_perimeter convention.
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.
Xie, Yonghong, and Qiang Ji. “A new efficient ellipse detection method.” Pattern Recognition, 2002. Proceedings. 16th International Conference on. Vol. 2. IEEE, 2002
Perform a straight line Hough transform.
Input image with nonzero values representing edges.
Angles at which to compute the transform, in radians. Defaults to a vector of 180 angles evenly spaced from -pi/2 to pi/2.
Hough transform accumulator.
Angles at which the transform is computed, in radians.
Distance values.
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.
Generate a test image:
Apply the Hough transform:
(Source code, png, pdf)
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.
Hough space returned by the hough_line function.
Angles returned by the hough_line function. Assumed to be continuous. (angles[-1] - angles[0] == PI).
Distances returned by the hough_line function.
Minimum distance separating lines (maximum filter size for first dimension of hough space).
Minimum angle separating lines (maximum filter size for second dimension of hough space).
Minimum intensity of peaks. Default is 0.5 * max(hspace).
Maximum number of peaks. When the number of peaks exceeds num_peaks, return num_peaks coordinates based on peak intensity.
Peak values in Hough space, angles and distances.
Compute the 2-dimensional inverse finite radon transform (iFRT) for an (n+1) x n integer array.
A 2-D (n+1) row x n column integer array.
Inverse Finite Radon Transform array of n x n integer coefficients.
See also
The two-dimensional FRT
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.
A. Kingston and I. Svalbe, “Projective transforms on periodic discrete image arrays,” in P. Hawkes (Ed), Advances in Imaging and Electron Physics, 139 (2006)
Apply the Finite Radon Transform:
Apply the Inverse Finite Radon Transform to recover the input
Check that it’s identical to the original
Integral image / summed area table.
The integral image contains the sum of all elements above and to the left of it, i.e.:
Input image.
Integral image/summed area table of same shape as input image.
F.C. Crow, “Summed-area tables for texture mapping,” ACM SIGGRAPH Computer Graphics, vol. 18, 1984, pp. 207-212.
Use an integral image to integrate over a given window.
Integral image.
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,…), …].
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, …), …].
Integral (sum) over the given window(s).
Inverse radon transform.
Reconstruct an image from the radon transform, using the filtered back projection algorithm.
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.
Reconstruction angles (in degrees). Default: m angles evenly spaced between 0 and 180 (if the shape of radon_image is (N, M)).
Number of rows and columns in the reconstruction.
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.
Interpolation method used in reconstruction. Methods available: ‘linear’, ‘nearest’, and ‘cubic’ (‘cubic’ is slow).
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.
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
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.
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.
AC Kak, M Slaney, “Principles of Computerized Tomographic Imaging”, IEEE Press 1988.
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
Inverse radon transform.
Reconstruct an image from the radon transform, using a single iteration of the Simultaneous Algebraic Reconstruction Technique (SART) algorithm.
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.
Reconstruction angles (in degrees). Default: m angles evenly spaced between 0 and 180 (if the shape of radon_image is (N, M)).
Image containing an initial reconstruction estimate. Shape of this array should be (radon_image.shape[0], radon_image.shape[0]). The default is an array of zeros.
Shift the projections contained in radon_image (the sinogram) by this many pixels before reconstructing the image. The i’th value defines the shift of the i’th column of radon_image.
Force all values in the reconstructed tomogram to lie in the range [clip[0], clip[1]]
Relaxation parameter for the update step. A higher value can improve the convergence rate, but one runs the risk of instabilities. Values close to or higher than 1 are not recommended.
Output data type, must be floating point. By default, if input data type is not float, input is cast to double, otherwise dtype is set to input data type.
Reconstructed image. The rotation axis will be located in the pixel with indices (reconstructed.shape[0] // 2, reconstructed.shape[1] // 2).
Algebraic Reconstruction Techniques are based on formulating the tomography reconstruction problem as a set of linear equations. Along each ray, the projected value is the sum of all the values of the cross section along the ray. A typical feature of SART (and a few other variants of algebraic techniques) is that it samples the cross section at equidistant points along the ray, using linear interpolation between the pixel values of the cross section. The resulting set of linear equations are then solved using a slightly modified Kaczmarz method.
When using SART, a single iteration is usually sufficient to obtain a good reconstruction. Further iterations will tend to enhance high-frequency information, but will also often increase the noise.
AC Kak, M Slaney, “Principles of Computerized Tomographic Imaging”, IEEE Press 1988.
AH Andersen, AC Kak, “Simultaneous algebraic reconstruction technique (SART): a superior implementation of the ART algorithm”, Ultrasonic Imaging 6 pp 81–94 (1984)
S Kaczmarz, “Angenäherte auflösung von systemen linearer gleichungen”, Bulletin International de l’Academie Polonaise des Sciences et des Lettres 35 pp 355–357 (1937)
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.
Kaczmarz’ method, Wikipedia, https://en.wikipedia.org/wiki/Kaczmarz_method
Apply 2D matrix transform.
x, y coordinates to transform
Homogeneous transformation matrix.
Transformed coordinates.
Order angles to reduce the amount of correlated information in subsequent projections.
Projection angles in degrees. Duplicate angles are not allowed.
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.
The method used here is that of the golden ratio introduced by T. Kohler.
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.
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.
Return lines from a progressive probabilistic line Hough transform.
Input image with nonzero values representing edges.
Threshold
Minimum accepted length of detected lines. Increase the parameter to extract longer lines.
Maximum gap between pixels to still form a line. Increase the parameter to merge broken lines more aggressively.
Angles at which to compute the transform, in radians. If None, use a range from -pi/2 to pi/2.
Seed to initialize the random number generator.
List of lines identified, lines in format ((x0, y0), (x1, y1)), indicating line start and end.
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.
Upsample and then smooth image.
Input image.
Upscale factor.
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.
Order of splines used in interpolation of upsampling. See skimage.transform.warp for detail.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’.
Value to fill past edges of input if mode is ‘constant’.
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
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
Upsampled and smoothed float image.
http://persci.mit.edu/pub_pdfs/pyramid83.pdf
Yield images of the Gaussian pyramid formed by the input image.
Recursively applies the pyramid_reduce function to the image, and yields the downscaled images.
Note that the first image of the pyramid will be the original, unscaled image. The total number of images is max_layer + 1. In case all layers are computed, the last image is either a one-pixel image or the image where the reduction does not change its shape.
Input image.
Number of layers for the pyramid. 0th layer is the original image. Default is -1 which builds all possible layers.
Downscale factor.
Sigma for Gaussian filter. Default is 2 * downscale / 6.0 which corresponds to a filter mask twice the size of the scale factor that covers more than 99% of the Gaussian distribution.
Order of splines used in interpolation of downsampling. See skimage.transform.warp for detail.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’.
Value to fill past edges of input if mode is ‘constant’.
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
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
Generator yielding pyramid layers as float images.
http://persci.mit.edu/pub_pdfs/pyramid83.pdf
Yield images of the laplacian pyramid formed by the input image.
Each layer contains the difference between the downsampled and the downsampled, smoothed image:
Note that the first image of the pyramid will be the difference between the original, unscaled image and its smoothed version. The total number of images is max_layer + 1. In case all layers are computed, the last image is either a one-pixel image or the image where the reduction does not change its shape.
Input image.
Number of layers for the pyramid. 0th layer is the original image. Default is -1 which builds all possible layers.
Downscale factor.
Sigma for Gaussian filter. Default is 2 * downscale / 6.0 which corresponds to a filter mask twice the size of the scale factor that covers more than 99% of the Gaussian distribution.
Order of splines used in interpolation of downsampling. See skimage.transform.warp for detail.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’.
Value to fill past edges of input if mode is ‘constant’.
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
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
Generator yielding pyramid layers as float images.
http://persci.mit.edu/pub_pdfs/pyramid83.pdf
http://sepwww.stanford.edu/data/media/public/sep/morgan/texturematch/paper_html/node3.html
Smooth and then downsample image.
Input image.
Downscale factor.
Sigma for Gaussian filter. Default is 2 * downscale / 6.0 which corresponds to a filter mask twice the size of the scale factor that covers more than 99% of the Gaussian distribution.
Order of splines used in interpolation of downsampling. See skimage.transform.warp for detail.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’.
Value to fill past edges of input if mode is ‘constant’.
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
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
Smoothed and downsampled float image.
http://persci.mit.edu/pub_pdfs/pyramid83.pdf
Calculates the radon transform of an image given specified projection angles.
Input image. The rotation axis will be located in the pixel with indices (image.shape[0] // 2, image.shape[1] // 2).
Projection angles (in degrees). If None, the value is set to np.arange(180).
Assume image is zero outside the inscribed circle, making the width of each projection (the first dimension of the sinogram) equal to min(image.shape).
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
Radon transform (sinogram). The tomography rotation axis will lie at the pixel index radon_image.shape[0] // 2 along the 0th dimension of radon_image.
Based on code of Justin K. Romberg (https://www.clear.rice.edu/elec431/projects96/DSP/bpanalysis.html)
AC Kak, M Slaney, “Principles of Computerized Tomographic Imaging”, IEEE Press 1988.
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
Scale image by a certain factor.
Performs interpolation to up-scale or down-scale N-dimensional images. Note that anti-aliasing should be enabled when down-sizing images to avoid aliasing artifacts. For down-sampling with an integer factor also see skimage.transform.downscale_local_mean.
Input image.
Scale factors. Separate scale factors can be defined as (rows, cols[, …][, dim]).
Scaled version of the input.
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
Whether to apply a Gaussian filter to smooth the image prior to down-scaling. It is crucial to filter when down-sampling the image to avoid aliasing artifacts. If input image data type is bool, no anti-aliasing is applied.
Standard deviation for Gaussian filtering to avoid aliasing artifacts. By default, this value is chosen as (s - 1) / 2 where s is the down-scaling factor.
Modes ‘reflect’ and ‘symmetric’ are similar, but differ in whether the edge pixels are duplicated during the reflection. As an example, if an array has values [0, 1, 2] and was padded to the right by four values using symmetric, the result would be [0, 1, 2, 2, 1, 0, 0], while for reflect it would be [0, 1, 2, 1, 0, 1, 2].
Resize image to match a certain size.
Performs interpolation to up-size or down-size N-dimensional images. Note that anti-aliasing should be enabled when down-sizing images to avoid aliasing artifacts. For down-sampling with an integer factor also see skimage.transform.downscale_local_mean.
Input image.
Size of the generated output image (rows, cols[, …][, dim]). If dim is not provided, the number of channels is preserved. In case the number of input channels does not equal the number of output channels a n-dimensional interpolation is applied.
Resized version of the input.
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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
Whether to apply a Gaussian filter to smooth the image prior to down-scaling. It is crucial to filter when down-sampling the image to avoid aliasing artifacts. If input image data type is bool, no anti-aliasing is applied.
Standard deviation for Gaussian filtering to avoid aliasing artifacts. By default, this value is chosen as (s - 1) / 2 where s is the down-scaling factor, where s > 1. For the up-size case, s < 1, no anti-aliasing is performed prior to rescaling.
Modes ‘reflect’ and ‘symmetric’ are similar, but differ in whether the edge pixels are duplicated during the reflection. As an example, if an array has values [0, 1, 2] and was padded to the right by four values using symmetric, the result would be [0, 1, 2, 2, 1, 0, 0], while for reflect it would be [0, 1, 2, 1, 0, 1, 2].
Rotate image by a certain angle around its center.
Input image.
Rotation angle in degrees in counter-clockwise direction.
Determine whether the shape of the output image will be automatically calculated, so the complete rotated image exactly fits. Default is False.
The rotation center. If center=None, the image is rotated around its center, i.e. center=(cols / 2 - 0.5, rows / 2 - 0.5). Please note that this parameter is (cols, rows), contrary to normal skimage ordering.
Rotated version of the input.
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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
Modes ‘reflect’ and ‘symmetric’ are similar, but differ in whether the edge pixels are duplicated during the reflection. As an example, if an array has values [0, 1, 2] and was padded to the right by four values using symmetric, the result would be [0, 1, 2, 2, 1, 0, 0], while for reflect it would be [0, 1, 2, 1, 0, 1, 2].
Different perimeters
Measure region properties
Perform a swirl transformation.
Input image.
Center coordinate of transformation.
The amount of swirling applied.
The extent of the swirl in pixels. The effect dies out rapidly beyond radius.
Additional rotation applied to the image.
Swirled version of the input.
Shape of the output image generated. By default the shape of the input image is preserved.
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
Points outside the boundaries of the input are filled according to the given mode, with ‘constant’ used as the default. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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
Warp an image according to a given coordinate transformation.
Input image.
Inverse coordinate map, which transforms coordinates in the output images into their corresponding coordinates in the input image.
There are a number of different options to define this map, depending on the dimensionality of the input image. A 2-D image can have 2 dimensions for gray-scale images, or 3 dimensions with color information.
Note, that a (3, 3) matrix is interpreted as a homogeneous transformation matrix, so you cannot interpolate values from a 3-D input, if the output is of shape (3,).
See example section for usage.
Keyword arguments passed to inverse_map.
Shape of the output image generated. By default the shape of the input image is preserved. Note that, even for multi-band images, only rows and columns need to be specified.
Default is 0 if image.dtype is bool and 1 otherwise.
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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
The warped input image.
The following image warps are all equal but differ substantially in execution time. The image is shifted to the bottom.
Use a geometric transform to warp an image (fast):
Use a callable (slow):
Use a transformation matrix to warp an image (fast):
You can also use the inverse of a geometric transformation (fast):
For N-D images you can pass a coordinate array, that specifies the coordinates in the input image for every element in the output image. E.g. if you want to rescale a 3-D cube, you can do:
Setup the coordinate array, that defines the scaling:
Assume that the cube contains spatial data, where the first array element center is at coordinate (0.5, 0.5, 0.5) in real space, i.e. we have to account for this extra offset when scaling the image:
Registration using optical flow
Build the source coordinates for the output of a 2-D image warp.
Return input coordinates for given output coordinates. Coordinates are in the shape (P, 2), where P is the number of coordinates and each element is a (row, col) pair.
Shape of output image (rows, cols[, bands]).
dtype for return value (sane choices: float32 or float64).
Coordinates for scipy.ndimage.map_coordinates, that will yield an image of shape (orows, ocols, bands) by drawing from source points according to the coord_transform_fn.
This is a lower-level routine that produces the source coordinates for 2-D images used by warp().
It is provided separately from warp to give additional flexibility to users who would like, for example, to re-use a particular coordinate mapping, to use specific dtypes at various points along the the image-warping process, or to implement different post-processing logic than warp performs after the call to ndi.map_coordinates.
Produce a coordinate map that shifts an image up and to the right:
Remap image to polar or log-polar coordinates space.
Input image. Only 2-D arrays are accepted by default. If multichannel=True, 3-D arrays are accepted and the last axis is interpreted as multiple channels.
Point in image that represents the center of the transformation (i.e., the origin in cartesian space). Values can be of type float. If no value is given, the center is assumed to be the center point of the image.
Radius of the circle that bounds the area to be transformed.
Specify whether the image warp is polar or log-polar. Defaults to ‘linear’.
Whether the image is a 3-D array in which the third axis is to be interpreted as multiple channels. If set to False (default), only 2-D arrays are accepted.
Passed to transform.warp.
The polar or log-polar warped image.
Perform a basic polar warp on a grayscale image:
Perform a log-polar warp on a grayscale image:
Perform a log-polar warp on a grayscale image while specifying center, radius, and output shape:
Perform a log-polar warp on a color image:
Bases: skimage.transform._geometric.ProjectiveTransform
2D affine transformation.
Has the following form:
where sx and sy are scale factors in the x and y directions, and the homogeneous transformation matrix is:
Homogeneous transformation matrix.
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.
Rotation angle in counter-clockwise direction as radians.
Shear angle in counter-clockwise direction as radians.
Translation parameters.
Homogeneous transformation matrix.
Initialize self. See help(type(self)) for accurate signature.
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).
Rotation matrix of the relative camera motion.
Translation vector of the relative camera motion. The vector must have unit length.
Essential matrix.
Hartley, Richard, and Andrew Zisserman. Multiple view geometry in computer vision. Cambridge university press, 2003.
Essential matrix.
Initialize self. See help(type(self)) for accurate signature.
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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.
Bases: skimage.transform._geometric.ProjectiveTransform
2D Euclidean transformation.
Has the following form:
where the homogeneous transformation matrix is:
The Euclidean transformation is a rigid transformation with rotation and translation parameters. The similarity transformation extends the Euclidean transformation with a single scaling factor.
Homogeneous transformation matrix.
Rotation angle in counter-clockwise direction as radians.
x, y translation parameters.
Homogeneous transformation matrix.
Initialize self. See help(type(self)) for accurate signature.
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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.
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).
Fundamental matrix.
Hartley, Richard, and Andrew Zisserman. Multiple view geometry in computer vision. Cambridge university press, 2003.
Fundamental matrix.
Initialize self. See help(type(self)) for accurate signature.
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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.
Apply inverse transformation.
Destination coordinates.
Epipolar lines in the source image.
Compute the Sampson distance.
The Sampson distance is the first approximation to the geometric error.
Source coordinates.
Destination coordinates.
Sampson distance.
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.
Affine transformations for each triangle in the mesh.
Inverse affine transformations for each triangle in the mesh.
Initialize self. See help(type(self)) for accurate signature.
Estimate the transformation from a set of corresponding points.
Number of source and destination coordinates must match.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.
Apply inverse transformation.
Coordinates outside of the mesh will be set to - 1.
Source coordinates.
Transformed coordinates.
Bases: skimage.transform._geometric.GeometricTransform
2D polynomial transformation.
Has the following form:
Polynomial coefficients where N * 2 = (order + 1) * (order + 2). So, a_ji is defined in params[0, :] and b_ji in params[1, :].
Polynomial coefficients where N * 2 = (order + 1) * (order + 2). So, a_ji is defined in params[0, :] and b_ji in params[1, :].
Initialize self. See help(type(self)) for accurate signature.
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:
These equations can be transformed to the following form:
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:
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.
Source coordinates.
Destination coordinates.
Polynomial order (number of coefficients is order + 1).
True, if model estimation succeeds.
Apply inverse transformation.
Destination coordinates.
Source coordinates.
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}\):
E.g., to rotate by theta degrees clockwise, the matrix should be:
or, to translate x by 10 and y by 20:
Homogeneous transformation matrix.
Homogeneous transformation matrix.
Initialize self. See help(type(self)) for accurate signature.
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:
These equations can be transformed to the following form:
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:
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:
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.
Apply inverse transformation.
Destination coordinates.
Source coordinates.
Bases: skimage.transform._geometric.EuclideanTransform
2D similarity transformation.
Has the following form:
where s is a scale factor and the homogeneous transformation matrix is:
The similarity transformation extends the Euclidean transformation with a single scaling factor in addition to the rotation and translation parameters.
Homogeneous transformation matrix.
Scale factor.
Rotation angle in counter-clockwise direction as radians.
x, y translation parameters.
Homogeneous transformation matrix.
Initialize self. See help(type(self)) for accurate signature.
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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


Bases: skimage.transform._geometric.ProjectiveTransform
2D affine transformation.
Has the following form:
where sx and sy are scale factors in the x and y directions, and the homogeneous transformation matrix is:
Homogeneous transformation matrix.
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.
Rotation angle in counter-clockwise direction as radians.
Shear angle in counter-clockwise direction as radians.
Translation parameters.
Homogeneous transformation matrix.
Initialize self. See help(type(self)) for accurate signature.


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


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.
N-dimensional input image.
Array containing down-sampling integer factor along each axis.
Constant padding value if image is not perfectly divisible by the integer factors.
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.)
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.


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).
Rotation matrix of the relative camera motion.
Translation vector of the relative camera motion. The vector must have unit length.
Essential matrix.
Hartley, Richard, and Andrew Zisserman. Multiple view geometry in computer vision. Cambridge university press, 2003.
Essential matrix.
Initialize self. See help(type(self)) for accurate signature.
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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


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.
Type of transform.
Function parameters (src, dst, n, angle):
Also see examples below.
Transform object containing the transformation parameters and providing access to forward and inverse transformation functions.


Bases: skimage.transform._geometric.ProjectiveTransform
2D Euclidean transformation.
Has the following form:
where the homogeneous transformation matrix is:
The Euclidean transformation is a rigid transformation with rotation and translation parameters. The similarity transformation extends the Euclidean transformation with a single scaling factor.
Homogeneous transformation matrix.
Rotation angle in counter-clockwise direction as radians.
x, y translation parameters.
Homogeneous transformation matrix.
Initialize self. See help(type(self)) for accurate signature.
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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


Compute the 2-dimensional finite radon transform (FRT) for an n x n integer array.
A 2-D square n x n integer array.
Finite Radon Transform array of (n+1) x n integer coefficients.
See also
The two-dimensional inverse FRT.
The FRT has a unique inverse if and only if n is prime. [FRT] The idea for this algorithm is due to Vlad Negnevitski.
A. Kingston and I. Svalbe, “Projective transforms on periodic discrete image arrays,” in P. Hawkes (Ed), Advances in Imaging and Electron Physics, 139 (2006)
Generate a test image: Use a prime number for the array dimensions
Apply the Finite Radon Transform:


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).
Fundamental matrix.
Hartley, Richard, and Andrew Zisserman. Multiple view geometry in computer vision. Cambridge university press, 2003.
Fundamental matrix.
Initialize self. See help(type(self)) for accurate signature.
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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.
Apply inverse transformation.
Destination coordinates.
Epipolar lines in the source image.
Compute the Sampson distance.
The Sampson distance is the first approximation to the geometric error.
Source coordinates.
Destination coordinates.
Sampson distance.


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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


Apply inverse transformation.
Destination coordinates.
Epipolar lines in the source image.


Compute the Sampson distance.
The Sampson distance is the first approximation to the geometric error.
Source coordinates.
Destination coordinates.
Sampson distance.


Perform a circular Hough transform.
Input image with nonzero values representing edges.
Radii at which to compute the Hough transform. Floats are converted to integers.
Normalize the accumulator with the number of pixels used to draw the radius.
Extend the output size by twice the largest radius in order to detect centers outside the input picture.
Hough transform accumulator for each radius. R designates the larger radius if full_output is True. Otherwise, R = 0.


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.
Hough spaces returned by the hough_circle function.
Radii corresponding to Hough spaces.
Minimum distance separating centers in the x dimension.
Minimum distance separating centers in the y dimension.
Minimum intensity of peaks in each Hough space. Default is 0.5 * max(hspace).
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.
Maximum number of peaks. When the number of peaks exceeds num_peaks, return num_peaks coordinates based on peak intensity.
If True, normalize the accumulator by the radius to sort the prominent peaks.
Peak values in Hough space, x and y center coordinates and radii.
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.


Perform an elliptical Hough transform.
Input image with nonzero values representing edges.
Accumulator threshold value.
Bin size on the minor axis used in the accumulator.
Minimal major axis length.
Maximal minor axis length. If None, the value is set to the half of the smaller image dimension.
Where (yc, xc) is the center, (a, b) the major and minor axes, respectively. The orientation value follows skimage.draw.ellipse_perimeter convention.
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.
Xie, Yonghong, and Qiang Ji. “A new efficient ellipse detection method.” Pattern Recognition, 2002. Proceedings. 16th International Conference on. Vol. 2. IEEE, 2002


Perform a straight line Hough transform.
Input image with nonzero values representing edges.
Angles at which to compute the transform, in radians. Defaults to a vector of 180 angles evenly spaced from -pi/2 to pi/2.
Hough transform accumulator.
Angles at which the transform is computed, in radians.
Distance values.
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.
Generate a test image:
Apply the Hough transform:
(Source code, png, pdf)


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.
Hough space returned by the hough_line function.
Angles returned by the hough_line function. Assumed to be continuous. (angles[-1] - angles[0] == PI).
Distances returned by the hough_line function.
Minimum distance separating lines (maximum filter size for first dimension of hough space).
Minimum angle separating lines (maximum filter size for second dimension of hough space).
Minimum intensity of peaks. Default is 0.5 * max(hspace).
Maximum number of peaks. When the number of peaks exceeds num_peaks, return num_peaks coordinates based on peak intensity.
Peak values in Hough space, angles and distances.


Compute the 2-dimensional inverse finite radon transform (iFRT) for an (n+1) x n integer array.
A 2-D (n+1) row x n column integer array.
Inverse Finite Radon Transform array of n x n integer coefficients.
See also
The two-dimensional FRT
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.
A. Kingston and I. Svalbe, “Projective transforms on periodic discrete image arrays,” in P. Hawkes (Ed), Advances in Imaging and Electron Physics, 139 (2006)
Apply the Finite Radon Transform:
Apply the Inverse Finite Radon Transform to recover the input
Check that it’s identical to the original


Integral image / summed area table.
The integral image contains the sum of all elements above and to the left of it, i.e.:
Input image.
Integral image/summed area table of same shape as input image.
F.C. Crow, “Summed-area tables for texture mapping,” ACM SIGGRAPH Computer Graphics, vol. 18, 1984, pp. 207-212.


Use an integral image to integrate over a given window.
Integral image.
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,…), …].
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, …), …].
Integral (sum) over the given window(s).


Inverse radon transform.
Reconstruct an image from the radon transform, using the filtered back projection algorithm.
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.
Reconstruction angles (in degrees). Default: m angles evenly spaced between 0 and 180 (if the shape of radon_image is (N, M)).
Number of rows and columns in the reconstruction.
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.
Interpolation method used in reconstruction. Methods available: ‘linear’, ‘nearest’, and ‘cubic’ (‘cubic’ is slow).
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.
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
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.
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.
AC Kak, M Slaney, “Principles of Computerized Tomographic Imaging”, IEEE Press 1988.
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


Inverse radon transform.
Reconstruct an image from the radon transform, using a single iteration of the Simultaneous Algebraic Reconstruction Technique (SART) algorithm.
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.
Reconstruction angles (in degrees). Default: m angles evenly spaced between 0 and 180 (if the shape of radon_image is (N, M)).
Image containing an initial reconstruction estimate. Shape of this array should be (radon_image.shape[0], radon_image.shape[0]). The default is an array of zeros.
Shift the projections contained in radon_image (the sinogram) by this many pixels before reconstructing the image. The i’th value defines the shift of the i’th column of radon_image.
Force all values in the reconstructed tomogram to lie in the range [clip[0], clip[1]]
Relaxation parameter for the update step. A higher value can improve the convergence rate, but one runs the risk of instabilities. Values close to or higher than 1 are not recommended.
Output data type, must be floating point. By default, if input data type is not float, input is cast to double, otherwise dtype is set to input data type.
Reconstructed image. The rotation axis will be located in the pixel with indices (reconstructed.shape[0] // 2, reconstructed.shape[1] // 2).
Algebraic Reconstruction Techniques are based on formulating the tomography reconstruction problem as a set of linear equations. Along each ray, the projected value is the sum of all the values of the cross section along the ray. A typical feature of SART (and a few other variants of algebraic techniques) is that it samples the cross section at equidistant points along the ray, using linear interpolation between the pixel values of the cross section. The resulting set of linear equations are then solved using a slightly modified Kaczmarz method.
When using SART, a single iteration is usually sufficient to obtain a good reconstruction. Further iterations will tend to enhance high-frequency information, but will also often increase the noise.
AC Kak, M Slaney, “Principles of Computerized Tomographic Imaging”, IEEE Press 1988.
AH Andersen, AC Kak, “Simultaneous algebraic reconstruction technique (SART): a superior implementation of the ART algorithm”, Ultrasonic Imaging 6 pp 81–94 (1984)
S Kaczmarz, “Angenäherte auflösung von systemen linearer gleichungen”, Bulletin International de l’Academie Polonaise des Sciences et des Lettres 35 pp 355–357 (1937)
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.
Kaczmarz’ method, Wikipedia, https://en.wikipedia.org/wiki/Kaczmarz_method


Apply 2D matrix transform.
x, y coordinates to transform
Homogeneous transformation matrix.
Transformed coordinates.


Order angles to reduce the amount of correlated information in subsequent projections.
Projection angles in degrees. Duplicate angles are not allowed.
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.
The method used here is that of the golden ratio introduced by T. Kohler.
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.
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.


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.
Affine transformations for each triangle in the mesh.
Inverse affine transformations for each triangle in the mesh.
Initialize self. See help(type(self)) for accurate signature.
Estimate the transformation from a set of corresponding points.
Number of source and destination coordinates must match.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.
Apply inverse transformation.
Coordinates outside of the mesh will be set to - 1.
Source coordinates.
Transformed coordinates.


Estimate the transformation from a set of corresponding points.
Number of source and destination coordinates must match.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


Apply inverse transformation.
Coordinates outside of the mesh will be set to - 1.
Source coordinates.
Transformed coordinates.


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


Bases: skimage.transform._geometric.GeometricTransform
2D polynomial transformation.
Has the following form:
Polynomial coefficients where N * 2 = (order + 1) * (order + 2). So, a_ji is defined in params[0, :] and b_ji in params[1, :].
Polynomial coefficients where N * 2 = (order + 1) * (order + 2). So, a_ji is defined in params[0, :] and b_ji in params[1, :].
Initialize self. See help(type(self)) for accurate signature.
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:
These equations can be transformed to the following form:
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:
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.
Source coordinates.
Destination coordinates.
Polynomial order (number of coefficients is order + 1).
True, if model estimation succeeds.
Apply inverse transformation.
Destination coordinates.
Source coordinates.


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:
These equations can be transformed to the following form:
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:
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.
Source coordinates.
Destination coordinates.
Polynomial order (number of coefficients is order + 1).
True, if model estimation succeeds.


Apply inverse transformation.
Destination coordinates.
Source coordinates.


Return lines from a progressive probabilistic line Hough transform.
Input image with nonzero values representing edges.
Threshold
Minimum accepted length of detected lines. Increase the parameter to extract longer lines.
Maximum gap between pixels to still form a line. Increase the parameter to merge broken lines more aggressively.
Angles at which to compute the transform, in radians. If None, use a range from -pi/2 to pi/2.
Seed to initialize the random number generator.
List of lines identified, lines in format ((x0, y0), (x1, y1)), indicating line start and end.
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.


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}\):
E.g., to rotate by theta degrees clockwise, the matrix should be:
or, to translate x by 10 and y by 20:
Homogeneous transformation matrix.
Homogeneous transformation matrix.
Initialize self. See help(type(self)) for accurate signature.
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:
These equations can be transformed to the following form:
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:
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:
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.
Apply inverse transformation.
Destination coordinates.
Source coordinates.


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:
These equations can be transformed to the following form:
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:
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:
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


Upsample and then smooth image.
Input image.
Upscale factor.
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.
Order of splines used in interpolation of upsampling. See skimage.transform.warp for detail.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’.
Value to fill past edges of input if mode is ‘constant’.
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
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
Upsampled and smoothed float image.
http://persci.mit.edu/pub_pdfs/pyramid83.pdf


Yield images of the Gaussian pyramid formed by the input image.
Recursively applies the pyramid_reduce function to the image, and yields the downscaled images.
Note that the first image of the pyramid will be the original, unscaled image. The total number of images is max_layer + 1. In case all layers are computed, the last image is either a one-pixel image or the image where the reduction does not change its shape.
Input image.
Number of layers for the pyramid. 0th layer is the original image. Default is -1 which builds all possible layers.
Downscale factor.
Sigma for Gaussian filter. Default is 2 * downscale / 6.0 which corresponds to a filter mask twice the size of the scale factor that covers more than 99% of the Gaussian distribution.
Order of splines used in interpolation of downsampling. See skimage.transform.warp for detail.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’.
Value to fill past edges of input if mode is ‘constant’.
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
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
Generator yielding pyramid layers as float images.
http://persci.mit.edu/pub_pdfs/pyramid83.pdf


Yield images of the laplacian pyramid formed by the input image.
Each layer contains the difference between the downsampled and the downsampled, smoothed image:
Note that the first image of the pyramid will be the difference between the original, unscaled image and its smoothed version. The total number of images is max_layer + 1. In case all layers are computed, the last image is either a one-pixel image or the image where the reduction does not change its shape.
Input image.
Number of layers for the pyramid. 0th layer is the original image. Default is -1 which builds all possible layers.
Downscale factor.
Sigma for Gaussian filter. Default is 2 * downscale / 6.0 which corresponds to a filter mask twice the size of the scale factor that covers more than 99% of the Gaussian distribution.
Order of splines used in interpolation of downsampling. See skimage.transform.warp for detail.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’.
Value to fill past edges of input if mode is ‘constant’.
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
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
Generator yielding pyramid layers as float images.
http://persci.mit.edu/pub_pdfs/pyramid83.pdf
http://sepwww.stanford.edu/data/media/public/sep/morgan/texturematch/paper_html/node3.html


Smooth and then downsample image.
Input image.
Downscale factor.
Sigma for Gaussian filter. Default is 2 * downscale / 6.0 which corresponds to a filter mask twice the size of the scale factor that covers more than 99% of the Gaussian distribution.
Order of splines used in interpolation of downsampling. See skimage.transform.warp for detail.
The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’.
Value to fill past edges of input if mode is ‘constant’.
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
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
Smoothed and downsampled float image.
http://persci.mit.edu/pub_pdfs/pyramid83.pdf


Calculates the radon transform of an image given specified projection angles.
Input image. The rotation axis will be located in the pixel with indices (image.shape[0] // 2, image.shape[1] // 2).
Projection angles (in degrees). If None, the value is set to np.arange(180).
Assume image is zero outside the inscribed circle, making the width of each projection (the first dimension of the sinogram) equal to min(image.shape).
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
Radon transform (sinogram). The tomography rotation axis will lie at the pixel index radon_image.shape[0] // 2 along the 0th dimension of radon_image.
Based on code of Justin K. Romberg (https://www.clear.rice.edu/elec431/projects96/DSP/bpanalysis.html)
AC Kak, M Slaney, “Principles of Computerized Tomographic Imaging”, IEEE Press 1988.
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


Scale image by a certain factor.
Performs interpolation to up-scale or down-scale N-dimensional images. Note that anti-aliasing should be enabled when down-sizing images to avoid aliasing artifacts. For down-sampling with an integer factor also see skimage.transform.downscale_local_mean.
Input image.
Scale factors. Separate scale factors can be defined as (rows, cols[, …][, dim]).
Scaled version of the input.
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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
Whether the last axis of the image is to be interpreted as multiple channels or another spatial dimension.
Whether to apply a Gaussian filter to smooth the image prior to down-scaling. It is crucial to filter when down-sampling the image to avoid aliasing artifacts. If input image data type is bool, no anti-aliasing is applied.
Standard deviation for Gaussian filtering to avoid aliasing artifacts. By default, this value is chosen as (s - 1) / 2 where s is the down-scaling factor.
Modes ‘reflect’ and ‘symmetric’ are similar, but differ in whether the edge pixels are duplicated during the reflection. As an example, if an array has values [0, 1, 2] and was padded to the right by four values using symmetric, the result would be [0, 1, 2, 2, 1, 0, 0], while for reflect it would be [0, 1, 2, 1, 0, 1, 2].


Resize image to match a certain size.
Performs interpolation to up-size or down-size N-dimensional images. Note that anti-aliasing should be enabled when down-sizing images to avoid aliasing artifacts. For down-sampling with an integer factor also see skimage.transform.downscale_local_mean.
Input image.
Size of the generated output image (rows, cols[, …][, dim]). If dim is not provided, the number of channels is preserved. In case the number of input channels does not equal the number of output channels a n-dimensional interpolation is applied.
Resized version of the input.
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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
Whether to apply a Gaussian filter to smooth the image prior to down-scaling. It is crucial to filter when down-sampling the image to avoid aliasing artifacts. If input image data type is bool, no anti-aliasing is applied.
Standard deviation for Gaussian filtering to avoid aliasing artifacts. By default, this value is chosen as (s - 1) / 2 where s is the down-scaling factor, where s > 1. For the up-size case, s < 1, no anti-aliasing is performed prior to rescaling.
Modes ‘reflect’ and ‘symmetric’ are similar, but differ in whether the edge pixels are duplicated during the reflection. As an example, if an array has values [0, 1, 2] and was padded to the right by four values using symmetric, the result would be [0, 1, 2, 2, 1, 0, 0], while for reflect it would be [0, 1, 2, 1, 0, 1, 2].


Rotate image by a certain angle around its center.
Input image.
Rotation angle in degrees in counter-clockwise direction.
Determine whether the shape of the output image will be automatically calculated, so the complete rotated image exactly fits. Default is False.
The rotation center. If center=None, the image is rotated around its center, i.e. center=(cols / 2 - 0.5, rows / 2 - 0.5). Please note that this parameter is (cols, rows), contrary to normal skimage ordering.
Rotated version of the input.
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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
Modes ‘reflect’ and ‘symmetric’ are similar, but differ in whether the edge pixels are duplicated during the reflection. As an example, if an array has values [0, 1, 2] and was padded to the right by four values using symmetric, the result would be [0, 1, 2, 2, 1, 0, 0], while for reflect it would be [0, 1, 2, 1, 0, 1, 2].


Bases: skimage.transform._geometric.EuclideanTransform
2D similarity transformation.
Has the following form:
where s is a scale factor and the homogeneous transformation matrix is:
The similarity transformation extends the Euclidean transformation with a single scaling factor in addition to the rotation and translation parameters.
Homogeneous transformation matrix.
Scale factor.
Rotation angle in counter-clockwise direction as radians.
x, y translation parameters.
Homogeneous transformation matrix.
Initialize self. See help(type(self)) for accurate signature.
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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


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.
Source coordinates.
Destination coordinates.
True, if model estimation succeeds.


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


Perform a swirl transformation.
Input image.
Center coordinate of transformation.
The amount of swirling applied.
The extent of the swirl in pixels. The effect dies out rapidly beyond radius.
Additional rotation applied to the image.
Swirled version of the input.
Shape of the output image generated. By default the shape of the input image is preserved.
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
Points outside the boundaries of the input are filled according to the given mode, with ‘constant’ used as the default. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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


Warp an image according to a given coordinate transformation.
Input image.
Inverse coordinate map, which transforms coordinates in the output images into their corresponding coordinates in the input image.
There are a number of different options to define this map, depending on the dimensionality of the input image. A 2-D image can have 2 dimensions for gray-scale images, or 3 dimensions with color information.
Note, that a (3, 3) matrix is interpreted as a homogeneous transformation matrix, so you cannot interpolate values from a 3-D input, if the output is of shape (3,).
See example section for usage.
Keyword arguments passed to inverse_map.
Shape of the output image generated. By default the shape of the input image is preserved. Note that, even for multi-band images, only rows and columns need to be specified.
Default is 0 if image.dtype is bool and 1 otherwise.
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
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
The warped input image.
The following image warps are all equal but differ substantially in execution time. The image is shifted to the bottom.
Use a geometric transform to warp an image (fast):
Use a callable (slow):
Use a transformation matrix to warp an image (fast):
You can also use the inverse of a geometric transformation (fast):
For N-D images you can pass a coordinate array, that specifies the coordinates in the input image for every element in the output image. E.g. if you want to rescale a 3-D cube, you can do:
Setup the coordinate array, that defines the scaling:
Assume that the cube contains spatial data, where the first array element center is at coordinate (0.5, 0.5, 0.5) in real space, i.e. we have to account for this extra offset when scaling the image:


Build the source coordinates for the output of a 2-D image warp.
Return input coordinates for given output coordinates. Coordinates are in the shape (P, 2), where P is the number of coordinates and each element is a (row, col) pair.
Shape of output image (rows, cols[, bands]).
dtype for return value (sane choices: float32 or float64).
Coordinates for scipy.ndimage.map_coordinates, that will yield an image of shape (orows, ocols, bands) by drawing from source points according to the coord_transform_fn.
This is a lower-level routine that produces the source coordinates for 2-D images used by warp().
It is provided separately from warp to give additional flexibility to users who would like, for example, to re-use a particular coordinate mapping, to use specific dtypes at various points along the the image-warping process, or to implement different post-processing logic than warp performs after the call to ndi.map_coordinates.
Produce a coordinate map that shifts an image up and to the right:


Remap image to polar or log-polar coordinates space.
Input image. Only 2-D arrays are accepted by default. If multichannel=True, 3-D arrays are accepted and the last axis is interpreted as multiple channels.
Point in image that represents the center of the transformation (i.e., the origin in cartesian space). Values can be of type float. If no value is given, the center is assumed to be the center point of the image.
Radius of the circle that bounds the area to be transformed.
Specify whether the image warp is polar or log-polar. Defaults to ‘linear’.
Whether the image is a 3-D array in which the third axis is to be interpreted as multiple channels. If set to False (default), only 2-D arrays are accepted.
Passed to transform.warp.
The polar or log-polar warped image.
Perform a basic polar warp on a grayscale image:
Perform a log-polar warp on a grayscale image:
Perform a log-polar warp on a grayscale image while specifying center, radius, and output shape:
Perform a log-polar warp on a color image: