public class NativeImageLoader extends BaseImageLoader
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
ALLOWED_FORMATS |
BASE_DIR, centerCropIfNeeded, channels, height, imageTransform, log, rng, width
Constructor and Description |
---|
NativeImageLoader()
Loads images with no scaling or conversion.
|
NativeImageLoader(int height,
int width)
Instantiate an image with the given
height and width
|
NativeImageLoader(int height,
int width,
int channels)
Instantiate an image with the given
height and width
|
NativeImageLoader(int height,
int width,
int channels,
boolean centerCropIfNeeded)
Instantiate an image with the given
height and width
|
NativeImageLoader(int height,
int width,
int channels,
ImageTransform imageTransform)
Instantiate an image with the given
height and width
|
Modifier and Type | Method and Description |
---|---|
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(java.awt.image.BufferedImage image) |
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(java.io.File f) |
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(java.io.InputStream is) |
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(org.bytedeco.javacpp.opencv_core.Mat image) |
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(java.awt.image.BufferedImage image) |
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(java.io.File f)
Convert a file to a row vector
|
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(java.io.InputStream is) |
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(org.bytedeco.javacpp.opencv_core.Mat image) |
protected org.bytedeco.javacpp.opencv_core.Mat |
centerCropIfNeeded(org.bytedeco.javacpp.opencv_core.Mat img) |
java.lang.String[] |
getAllowedFormats() |
protected org.bytedeco.javacpp.opencv_core.Mat |
scalingIfNeed(org.bytedeco.javacpp.opencv_core.Mat image) |
protected org.bytedeco.javacpp.opencv_core.Mat |
scalingIfNeed(org.bytedeco.javacpp.opencv_core.Mat image,
int dstHeight,
int dstWidth) |
downloadAndUntar
public NativeImageLoader()
public NativeImageLoader(int height, int width)
height
- the height to load*width
- the width to loadpublic NativeImageLoader(int height, int width, int channels)
height
- the height to loadwidth
- the width to loadchannels
- the number of channels for the image*public NativeImageLoader(int height, int width, int channels, boolean centerCropIfNeeded)
height
- the height to loadwidth
- the width to loadchannels
- the number of channels for the image*centerCropIfNeeded
- to crop before rescaling and convertingpublic NativeImageLoader(int height, int width, int channels, ImageTransform imageTransform)
height
- the height to loadwidth
- the width to loadchannels
- the number of channels for the image*imageTransform
- to use before rescaling and convertingpublic java.lang.String[] getAllowedFormats()
getAllowedFormats
in class BaseImageLoader
public org.nd4j.linalg.api.ndarray.INDArray asRowVector(java.io.File f) throws java.io.IOException
asRowVector
in class BaseImageLoader
f
- the image to convertjava.io.IOException
public org.nd4j.linalg.api.ndarray.INDArray asRowVector(java.io.InputStream is) throws java.io.IOException
asRowVector
in class BaseImageLoader
java.io.IOException
public org.nd4j.linalg.api.ndarray.INDArray asRowVector(java.awt.image.BufferedImage image) throws java.io.IOException
java.io.IOException
public org.nd4j.linalg.api.ndarray.INDArray asRowVector(org.bytedeco.javacpp.opencv_core.Mat image) throws java.io.IOException
java.io.IOException
public org.nd4j.linalg.api.ndarray.INDArray asMatrix(java.io.File f) throws java.io.IOException
asMatrix
in class BaseImageLoader
java.io.IOException
public org.nd4j.linalg.api.ndarray.INDArray asMatrix(java.io.InputStream is) throws java.io.IOException
asMatrix
in class BaseImageLoader
java.io.IOException
public org.nd4j.linalg.api.ndarray.INDArray asMatrix(java.awt.image.BufferedImage image) throws java.io.IOException
java.io.IOException
public org.nd4j.linalg.api.ndarray.INDArray asMatrix(org.bytedeco.javacpp.opencv_core.Mat image) throws java.io.IOException
java.io.IOException
protected org.bytedeco.javacpp.opencv_core.Mat centerCropIfNeeded(org.bytedeco.javacpp.opencv_core.Mat img)
protected org.bytedeco.javacpp.opencv_core.Mat scalingIfNeed(org.bytedeco.javacpp.opencv_core.Mat image)
protected org.bytedeco.javacpp.opencv_core.Mat scalingIfNeed(org.bytedeco.javacpp.opencv_core.Mat image, int dstHeight, int dstWidth)