Package ai.djl.modality.cv
Interface Image
-
public interface ImageImageis a container of an image in DJL. The storage type of the image depends on the platform you are running on.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classImage.FlagFlag indicates the color channel options for images.static classImage.InterpolationInterpolation indicates the Interpolation options for resizinig an image.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voiddrawBoundingBoxes(DetectedObjects detections)Draws the bounding boxes on the image.voiddrawJoints(Joints joints)Draws all joints of a body on an image.Imageduplicate()Gets a deep copy of the original image.java.util.List<BoundingBox>findBoundingBoxes()Find bounding boxes from a masked image with 0/1 or 0/255.intgetHeight()Gets the height of the image.ImagegetSubImage(int x, int y, int w, int h)Gets the subimage defined by a specified rectangular region.intgetWidth()Gets the width of the image.java.lang.ObjectgetWrappedImage()Gets the wrapped image.voidsave(java.io.OutputStream os, java.lang.String type)Save the image to file.default NDArraytoNDArray(NDManager manager)Converts image to a RGBNDArray.NDArraytoNDArray(NDManager manager, Image.Flag flag)Converts image to aNDArray.
-
-
-
Method Detail
-
getWidth
int getWidth()
Gets the width of the image.- Returns:
- pixels representing width
-
getHeight
int getHeight()
Gets the height of the image.- Returns:
- pixels representing height
-
getWrappedImage
java.lang.Object getWrappedImage()
Gets the wrapped image.- Returns:
- the wrapped image object
-
getSubImage
Image getSubImage(int x, int y, int w, int h)
Gets the subimage defined by a specified rectangular region.- Parameters:
x- the X coordinate of the upper-left corner of the specified rectangular regiony- the Y coordinate of the upper-left corner of the specified rectangular regionw- the width of the specified rectangular regionh- the height of the specified rectangular region- Returns:
- subimage of this image
-
duplicate
Image duplicate()
Gets a deep copy of the original image.- Returns:
- the copy of the original image.
-
toNDArray
NDArray toNDArray(NDManager manager, Image.Flag flag)
Converts image to aNDArray.
-
save
void save(java.io.OutputStream os, java.lang.String type) throws java.io.IOExceptionSave the image to file.- Parameters:
os-OutputStreamto save the image.type- type of the image, such as "png", "jpeg"- Throws:
java.io.IOException- image cannot be saved through output stream
-
findBoundingBoxes
java.util.List<BoundingBox> findBoundingBoxes()
Find bounding boxes from a masked image with 0/1 or 0/255.- Returns:
- the List of bounding boxes of the images
-
drawBoundingBoxes
void drawBoundingBoxes(DetectedObjects detections)
Draws the bounding boxes on the image.- Parameters:
detections- the object detection results
-
drawJoints
void drawJoints(Joints joints)
Draws all joints of a body on an image.- Parameters:
joints- the joints of the body
-
-