Multidimensional image processing (cupyx.scipy.ndimage
)#
Filters#
|
Multi-dimensional convolution. |
|
One-dimensional convolution. |
|
Multi-dimensional correlate. |
|
One-dimensional correlate. |
|
Multi-dimensional Gaussian filter. |
|
One-dimensional Gaussian filter along the given axis. |
|
Multi-dimensional gradient magnitude using Gaussian derivatives. |
|
Multi-dimensional Laplace filter using Gaussian second derivatives. |
|
Compute a multi-dimensional filter using the provided raw kernel or reduction kernel. |
|
Compute a 1D filter along the given axis using the provided raw kernel. |
|
Multi-dimensional gradient magnitude filter using a provided derivative function. |
|
Multi-dimensional Laplace filter using a provided second derivative function. |
|
Multi-dimensional Laplace filter based on approximate second derivatives. |
|
Multi-dimensional maximum filter. |
|
Compute the maximum filter along a single axis. |
|
Multi-dimensional median filter. |
|
Multi-dimensional minimum filter. |
|
Compute the minimum filter along a single axis. |
|
Multi-dimensional percentile filter. |
|
Compute a Prewitt filter along the given axis. |
|
Multi-dimensional rank filter. |
|
Compute a Sobel filter along the given axis. |
|
Multi-dimensional uniform filter. |
|
One-dimensional uniform filter along the given axis. |
Fourier filters#
|
Multidimensional ellipsoid Fourier filter. |
|
Multidimensional Gaussian shift filter. |
|
Multidimensional Fourier shift filter. |
|
Multidimensional uniform shift filter. |
Interpolation#
|
Apply an affine transformation. |
|
Map the input array to new coordinates by interpolation. |
|
Rotate an array. |
|
Shift an array. |
|
Multidimensional spline filter. |
|
Calculate a 1-D spline filter along the given axis. |
|
Zoom an array. |
Measurements#
|
Calculate the center of mass of the values of an array at labels. |
|
Calculate the minimums and maximums of the values of an array at labels, along with their positions. |
|
Calculate the histogram of the values of an array, optionally at labels. |
|
Labels features in an array. |
|
Array resulting from applying |
|
Calculate the maximum of the values of an array over labeled regions. |
|
Find the positions of the maximums of the values of an array at labels. |
|
Calculates the mean of the values of an n-D image array, optionally |
|
Calculate the median of the values of an array over labeled regions. |
|
Calculate the minimum of the values of an array over labeled regions. |
|
Find the positions of the minimums of the values of an array at labels. |
|
Calculates the standard deviation of the values of an n-D image array, optionally at specified sub-regions. |
|
Calculates the sum of the values of an n-D image array, optionally |
|
Find indices of each distinct value in given array. |
|
Calculates the variance of the values of an n-D image array, optionally at specified sub-regions. |
Morphology#
|
Multidimensional binary closing with the given structuring element. |
|
Multidimensional binary dilation with the given structuring element. |
|
Multidimensional binary erosion with a given structuring element. |
|
Fill the holes in binary objects. |
|
Multidimensional binary hit-or-miss transform. |
|
Multidimensional binary opening with the given structuring element. |
|
Multidimensional binary propagation with the given structuring element. |
|
Multidimensional black tophat filter. |
|
Exact Euclidean distance transform. |
|
Generate a binary structure for binary morphological operations. |
|
Calculates a multi-dimensional greyscale closing. |
|
Calculates a greyscale dilation. |
|
Calculates a greyscale erosion. |
|
Calculates a multi-dimensional greyscale opening. |
|
Iterate a structure by dilating it with itself. |
|
Multidimensional morphological gradient. |
|
Multidimensional morphological laplace. |
|
Multidimensional white tophat filter. |
OpenCV mode#
cupyx.scipy.ndimage
supports additional mode, opencv
.
If it is given, the function performs like cv2.warpAffine or cv2.resize. Example:
import cupyx.scipy.ndimage
import cupy as cp
import cv2
im = cv2.imread('TODO') # pls fill in your image path
trans_mat = cp.eye(4)
trans_mat[0][0] = trans_mat[1][1] = 0.5
smaller_shape = (im.shape[0] // 2, im.shape[1] // 2, 3)
smaller = cp.zeros(smaller_shape) # preallocate memory for resized image
cupyx.scipy.ndimage.affine_transform(im, trans_mat, output_shape=smaller_shape,
output=smaller, mode='opencv')
cv2.imwrite('smaller.jpg', cp.asnumpy(smaller)) # smaller image saved locally