Image processing functions.
arrayfire.image.
anisotropic_diffusion
(image, time_step, conductance, iterations, flux_function_type=<FLUX.QUADRATIC: 1>, diffusion_kind=<DIFFUSION.GRAD: 1>)[source]¶
Anisotropic smoothing filter.
The input image.
The time step used in solving the diffusion equation.
Controls conductance sensitivity in diffusion equation.
Number of times the diffusion step is performed.
Quadratic (af.FLUX.QUADRATIC)
Exponential (af.FLUX.EXPONENTIAL)
Gradient diffusion equation (af.DIFFUSION.GRAD)
Modified curvature diffusion equation (af.DIFFUSION.MCDE)
Anisotropically-smoothed output image.
arrayfire.image.
bilateral
(image, s_sigma, c_sigma, is_color=False)[source]¶
Apply bilateral filter to the image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Sigma value for the co-ordinate space.
Sigma value for the color space.
Specifies if the third dimension is 3rd channel (if True) or a batch (if False).
The image after the application of the bilateral filter.
arrayfire.image.
canny
(image, low_threshold, high_threshold=None, threshold_type=<CANNY_THRESHOLD.MANUAL: 0>, sobel_window=3, is_fast=False)[source]¶
Canny edge detector.
A 2 D arrayfire array representing an image
Can be one of: - af.CANNY_THRESHOLD.MANUAL - af.CANNY_THRESHOLD.AUTO_OTSU
Specifies the % of maximum in gradient image if threshold_type is MANUAL. Specifies the % of auto dervied high value if threshold_type is AUTO_OTSU.
Specifies the % of maximum in gradient image if threshold_type is MANUAL. Ignored if threshold_type is AUTO_OTSU
Specifies the size of sobel kernel when computing the gradient image.
A binary image containing the edges
arrayfire.image.
color_space
(image, to_type, from_type)[source]¶
Convert an image from one color space to another.
A multi dimensional array representing batch of images in from_type color space.
An enum for the destination color space.
An enum for the source color space.
An image in the to_type color space.
arrayfire.image.
confidenceCC
(image, seedx, seedy, radius, multiplier, iters, segmented_value)[source]¶
Find the confidence connected components in the image.
A 2 D arrayfire array representing an image. Expects non-integral type
An array with x-coordinates of seed points
An array with y-coordinates of seed points
The neighborhood region to be considered around each seed point
Controls the threshold range computed from the mean and variance of seed point neighborhoods
is number of iterations
the value to which output array valid pixels are set to.
Output array with resulting connected components
arrayfire.image.
dilate
(image, mask=None)[source]¶
Run image dilate on the image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Specifies the neighborhood of a pixel.
When None, a [3, 3] array of all ones is used.
The dilated image.
arrayfire.image.
dilate3
(volume, mask=None)[source]¶
Run volume dilate on a volume.
A 3 D arrayfire array representing a volume, or
A multi dimensional array representing batch of volumes.
Specifies the neighborhood of a pixel.
When None, a [3, 3, 3] array of all ones is used.
The dilated volume.
arrayfire.image.
erode
(image, mask=None)[source]¶
Run image erode on the image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Specifies the neighborhood of a pixel.
When None, a [3, 3] array of all ones is used.
The eroded image.
arrayfire.image.
erode3
(volume, mask=None)[source]¶
Run volume erode on the volume.
A 3 D arrayfire array representing an volume, or
A multi dimensional array representing batch of volumes.
Specifies the neighborhood of a pixel.
When None, a [3, 3, 3] array of all ones is used.
The eroded volume.
arrayfire.image.
gaussian_kernel
(rows, cols, sigma_r=None, sigma_c=None)[source]¶
Create a gaussian kernel with the given parameters.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
The number of rows in the gaussian kernel.
The number of columns in the gaussian kernel.
The sigma value along rows
If None, calculated as (0.25 * rows + 0.75)
The sigma value along columns
If None, calculated as (0.25 * cols + 0.75)
A gaussian kernel of size (rows, cols)
arrayfire.image.
gradient
(image)[source]¶
Find the horizontal and vertical gradients.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
dx containing the horizontal gradients of image.
dy containing the vertical gradients of image.
arrayfire.image.
gray2rgb
(image, r_factor=1.0, g_factor=1.0, b_factor=1.0)[source]¶
Convert Grayscale image to an RGB image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Scale factor for the red channel.
Scale factor for the green channel.
Scale factor for the blue channel.
An RGB image.
The channels are not coalesced, i.e. they appear along the third dimension.
arrayfire.image.
hist_equal
(image, hist)[source]¶
Equalize an image based on a histogram.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Containing the histogram of an image.
The equalized image.
arrayfire.image.
histogram
(image, nbins, min_val=None, max_val=None)[source]¶
Find the histogram of an image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Number of bins in the histogram.
The lower bound for the bin values.
If None, af.min(image) is used.
The upper bound for the bin values.
If None, af.max(image) is used.
Containing the histogram of the image.
arrayfire.image.
hsv2rgb
(image)[source]¶
Convert HSV image to RGB.
A 3 D arrayfire array representing an 3 channel image, or
A multi dimensional array representing batch of images.
A HSV image.
arrayfire.image.
inverseDeconv
(image, psf, gamma, algo=<ITERATIVE_DECONV.DEFAULT: 0>)[source]¶
Inverse deconvolution algorithm.
The blurred input image.
The kernel(point spread function) known to have caused the blur in the system.
is a user defined regularization constant
takes enum value of type af.INVERSE_DECONV indicating the inverse deconvolution algorithm to be used
sharp image estimate generated from the blurred input
arrayfire.image.
is_image_io_available
()[source]¶
Function to check if the arrayfire library was built with Image IO support.
arrayfire.image.
iterativeDeconv
(image, psf, iterations, relax_factor, algo=<ITERATIVE_DECONV.DEFAULT: 0>)[source]¶
Iterative deconvolution algorithm.
The blurred input image.
The kernel(point spread function) known to have caused the blur in the system.
Number of times the algorithm will run.
is the relaxation factor multiplied with distance of estimate from observed image.
takes enum value of type af.ITERATIVE_DECONV indicating the iterative deconvolution algorithm to be used
sharp image estimate generated from the blurred input
arrayfire.image.
load_image
(file_name, is_color=False)[source]¶
Load an image on the disk as an array.
Full path of the file name on disk.
Specifies if the image is loaded as 1 channel (if False) or 3 channel image (if True).
A 2 dimensional (1 channel) or 3 dimensional (3 channel) array containing the image.
arrayfire.image.
load_image_native
(file_name)[source]¶
Load an image on the disk as an array in native format.
Full path of the file name on disk.
A 2 dimensional (1 channel) or 3 dimensional (3 or 4 channel) array containing the image.
arrayfire.image.
maxfilt
(image, w_len=3, w_wid=3, edge_pad=<PAD.ZERO: 0>)[source]¶
Apply max filter for the image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
The length of the filter along the first dimension.
The length of the filter along the second dimension.
Flag specifying how the max at the edge should be treated.
The image after max filter is applied.
arrayfire.image.
mean_shift
(image, s_sigma, c_sigma, n_iter, is_color=False)[source]¶
Apply mean shift to the image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Sigma value for the co-ordinate space.
Sigma value for the color space.
Number of mean shift iterations.
Specifies if the third dimension is 3rd channel (if True) or a batch (if False).
The image after the application of the meanshift.
arrayfire.image.
minfilt
(image, w_len=3, w_wid=3, edge_pad=<PAD.ZERO: 0>)[source]¶
Apply min filter for the image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
The length of the filter along the first dimension.
The length of the filter along the second dimension.
Flag specifying how the min at the edge should be treated.
The image after min filter is applied.
arrayfire.image.
moments
(image, moment=<MOMENT.FIRST_ORDER: 15>)[source]¶
Calculate image moments.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Moment(s) to calculate. Can be one of: - af.MOMENT.M00 - af.MOMENT.M01 - af.MOMENT.M10 - af.MOMENT.M11 - af.MOMENT.FIRST_ORDER
array containing requested moment(s) of each image
arrayfire.image.
regions
(image, conn=<CONNECTIVITY.FOUR: 4>, out_type=<Dtype.f32: 0>)[source]¶
Find the connected components in the image.
A 2 D arrayfire array representing an image.
Specifies the connectivity of the pixels.
Specifies the type for the output.
An array where each pixel is labeled with its component number.
arrayfire.image.
resize
(image, scale=None, odim0=None, odim1=None, method=<INTERP.NEAREST: 0>)[source]¶
Resize an image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Scale factor for the image resizing.
Size of the first dimension of the output.
Size of the second dimension of the output.
Interpolation method used for resizing.
Output image after resizing.
arrayfire.image.
rgb2gray
(image, r_factor=0.2126, g_factor=0.7152, b_factor=0.0722)[source]¶
Convert RGB image to Grayscale.
A 3 D arrayfire array representing an 3 channel image, or
A multi dimensional array representing batch of images.
Weight for the red channel.
Weight for the green channel.
Weight for the blue channel.
A grayscale image.
arrayfire.image.
rgb2hsv
(image)[source]¶
Convert RGB image to HSV.
A 3 D arrayfire array representing an 3 channel image, or
A multi dimensional array representing batch of images.
A RGB image.
arrayfire.image.
rgb2ycbcr
(image, standard=<YCC_STD.BT_601: 601>)[source]¶
RGB to YCbCr colorspace conversion.
A multi dimensional array containing an image or batch of images in RGB format.
Specifies the YCbCr format.
Can be one of YCC_STD.BT_601, YCC_STD.BT_709, and YCC_STD.BT_2020.
A multi dimensional array containing an image or batch of images in YCbCr format
arrayfire.image.
rotate
(image, theta, is_crop=True, method=<INTERP.NEAREST: 0>)[source]¶
Rotate an image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
The angle to rotate in radians.
Specifies if the output should be cropped to the input size.
Interpolation method used for rotating.
Output image after rotating.
arrayfire.image.
sat
(image)[source]¶
Summed Area Tables
A multi dimensional array specifying image or batch of images
A multi dimensional array containing the summed area table of input image
arrayfire.image.
save_image
(image, file_name)[source]¶
Save an array as an image on the disk.
A 2 D arrayfire array representing an image.
Full path of the file name on the disk.
arrayfire.image.
save_image_native
(image, file_name)[source]¶
Save an array as an image on the disk in native format.
A 2 or 3 dimensional arrayfire array representing an image.
Full path of the file name on the disk.
arrayfire.image.
scale
(image, scale0, scale1, odim0=0, odim1=0, method=<INTERP.NEAREST: 0>)[source]¶
Scale an image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Scale factor for the first dimension.
Scale factor for the second dimension.
Size of the first dimension of the output.
Size of the second dimension of the output.
Interpolation method used for resizing.
Output image after scaling.
arrayfire.image.
skew
(image, skew0, skew1, odim0=0, odim1=0, method=<INTERP.NEAREST: 0>, is_inverse=True)[source]¶
Skew an image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Skew factor for the first dimension.
Skew factor for the second dimension.
Size of the first dimension of the output.
Size of the second dimension of the output.
Interpolation method used for resizing.
Specifies if the inverse skew is applied.
Output image after skewing.
arrayfire.image.
sobel_derivatives
(image, w_len=3)[source]¶
Find the sobel derivatives of the image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
The size of the sobel operator.
dx is the sobel derivative along the horizontal direction.
dy is the sobel derivative along the vertical direction.
arrayfire.image.
sobel_filter
(image, w_len=3, is_fast=False)[source]¶
Apply sobel filter to the image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
The size of the sobel operator.
Specifies if the magnitude is generated using SAD (if True) or SSD (if False).
Image containing the magnitude of the sobel derivatives.
arrayfire.image.
transform
(image, trans_mat, odim0=0, odim1=0, method=<INTERP.NEAREST: 0>, is_inverse=True)[source]¶
Transform an image using a transformation matrix.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
A 2 D floating point arrayfire array of size [3, 2].
Size of the first dimension of the output.
Size of the second dimension of the output.
Interpolation method used for transformation.
Specifies if the inverse transform is applied.
Output image after transformation.
arrayfire.image.
translate
(image, trans0, trans1, odim0=0, odim1=0, method=<INTERP.NEAREST: 0>)[source]¶
Translate an image.
A 2 D arrayfire array representing an image, or
A multi dimensional array representing batch of images.
Translation along first dimension in pixels.
Translation along second dimension in pixels.
Size of the first dimension of the output.
Size of the second dimension of the output.
Interpolation method used for translation.
Output image after translation.
arrayfire.image.
unwrap
(image, wx, wy, sx, sy, px=0, py=0, is_column=True)[source]¶
Unrwap an image into an array.
A multi dimensional array specifying an image or batch of images.
Block window size along the first dimension.
Block window size along the second dimension.
Stride along the first dimension.
Stride along the second dimension.
Padding along the first dimension.
Padding along the second dimension.
Specifies if the patch should be laid along row or columns.
A multi dimensional array contianing the image patches along specified dimension.
Examples
>>> import arrayfire as af >>> a = af.randu(6, 6) >>> af.display(a)
0.4107 0.3775 0.0901 0.8060 0.0012 0.9250 0.8224 0.3027 0.5933 0.5938 0.8703 0.3063 0.9518 0.6456 0.1098 0.8395 0.5259 0.9313 0.1794 0.5591 0.1046 0.1933 0.1443 0.8684 0.4198 0.6600 0.8827 0.7270 0.3253 0.6592 0.0081 0.0764 0.1647 0.0322 0.5081 0.4387
>>> b = af.unwrap(a, 2, 2, 2, 2) >>> af.display(b)
0.4107 0.9518 0.4198 0.0901 0.1098 0.8827 0.0012 0.5259 0.3253 0.8224 0.1794 0.0081 0.5933 0.1046 0.1647 0.8703 0.1443 0.5081 0.3775 0.6456 0.6600 0.8060 0.8395 0.7270 0.9250 0.9313 0.6592 0.3027 0.5591 0.0764 0.5938 0.1933 0.0322 0.3063 0.8684 0.4387
arrayfire.image.
wrap
(a, ox, oy, wx, wy, sx, sy, px=0, py=0, is_column=True)[source]¶
Wrap an array into an image.
A multi dimensional array containing patches of images.
Block window size along the first dimension.
Block window size along the second dimension.
Stride along the first dimension.
Stride along the second dimension.
Padding along the first dimension.
Padding along the second dimension.
Specifies if the patch should be laid along row or columns.
A multi dimensional array contianing the images.
Examples
>>> import arrayfire as af >>> a = af.randu(6, 6) >>> af.display(a)
0.4107 0.3775 0.0901 0.8060 0.0012 0.9250 0.8224 0.3027 0.5933 0.5938 0.8703 0.3063 0.9518 0.6456 0.1098 0.8395 0.5259 0.9313 0.1794 0.5591 0.1046 0.1933 0.1443 0.8684 0.4198 0.6600 0.8827 0.7270 0.3253 0.6592 0.0081 0.0764 0.1647 0.0322 0.5081 0.4387
>>> b = af.unwrap(a, 2, 2, 2, 2) >>> af.display(b)
0.4107 0.9518 0.4198 0.0901 0.1098 0.8827 0.0012 0.5259 0.3253 0.8224 0.1794 0.0081 0.5933 0.1046 0.1647 0.8703 0.1443 0.5081 0.3775 0.6456 0.6600 0.8060 0.8395 0.7270 0.9250 0.9313 0.6592 0.3027 0.5591 0.0764 0.5938 0.1933 0.0322 0.3063 0.8684 0.4387
0.4107 0.3775 0.0901 0.8060 0.0012 0.9250 0.8224 0.3027 0.5933 0.5938 0.8703 0.3063 0.9518 0.6456 0.1098 0.8395 0.5259 0.9313 0.1794 0.5591 0.1046 0.1933 0.1443 0.8684 0.4198 0.6600 0.8827 0.7270 0.3253 0.6592 0.0081 0.0764 0.1647 0.0322 0.5081 0.4387
arrayfire.image.
ycbcr2rgb
(image, standard=<YCC_STD.BT_601: 601>)[source]¶
YCbCr to RGB colorspace conversion.
A multi dimensional array containing an image or batch of images in YCbCr format.
Specifies the YCbCr format.
Can be one of YCC_STD.BT_601, YCC_STD.BT_709, and YCC_STD.BT_2020.
A multi dimensional array containing an image or batch of images in RGB format
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4