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 TypeMethodDescriptionGetsImagefrom file.GetsImagefrom varies Java image types.GetsImagefromInputStream.fromNDArray(NDArray array) fromPixels(int[] pixels, int width, int height) GetsImagefrom array.protected voidsave(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
GetsImagefrom file.- Specified by:
fromFilein classImageFactory- Parameters:
path- the path to the image- Returns:
Image- Throws:
IOException- Image not found or not readable
-
fromInputStream
GetsImagefromInputStream.- Specified by:
fromInputStreamin classImageFactory- Parameters:
is-InputStream- Returns:
Image- Throws:
IOException- image cannot be read from input stream.
-
fromImage
GetsImagefrom varies Java image types.Image can be BufferedImage or BitMap depends on platform
- Specified by:
fromImagein classImageFactory- Parameters:
image- the image object.- Returns:
Image
-
fromNDArray
- Specified by:
fromNDArrayin classImageFactory- Parameters:
array- the NDArray with CHW format- Returns:
Image
-
fromPixels
GetsImagefrom array.- Specified by:
fromPixelsin 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
-