public class NativeImageLoader extends BaseImageLoader
| Modifier and Type | Field and Description |
|---|---|
static String[] |
ALLOWED_FORMATS |
protected org.bytedeco.javacv.OpenCVFrameConverter.ToMat |
converter |
BASE_DIR, centerCropIfNeeded, channels, height, imageTransform, log, rng, width| Modifier | 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
|
protected |
NativeImageLoader(NativeImageLoader other) |
| Modifier and Type | Method and Description |
|---|---|
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(File f) |
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(ImageWritable writable)
Convert ImageWritable to INDArray
|
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(InputStream is) |
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(Object image)
|
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(org.bytedeco.javacpp.opencv_core.Mat image) |
void |
asMatrixView(File f,
org.nd4j.linalg.api.ndarray.INDArray view) |
void |
asMatrixView(InputStream is,
org.nd4j.linalg.api.ndarray.INDArray view) |
void |
asMatrixView(org.bytedeco.javacpp.opencv_core.Mat image,
org.nd4j.linalg.api.ndarray.INDArray view) |
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(File f)
Convert a file to a row vector
|
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(InputStream is) |
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(Object image)
Returns
asMatrix(image).ravel(). |
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(org.bytedeco.javacpp.opencv_core.Mat image) |
ImageWritable |
asWritable(File f)
Convert a file to a INDArray
|
protected org.bytedeco.javacpp.opencv_core.Mat |
centerCropIfNeeded(org.bytedeco.javacpp.opencv_core.Mat img) |
protected void |
fillNDArray(org.bytedeco.javacpp.opencv_core.Mat image,
org.nd4j.linalg.api.ndarray.INDArray ret) |
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) |
protected org.nd4j.linalg.api.ndarray.INDArray |
transformImage(org.bytedeco.javacpp.opencv_core.Mat image,
org.nd4j.linalg.api.ndarray.INDArray ret) |
downloadAndUntarpublic static final String[] ALLOWED_FORMATS
protected org.bytedeco.javacv.OpenCVFrameConverter.ToMat converter
public NativeImageLoader()
public NativeImageLoader(int height,
int width)
height - the height to loadwidth - 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 convertingprotected NativeImageLoader(NativeImageLoader other)
public String[] getAllowedFormats()
getAllowedFormats in class BaseImageLoaderpublic org.nd4j.linalg.api.ndarray.INDArray asRowVector(File f) throws IOException
asRowVector in class BaseImageLoaderf - the image to convertIOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asRowVector(InputStream is) throws IOException
asRowVector in class BaseImageLoaderIOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asRowVector(Object image) throws IOException
asMatrix(image).ravel().IOExceptionasMatrix(Object)public org.nd4j.linalg.api.ndarray.INDArray asRowVector(org.bytedeco.javacpp.opencv_core.Mat image)
throws IOException
IOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asMatrix(File f) throws IOException
asMatrix in class BaseImageLoaderIOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asMatrix(InputStream is) throws IOException
asMatrix in class BaseImageLoaderIOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asMatrix(Object image) throws IOException
AndroidNativeImageLoader.asMatrix(android.graphics.Bitmap) or
Java2DNativeImageLoader.asMatrix(java.awt.image.BufferedImage).image - as a Bitmap or BufferedImageIOExceptionprotected void fillNDArray(org.bytedeco.javacpp.opencv_core.Mat image,
org.nd4j.linalg.api.ndarray.INDArray ret)
public void asMatrixView(InputStream is, org.nd4j.linalg.api.ndarray.INDArray view) throws IOException
IOExceptionpublic void asMatrixView(File f, org.nd4j.linalg.api.ndarray.INDArray view) throws IOException
IOExceptionpublic void asMatrixView(org.bytedeco.javacpp.opencv_core.Mat image,
org.nd4j.linalg.api.ndarray.INDArray view)
throws IOException
IOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asMatrix(org.bytedeco.javacpp.opencv_core.Mat image)
throws IOException
IOExceptionprotected org.nd4j.linalg.api.ndarray.INDArray transformImage(org.bytedeco.javacpp.opencv_core.Mat image,
org.nd4j.linalg.api.ndarray.INDArray ret)
throws IOException
IOExceptionprotected 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)
public ImageWritable asWritable(File f) throws IOException
f - the image to convertIOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asMatrix(ImageWritable writable) throws IOException
writable - ImageWritable to convertIOExceptionCopyright © 2017. All rights reserved.