Frame Data
Defined in package com.scandit.datacapture.core.data
- Channel
Added in version 6.0.0
Enumeration of possible channel types.
- Y
Added in version 6.0.0
Luminance (Y) or gray-scale channel
- U
Added in version 6.0.0
- V
Added in version 6.0.0
- R
Added in version 6.0.0
Red channel
- G
Added in version 6.0.0
Green channel
- B
Added in version 6.0.0
Blue channel
- A
Added in version 6.0.0
Alpha channel
- FrameData
interface FrameData
Added in version 6.0.0
Interface for holding frame data from one or more sources (cameras). The concrete type is tied to the frame source that produces the frames.
The frame data contains one or more image buffers, each of which may have different sizes. Each frame data is guaranteed to have at least one image buffer. Only frame sources that combine the input of multiple frame sources will have more than one image buffer.
A frame contains the pixel data as well as layout of one particular frame. Frames are immutable and reference counted, so they can be shared by multiple consumers. The frame is returned to the pool (recycled) when all consumers release the frame.
- retain()
void
retain()Added in version 6.0.0
Increments the reference count of the video frame by one. Must be balanced by a matching call to release().
- release()
void
release()Added in version 6.0.0
Decrements the reference count of the video frame by one. When the reference count drops to zero, the frame is recycled. Must be balanced by a call to retain().
- orientation
int
getOrientation()Added in version 6.0.0
The orientation of the image buffer contained in this frame data. The value is the angle that the camera image needs to be rotated clockwise so it shows correctly on the display in its natural orientation. It is 0, 90, 180, or 270. A typical value for this is 90 as most camera modules record the frames in landscape right orientation. Rotating a landscape right frame by 90 degrees will show it correctly on the display in portrait orientation (which is the natural device orientation of most phones).
- imageBuffer
@NonNull ImageBuffer getImageBuffer()
Added in version 6.0.0
The image buffer contained in this frame data.
- timestamp
long
getTimestamp()Added in version 6.16.0
The timestamp of the frame data in ns from the epoch.
- equals(other)
boolean
equals(@Nullable Object other)Added in version 6.1.0
Indicates whether some other object is equal to this one.
- hashCode()
int
hashCode()Added in version 6.1.0
Returns a hash code value for the object.
- ImagePlane
class ImagePlane
Added in version 6.0.0
An individual image plane as part of an image buffer. The image plane data may or may not be interleaved with other image planes.
- ImagePlane()
ImagePlane(Channel channel,
int
subsamplingX,int
subsamplingY,int
rowStride,int
pixelStride, @NonNull ByteBuffer data)Added in version 6.0.0
Creates a new image plane instance from channel, subsamplingX, subsamplingY, rowStride, pixelStride and data.
- data
@NonNull ByteBuffer getData()
Added in version 6.0.0
The bytes used by this image plane. For interleaved image planes, parts of the bytes exposed this property may not be part of this plane and belong to other planes. For example, for an ImageBuffer with red, green and blue planes using an interleaved layout, only every third byte belongs to the red image plane.
The life-time of the data is tied to the life-time of the ImageBuffer, which for image buffers belonging to frame data is bound to the life-time of the FrameData instance.
- subsamplingX
int
getSubsamplingX()Added in version 6.0.0
The amount of subsampling (in pixels in X-direction). For image plane with the exception of U and V planes, the subsampling in both x and y will be 1 (meaning no subsampling). A subsampling of 2 indicates that two horizontally adjacent pixels share the same pixel data.
- subsamplingY
int
getSubsamplingY()Added in version 6.0.0
The amount of subsampling (in pixels in Y-direction). For image plane with the exception of U and V planes, the subsampling in both x and y will be 1 (meaning no subsampling). A subsampling of 2 indicates that two vertically adjacent pixels share the same pixel data.
- rowStride
int
getRowStride()Added in version 6.0.0
The number of bytes of a row of pixels. For example, an RGB image will typically have a row stride of 3 * width, with potential padding at the end to match mulitples of 4.
- pixelStride
int
getPixelStride()Added in version 6.0.0
Number of bytes between two adjacent pixels part of the same image plane. In case of subsampling, this value is the number of bytes per pixel as if there were no subsampling. For example, for a non-interleaved U plane subsampled at 2, the element stride is 1.
- ImageBuffer
class ImageBuffer
Added in version 6.0.0
An image buffer consists of one or more images planes that describe how the memory is laid out. Instances of this class don’t own the data, rather the data is owned by another class (typically a FrameData instance).
- ImageBuffer()
ImageBuffer(
int
width,int
height, @NonNull ArrayList<@NonNull ImagePlane> planes)Added in version 6.0.0
Create new image buffer instance from width, height and planes.
- width
int
getWidth()Added in version 6.0.0
Width of the image buffer in pixels (non-subsampled).
- height
int
getHeight()Added in version 6.0.0
Height of the image buffer in pixels (non-subsampled).
- planes
@NonNull List<@NonNull ImagePlane> getPlanes()
Added in version 6.0.0
List of planes that this image buffer holds. The data used by these image planes may or may not be part of the same block of memory.
- toBitmap()
@NonNull Bitmap toBitmap()
Added in version 6.1.0
Converts the video frame to an RGB bitmap that can be visualized in the UI, or stored on disk.
Depending on the underlying representation, this call may require an image conversion to a different format. As such, it’s a relatively expensive operation. Make sure to only call this method when the image is required.
The returned image has the same dimensions as the video frame.
- deepCopy()
@NonNull ImageBuffer deepCopy()
Added in version 6.7.0
Creates a deep copy of this image buffer.