public class ImageLoader extends BaseImageLoader
ALLOWED_FORMATS, BASE_DIR, centerCropIfNeeded, channels, height, imageTransform, log, rng, width| Constructor and Description |
|---|
ImageLoader() |
ImageLoader(int height,
int width)
Instantiate an image with the given
height and width
|
ImageLoader(int height,
int width,
int channels)
Instantiate an image with the given
height and width
|
ImageLoader(int height,
int width,
int channels,
boolean centerCropIfNeeded)
Instantiate an image with the given
height and width
|
| Modifier and Type | Method and Description |
|---|---|
org.nd4j.linalg.api.ndarray.INDArray |
asImageMiniBatches(File f,
int numMiniBatches,
int numRowsPerSlice)
Slices up an image in to a mini batch.
|
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(BufferedImage image)
Convert an BufferedImage to a matrix
|
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(File f)
Convert an image file
in to a matrix
|
org.nd4j.linalg.api.ndarray.INDArray |
asMatrix(InputStream inputStream)
Convert an input stream to a matrix
|
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(BufferedImage image)
Convert an image in to a row vector
|
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(File f)
Convert a file to a row vector
|
org.nd4j.linalg.api.ndarray.INDArray |
asRowVector(InputStream inputStream) |
BufferedImage |
centerCropIfNeeded(BufferedImage img) |
int[] |
flattenedImageFromFile(File f) |
int[][] |
fromFile(File file)
Load a rastered image from file
|
int[][][] |
fromFileMultipleChannels(File file)
Load a rastered image from file
|
protected BufferedImage |
scalingIfNeed(BufferedImage image,
boolean needAlpha) |
protected BufferedImage |
scalingIfNeed(BufferedImage image,
int dstHeight,
int dstWidth,
boolean needAlpha) |
org.nd4j.linalg.api.ndarray.INDArray |
toBgr(BufferedImage image)
Convert an BufferedImage to an bgr spectrum image
|
org.nd4j.linalg.api.ndarray.INDArray |
toBgr(File file)
Convert an input stream to an bgr spectrum image
|
org.nd4j.linalg.api.ndarray.INDArray |
toBgr(InputStream inputStream)
Convert an input stream to an bgr spectrum image
|
static BufferedImage |
toBufferedImage(Image img,
int type)
Converts a given Image into a BufferedImage
|
void |
toBufferedImageRGB(org.nd4j.linalg.api.ndarray.INDArray arr,
BufferedImage image)
Convert the given image to an rgb image
|
static BufferedImage |
toImage(org.nd4j.linalg.api.ndarray.INDArray matrix)
Convert a matrix in to a buffereed image
|
protected org.nd4j.linalg.api.ndarray.INDArray |
toINDArrayBGR(BufferedImage image) |
protected int[][] |
toIntArrayArray(BufferedImage image) |
org.nd4j.linalg.api.ndarray.INDArray |
toRaveledTensor(BufferedImage image)
Convert an image in to a raveled tensor of
the bgr values of the image
|
org.nd4j.linalg.api.ndarray.INDArray |
toRaveledTensor(File file)
Changes the input stream in to an
bgr based raveled(flattened) vector
|
org.nd4j.linalg.api.ndarray.INDArray |
toRaveledTensor(InputStream is)
Changes the input stream in to an
bgr based raveled(flattened) vector
|
downloadAndUntar, getAllowedFormatspublic ImageLoader()
public ImageLoader(int height,
int width)
height - the height to load*width - the width to loadpublic ImageLoader(int height,
int width,
int channels)
height - the height to loadwidth - the width to loadchannels - the number of channels for the image*public ImageLoader(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 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 inputStream) throws IOException
asRowVector in class BaseImageLoaderIOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asRowVector(BufferedImage image)
image - the image to convertpublic org.nd4j.linalg.api.ndarray.INDArray toRaveledTensor(File file)
file - the input stream to convertpublic org.nd4j.linalg.api.ndarray.INDArray toRaveledTensor(InputStream is)
is - the input stream to convertpublic org.nd4j.linalg.api.ndarray.INDArray toRaveledTensor(BufferedImage image)
image - the image to parsepublic org.nd4j.linalg.api.ndarray.INDArray toBgr(File file)
file - the file to convertpublic org.nd4j.linalg.api.ndarray.INDArray toBgr(InputStream inputStream)
inputStream - the input stream to convertpublic org.nd4j.linalg.api.ndarray.INDArray toBgr(BufferedImage image)
image - the BufferedImage to convertpublic org.nd4j.linalg.api.ndarray.INDArray asMatrix(File f) throws IOException
asMatrix in class BaseImageLoaderf - the file to convertIOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asMatrix(InputStream inputStream) throws IOException
asMatrix in class BaseImageLoaderinputStream - the input stream to convertIOExceptionpublic org.nd4j.linalg.api.ndarray.INDArray asMatrix(BufferedImage image)
image - the BufferedImage to convertpublic org.nd4j.linalg.api.ndarray.INDArray asImageMiniBatches(File f, int numMiniBatches, int numRowsPerSlice)
f - the file to load fromnumMiniBatches - the number of images in a mini batchnumRowsPerSlice - the number of rows for each imagepublic int[] flattenedImageFromFile(File f) throws IOException
IOExceptionpublic int[][] fromFile(File file) throws IOException
file - the file to loadIOExceptionpublic int[][][] fromFileMultipleChannels(File file) throws IOException
file - the file to loadIOExceptionpublic static BufferedImage toImage(org.nd4j.linalg.api.ndarray.INDArray matrix)
matrix - theBufferedImagepublic void toBufferedImageRGB(org.nd4j.linalg.api.ndarray.INDArray arr,
BufferedImage image)
arr - the array to useimage - the image to setpublic static BufferedImage toBufferedImage(Image img, int type)
img - The Image to be convertedtype - The color model of BufferedImageprotected int[][] toIntArrayArray(BufferedImage image)
protected org.nd4j.linalg.api.ndarray.INDArray toINDArrayBGR(BufferedImage image)
public BufferedImage centerCropIfNeeded(BufferedImage img)
protected BufferedImage scalingIfNeed(BufferedImage image, boolean needAlpha)
protected BufferedImage scalingIfNeed(BufferedImage image, int dstHeight, int dstWidth, boolean needAlpha)
Copyright © 2016. All rights reserved.