public class NativeImageLoader extends BaseImageLoader
BaseImageLoader.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(long height,
long width)
Instantiate an image with the given
height and width
|
|
NativeImageLoader(long height,
long width,
long channels)
Instantiate an image with the given
height and width
|
|
NativeImageLoader(long height,
long width,
long channels,
BaseImageLoader.MultiPageMode mode)
Instantiate an image with the given
height and width
|
|
NativeImageLoader(long height,
long width,
long channels,
boolean centerCropIfNeeded)
Instantiate an image with the given
height and width
|
|
NativeImageLoader(long height,
long width,
long channels,
ImageTransform imageTransform)
Instantiate an image with the given
height and width
|
protected |
NativeImageLoader(NativeImageLoader other) |
| Modifier and Type | Method and Description |
|---|---|
org.bytedeco.javacv.Frame |
asFrame(INDArray array)
Returns
asFrame(array, -1). |
org.bytedeco.javacv.Frame |
asFrame(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(INDArray array)
Returns
asMat(array, -1). |
org.bytedeco.javacpp.opencv_core.Mat |
asMat(INDArray array,
int dataType)
Converts an INDArray to an OpenCV Mat.
|
INDArray |
asMatrix(File f) |
INDArray |
asMatrix(org.bytedeco.javacv.Frame image) |
INDArray |
asMatrix(ImageWritable writable)
Convert ImageWritable to INDArray
|
INDArray |
asMatrix(InputStream is) |
INDArray |
asMatrix(Object image)
|
INDArray |
asMatrix(org.bytedeco.javacpp.opencv_core.Mat image) |
void |
asMatrixView(File f,
INDArray view) |
void |
asMatrixView(InputStream is,
INDArray view) |
void |
asMatrixView(org.bytedeco.javacpp.opencv_core.Mat image,
INDArray view) |
INDArray |
asRowVector(File f)
Convert a file to a row vector
|
INDArray |
asRowVector(org.bytedeco.javacv.Frame image) |
INDArray |
asRowVector(InputStream is) |
INDArray |
asRowVector(Object image)
Returns
asMatrix(image).ravel(). |
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,
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,
long dstHeight,
long dstWidth) |
protected INDArray |
transformImage(org.bytedeco.javacpp.opencv_core.Mat image,
INDArray ret) |
downloadAndUntarpublic static final String[] ALLOWED_FORMATS
protected org.bytedeco.javacv.OpenCVFrameConverter.ToMat converter
public NativeImageLoader()
public NativeImageLoader(long height,
long width)
height - the height to loadwidth - the width to loadpublic NativeImageLoader(long height,
long width,
long channels)
height - the height to loadwidth - the width to loadchannels - the number of channels for the image*public NativeImageLoader(long height,
long width,
long 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(long height,
long width,
long 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(long height,
long width,
long channels,
BaseImageLoader.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 INDArray asRowVector(File f) throws IOException
asRowVector in class BaseImageLoaderf - the image to convertIOExceptionpublic INDArray asRowVector(InputStream is) throws IOException
asRowVector in class BaseImageLoaderIOExceptionpublic INDArray asRowVector(Object image) throws IOException
asMatrix(image).ravel().IOExceptionasMatrix(Object)public INDArray asRowVector(org.bytedeco.javacv.Frame image) throws IOException
IOExceptionpublic INDArray asRowVector(org.bytedeco.javacpp.opencv_core.Mat image) throws IOException
IOExceptionpublic INDArray asMatrix(File f) throws IOException
asMatrix in class BaseImageLoaderIOExceptionpublic 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 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,
INDArray ret)
public void asMatrixView(InputStream is, INDArray view) throws IOException
IOExceptionpublic void asMatrixView(File f, INDArray view) throws IOException
IOExceptionpublic void asMatrixView(org.bytedeco.javacpp.opencv_core.Mat image,
INDArray view)
throws IOException
IOExceptionpublic INDArray asMatrix(org.bytedeco.javacv.Frame image) throws IOException
IOExceptionpublic INDArray asMatrix(org.bytedeco.javacpp.opencv_core.Mat image) throws IOException
IOExceptionprotected INDArray transformImage(org.bytedeco.javacpp.opencv_core.Mat image, 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,
long dstHeight,
long dstWidth)
public ImageWritable asWritable(File f) throws IOException
f - the image to convertIOExceptionpublic INDArray asMatrix(ImageWritable writable) throws IOException
writable - ImageWritable to convertIOExceptionpublic org.bytedeco.javacv.Frame asFrame(INDArray array)
asFrame(array, -1).public org.bytedeco.javacv.Frame asFrame(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(INDArray array)
asMat(array, -1).public org.bytedeco.javacpp.opencv_core.Mat asMat(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.