DCEFrame
You are viewing a historical document page of Dynamsoft Camera Enhancer v3.0.3.
The DCEFrame
is the class that stores pixel data and further information.
class com.dynamsoft.dce.DCEFrame
Method Name | Description |
---|---|
getImageData |
Get the pixel data of the image. |
getWidth |
Get the pixel width of the image. |
getHeight |
Get the pixel height of the image. |
getStrides |
Get the number of row bytes in each image plane (YUV). |
getPixelFormat |
Get the pixel format of the image. Currently, the image output format of DCEFrame is always NV21. |
getFrameID |
Get the frameID of the DCEFrame object. |
getQuality |
Get the frame quality of the image. User have to enable the frame filter feature to get the quality (high/low) of the image. Otherwise, the frame quality will be unknown. |
getIsCropped |
Get a boolean value that means whether the image is cropped. The frames can be cropped if fast mode is enabled. |
getCropRegion |
Get the crop region of the image (if the image is cropped). |
getOrientation |
Set the orientation of the image. |
setImageData |
Set the pixel data of the image. |
setWidth |
Set the pixel width of the image. |
setHeight |
Set the pixel height of the image. |
setStrides |
Set the number of row bytes in each image plane (YUV). |
setPixelFormat |
Set the pixel format of the image. Currently, the image output format of DCEFrame is always NV21. |
setFrameID |
Set the frameID of the DCEFrame object. |
setQuality |
Set the frame quality of the image. User have to enable the frame filter feature to get the quality (high/low) of the image. Otherwise, the frame quality will be unknown. |
setIsCropped |
Set a boolean value that means whether the image is cropped. The frames can be cropped if fast mode is enabled. |
setCropRegion |
Set a boolean value that means whether the image is cropped. The frames can be cropped if fast mode is enabled. |
setOrientation |
Set the orientation of the image. |
toBitmap |
The method converts the image to UIImage to make it visible on the UI. |
getImageData
Get the pixel data of the image.
byte[] getImageData()
Return Value
The method returns a byte list that stores the pixel data of the image.
getWidth
Get the pixel width of the image.
int getWidth()
Return Value
The method returns the pixel width of the image.
getHeight
Get the pixel height of the image.
int getHeight()
Return Value
The method returns the pixel height of the image.
getStrides
Get the number of row bytes in each image plane (YUV).
int[] getStrides()
Return Value
The number of row bytes in each image plane (YUV).
Remarks
strides[0]
is the stride of Y component in the image. strides[1]
and strides[2]
are the strides of the U (blue projection) and V (red projection) components in the image.
getPixelFormat
Get the pixel format of the image. Currently, the image output format of DCEFrame
is always NV21.
int getPixelFormat()
Return Value
The method returns an int value that refers to the enumeration value of ImagePixelFormat
(view the enumeration members in Dynamsoft Barcode Reader documents).
getFrameID
Get the frameID
of the DCEFrame
object.
int getFrameID()
Return Value
The method returns an int value that stores the frameID
of the image.
getQuality
Get the frame quality of the image. User have to enable the frame filter feature to get the quality (high/low) of the image. Otherwise, the frame quality will be unknown.
EnumFrameQuality getQuality()
Return Value
The method returns an enumeration value in EnumFrameQuality
.
Remarks
Users can get all the original DCEFrame via DCEFrameListener
but only high-quality frame can be acquired from the DCE video buffer if frame filter is enabled. In another word, when frame filter feature is enabled, the frame quality will always be high if they are acquired by triggering getFrameFromBuffer
.
getIsCropped
Get a boolean value that means whether the image is cropped. The frames can be cropped if fast mode
is enabled.
boolean getIsCropped()
Return Value
A boolean value. True
means the image is cropped and false
means the image has never been cropped.
getCropRegion
Get the crop region of the image (if the image is cropped).
Rect getCropRegion()
Return Value
A Rect value that stores the crop region. If the image is not cropped, the value will be null.
getOrientation
Set the orientation of the image.
int getOrientation()
Return Value
Int value that means the rotation angle of the image. The value is 0, 90, 180 or 270 with depends on the device orientation.
All examples of the orientation
setImageData
Set the pixel data of the image.
void setImageData(byte[] imageData)
Parameters
imageData
: A byte list that storing the image pixel data.
setWidth
Set the pixel width of the image.
void setWidth(int width)
Parameters
width
: The pixel value that stands for the width of the image.
setHeight
Set the pixel height of the image.
void setHeight(int height)
Parameters
height
: The pixel value that stands for the height of the image.
setStrides
Set the number of row bytes in each image plane.
void setStrides(int[] strides)
Parameters
strides
: The number of row bytes in each image plane.
setPixelFormat
Set the pixel format of the image.
void setPixelFormat(int pixelFormat)
Parameters
pixelFormat
: The pixelFormat of the image. View more in Dynamsoft Barcode Reader Enumeration ImagePixelFormat
setFrameID
Set the frameID
of the image.
void setFrameID(int frameID)
Parameters
frameID
: An int value that stands for the frameID
of the image.
setQuality
Set the frame quality of the image.
void setQuality(EnumFrameQuality quality)
Parameters
quality
: An Enumeration
value that means the frame quality. Read more in EnumFrameQuality
.
setIsCropped
Set whether the image is cropped.
void setIsCropped(boolean isCropped)
Parameters
isCropped
: A boolean value that means whether the image is cropped.
setCropRegion
Set the crop region of the image (if the frame is cropped).
void setCropRegion(Rect region)
Parameters
cropRegion
: A Rect value that means crop area of the image (if the frame is cropped).
setOrientation
Set the orientation of the image.
void setOrientation(int orientation)
Parameters
orientation
: Int value that means the rotation angle of the image.
toBitmap
The method converts the image to UIImage
to make it visible on the UI.
Bitmap toBitmap()
Return Value
The converted image.
Code Snippet
Bitmap frame = DCEFrame.toBitmap();