public class NDImage extends Object
Constructor and Description |
---|
NDImage() |
Modifier and Type | Method and Description |
---|---|
INDArray |
adjustContrast(INDArray in,
double factor)
Adjusts contrast of RGB or grayscale images.
|
INDArray |
adjustHue(INDArray in,
double delta)
Adjust hue of RGB image
|
INDArray |
adjustSaturation(INDArray in,
double factor)
Adjust saturation of RGB images
|
INDArray |
cropAndResize(INDArray image,
INDArray cropBoxes,
INDArray boxIndices,
INDArray cropOutSize)
Given an input image and some crop boxes, extract out the image subsets and resize them to the specified size.
|
INDArray |
cropAndResize(INDArray image,
INDArray cropBoxes,
INDArray boxIndices,
INDArray cropOutSize,
double extrapolationValue)
Given an input image and some crop boxes, extract out the image subsets and resize them to the specified size.
|
INDArray |
extractImagePatches(INDArray image,
int[] kSizes,
int[] strides,
int[] rates,
boolean sameMode)
Given an input image, extract out image patches (of size kSizes - h x w) and place them in the depth dimension.
|
INDArray |
hsvToRgb(INDArray input)
Converting image from HSV to RGB format
|
INDArray |
imageResize(INDArray input,
INDArray size,
boolean preserveAspectRatio,
boolean antialis,
ImageResizeMethod ImageResizeMethod)
Resize images to size using the specified method.
|
INDArray |
imageResize(INDArray input,
INDArray size,
ImageResizeMethod ImageResizeMethod)
Resize images to size using the specified method.
|
INDArray |
nonMaxSuppression(INDArray boxes,
INDArray scores,
int maxOutSize,
double iouThreshold,
double scoreThreshold)
Greedily selects a subset of bounding boxes in descending order of score
|
INDArray |
randomCrop(INDArray input,
INDArray shape)
Randomly crops image
|
INDArray |
rgbToHsv(INDArray input)
Converting array from HSV to RGB format
|
INDArray |
rgbToYiq(INDArray input)
Converting array from RGB to YIQ format
|
INDArray |
rgbToYuv(INDArray input)
Converting array from RGB to YUV format
|
INDArray |
yiqToRgb(INDArray input)
Converting image from YIQ to RGB format
|
INDArray |
yuvToRgb(INDArray input)
Converting image from YUV to RGB format
|
public INDArray cropAndResize(INDArray image, INDArray cropBoxes, INDArray boxIndices, INDArray cropOutSize, double extrapolationValue)
image
- Input image, with shape [batch, height, width, channels] (NUMERIC type)cropBoxes
- Float32 crop, shape [numBoxes, 4] with values in range 0 to 1 (NUMERIC type)boxIndices
- Indices: which image (index to dimension 0) the cropBoxes belong to. Rank 1, shape [numBoxes] (NUMERIC type)cropOutSize
- Output size for the images - int32, rank 1 with values [outHeight, outWidth] (INT type)extrapolationValue
- Used for extrapolation, when applicable. 0.0 should be used for the defaultpublic INDArray cropAndResize(INDArray image, INDArray cropBoxes, INDArray boxIndices, INDArray cropOutSize)
image
- Input image, with shape [batch, height, width, channels] (NUMERIC type)cropBoxes
- Float32 crop, shape [numBoxes, 4] with values in range 0 to 1 (NUMERIC type)boxIndices
- Indices: which image (index to dimension 0) the cropBoxes belong to. Rank 1, shape [numBoxes] (NUMERIC type)cropOutSize
- Output size for the images - int32, rank 1 with values [outHeight, outWidth] (INT type)public INDArray adjustContrast(INDArray in, double factor)
in
- images to adjust. 3D shape or higher (NUMERIC type)factor
- multiplier for adjusting contrastpublic INDArray adjustHue(INDArray in, double delta)
in
- image as 3D array (NUMERIC type)delta
- value to add to hue channelpublic INDArray adjustSaturation(INDArray in, double factor)
in
- RGB image as 3D array (NUMERIC type)factor
- factor for saturationpublic INDArray extractImagePatches(INDArray image, int[] kSizes, int[] strides, int[] rates, boolean sameMode)
image
- Input image to extract image patches from - shape [batch, height, width, channels] (NUMERIC type)kSizes
- Kernel size - size of the image patches, [height, width] (Size: Exactly(count=2))strides
- Stride in the input dimension for extracting image patches, [stride_height, stride_width] (Size: Exactly(count=2))rates
- Usually [1,1]. Equivalent to dilation rate in dilated convolutions - how far apart the output pixels
in the patches should be, in the input. A dilation of [a,b] means every a
th pixel is taken
along the height/rows dimension, and every b
th pixel is take along the width/columns dimension (Size: AtLeast(min=0))sameMode
- Padding algorithm. If true: use Same paddingpublic INDArray hsvToRgb(INDArray input)
input
- 3D image (NUMERIC type)public INDArray imageResize(INDArray input, INDArray size, boolean preserveAspectRatio, boolean antialis, ImageResizeMethod ImageResizeMethod)
input
- 4D image [NHWC] (NUMERIC type)size
- new height and width (INT type)preserveAspectRatio
- Whether to preserve the aspect ratio. If this is set, then images will be resized to a size that fits in size while preserving the aspect ratio of the original image. Scales up the image if size is bigger than the current size of the image. Defaults to False.antialis
- Whether to use an anti-aliasing filter when downsampling an imageImageResizeMethod
- ResizeBilinear: Bilinear interpolation. If 'antialias' is true, becomes a hat/tent filter function with radius 1 when downsampling.
ResizeLanczos5: Lanczos kernel with radius 5. Very-high-quality filter but may have stronger ringing.
ResizeBicubic: Cubic interpolant of Keys. Equivalent to Catmull-Rom kernel. Reasonably good quality and faster than Lanczos3Kernel, particularly when upsampling.
ResizeGaussian: Gaussian kernel with radius 3, sigma = 1.5 / 3.0.
ResizeNearest: Nearest neighbor interpolation. 'antialias' has no effect when used with nearest neighbor interpolation.
ResizeArea: Anti-aliased resampling with area interpolation. 'antialias' has no effect when used with area interpolation; it always anti-aliases.
ResizeMitchelcubic: Mitchell-Netravali Cubic non-interpolating filter. For synthetic images (especially those lacking proper prefiltering), less ringing than Keys cubic kernel but less sharp.public INDArray imageResize(INDArray input, INDArray size, ImageResizeMethod ImageResizeMethod)
input
- 4D image [NHWC] (NUMERIC type)size
- new height and width (INT type)ImageResizeMethod
- ResizeBilinear: Bilinear interpolation. If 'antialias' is true, becomes a hat/tent filter function with radius 1 when downsampling.
ResizeLanczos5: Lanczos kernel with radius 5. Very-high-quality filter but may have stronger ringing.
ResizeBicubic: Cubic interpolant of Keys. Equivalent to Catmull-Rom kernel. Reasonably good quality and faster than Lanczos3Kernel, particularly when upsampling.
ResizeGaussian: Gaussian kernel with radius 3, sigma = 1.5 / 3.0.
ResizeNearest: Nearest neighbor interpolation. 'antialias' has no effect when used with nearest neighbor interpolation.
ResizeArea: Anti-aliased resampling with area interpolation. 'antialias' has no effect when used with area interpolation; it always anti-aliases.
ResizeMitchelcubic: Mitchell-Netravali Cubic non-interpolating filter. For synthetic images (especially those lacking proper prefiltering), less ringing than Keys cubic kernel but less sharp.public INDArray nonMaxSuppression(INDArray boxes, INDArray scores, int maxOutSize, double iouThreshold, double scoreThreshold)
boxes
- Might be null. Name for the output variable (NUMERIC type)scores
- vector of shape [num_boxes] (NUMERIC type)maxOutSize
- scalar representing the maximum number of boxes to be selectediouThreshold
- threshold for deciding whether boxes overlap too much with respect to IOUscoreThreshold
- threshold for deciding when to remove boxes based on scorepublic INDArray randomCrop(INDArray input, INDArray shape)
input
- input array (NUMERIC type)shape
- shape for crop (INT type)public INDArray rgbToHsv(INDArray input)
input
- 3D image (NUMERIC type)public INDArray rgbToYiq(INDArray input)
input
- 3D image (NUMERIC type)public INDArray rgbToYuv(INDArray input)
input
- 3D image (NUMERIC type)public INDArray yiqToRgb(INDArray input)
input
- 3D image (NUMERIC type)Copyright © 2021. All rights reserved.