public class NativeImageLoader extends BaseImageLoader
| Modifier and Type | Class and Description |
|---|---|
static class |
NativeImageLoader.MultiPageMode |
| Modifier and Type | Field and Description |
|---|---|
static String[] |
ALLOWED_FORMATS |
protected org.bytedeco.javacv.OpenCVFrameConverter.ToMat |
converter |
BASE_DIR, centerCropIfNeeded, channels, height, imageTransform, log, multiPageMode, 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
|
|
NativeImageLoader(int height,
int width,
int channels,
NativeImageLoader.MultiPageMode mode)
Instantiate an image with the given
height and width
|
protected |
NativeImageLoader(NativeImageLoader other) |
| Modifier and Type | Method and Description |
|---|---|
org.bytedeco.javacv.Frame |
asFrame(org.nd4j.linalg.api.ndarray.INDArray array)
Returns
asFrame(array, -1). |
org.bytedeco.javacv.Frame |
asFrame(org.nd4j.linalg.api.ndarray.INDArray array,
int dataType)
Converts an INDArray to a JavaCV Frame.
|
Image |
asImageMatrix(File f) |
Image |
asImageMatrix(InputStream is) |
org.bytedeco.javacpp.opencv_core.Mat |
asMat(org.nd4j.linalg.api.ndarray.INDArray array)
Returns
asMat(array, -1). |
org.bytedeco.javacpp.opencv_core.Mat |
asMat(org.nd4j.linalg.api.ndarray.INDArray array,
int dataType)
Converts an INDArray to an OpenCV Mat.
|
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(File f) |
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(org.bytedeco.javacv.Frame image) |
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(org.bytedeco.javacv.Frame image) |
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 convertingpublic NativeImageLoader(int height,
int width,
int channels,
NativeImageLoader.MultiPageMode mode)
height - the height to loadwidth - the width to loadchannels - the number of channels for the image*mode - how to load multipage imageprotected 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.javacv.Frame image)
throws IOException
IOExceptionpublic 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 Image asImageMatrix(File f) throws IOException
asImageMatrix in class BaseImageLoaderIOExceptionpublic Image asImageMatrix(InputStream is) throws IOException
asImageMatrix 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.javacv.Frame image)
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 convertIOExceptionpublic org.bytedeco.javacv.Frame asFrame(org.nd4j.linalg.api.ndarray.INDArray array)
asFrame(array, -1).public org.bytedeco.javacv.Frame asFrame(org.nd4j.linalg.api.ndarray.INDArray array,
int dataType)
array - to convertdataType - from JavaCV (DEPTH_FLOAT, DEPTH_UBYTE, etc), or -1 to use same type as the INDArraypublic org.bytedeco.javacpp.opencv_core.Mat asMat(org.nd4j.linalg.api.ndarray.INDArray array)
asMat(array, -1).public org.bytedeco.javacpp.opencv_core.Mat asMat(org.nd4j.linalg.api.ndarray.INDArray array,
int dataType)
array - to convertdataType - from OpenCV (CV_32F, CV_8U, etc), or -1 to use same type as the INDArrayCopyright © 2018. All rights reserved.