Package ai.djl.modality.cv
Class BufferedImageFactory
java.lang.Object
ai.djl.modality.cv.ImageFactory
ai.djl.modality.cv.BufferedImageFactory
BufferedImageFactory
is the default implementation of ImageFactory
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGetsImage
from file.GetsImage
from varies Java image types.GetsImage
fromInputStream
.fromNDArray
(NDArray array) fromPixels
(int[] pixels, int width, int height) GetsImage
from array.protected void
save
(BufferedImage image, OutputStream os, String type) Methods inherited from class ai.djl.modality.cv.ImageFactory
fromUrl, fromUrl, getInstance, setImageFactory
-
Constructor Details
-
BufferedImageFactory
public BufferedImageFactory()
-
-
Method Details
-
fromFile
GetsImage
from file.- Specified by:
fromFile
in classImageFactory
- Parameters:
path
- the path to the image- Returns:
Image
- Throws:
IOException
- Image not found or not readable
-
fromInputStream
GetsImage
fromInputStream
.- Specified by:
fromInputStream
in classImageFactory
- Parameters:
is
-InputStream
- Returns:
Image
- Throws:
IOException
- image cannot be read from input stream.
-
fromImage
GetsImage
from varies Java image types.Image can be BufferedImage or BitMap depends on platform
- Specified by:
fromImage
in classImageFactory
- Parameters:
image
- the image object.- Returns:
Image
-
fromNDArray
- Specified by:
fromNDArray
in classImageFactory
- Parameters:
array
- the NDArray with CHW format- Returns:
Image
-
fromPixels
GetsImage
from array.- Specified by:
fromPixels
in classImageFactory
- Parameters:
pixels
- the array of ARGB values used to initialize the pixels.width
- the width of the imageheight
- the height of the image- Returns:
Image
-
save
- Throws:
IOException
-