Package com.digimarc.capture.camera
Class ImageData
java.lang.Object
com.digimarc.capture.camera.ImageData
Container for image data. In most cases the data can be either array of bytes or array of Planes
but not both.
-
Field Summary
FieldsModifier and TypeFieldDescriptionandroid.hardware.camera2.CaptureResult
Camera2 device meta data.float[]
Meta-data gains and color correction data.final int
Height of image datafinal Object
Type of image datafinal HelperCaptureFormat
HelperCaptureFormat
of image datafinal boolean
Is image data a formatted Bitmap ?final int
Bytes per row of image datafloat[]
Meta-data color correction data.final int
Width of image data -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ImageData
attachToImage
(android.media.Image image) Creates an ImageData object and initializes it with the contents of a Camera2 Image buffer.int
Get the image buffer size needed to create a copy of this image.boolean
The internal readers within DM SDK require ImageData with a BufferType of ImagePlane[].
-
Field Details
-
mImageData
Type of image data -
mWidth
public final int mWidthWidth of image data -
mHeight
public final int mHeightHeight of image data -
mRowBytes
public final int mRowBytesBytes per row of image data -
mImageFormat
HelperCaptureFormat
of image data -
mIsBitmap
public final boolean mIsBitmapIs image data a formatted Bitmap ? -
mCaptureMeta
@Nullable public android.hardware.camera2.CaptureResult mCaptureMetaCamera2 device meta data. Only required for raw-sensor processing. -
mGains
@Nullable public float[] mGainsMeta-data gains and color correction data. For Internal use or file-based testing only. -
mTransform
@Nullable public float[] mTransformMeta-data color correction data. For Internal use or file-based testing only.
-
-
Constructor Details
-
ImageData
public ImageData(@NonNull Object data, int _width, int _height, int _rowBytes, @NonNull HelperCaptureFormat _imageFormat, boolean _isBitmap) -
ImageData
-
-
Method Details
-
attachToImage
Creates an ImageData object and initializes it with the contents of a Camera2 Image buffer. The data within the Image is used as it stands - new buffers or copies of the data are not created. The image will become invalid once Image.close() is called.- Parameters:
image
- Camera2 Image buffer- Returns:
- An ImageData object that wraps the passed in image.
-
isRepackageRequired
public boolean isRepackageRequired()The internal readers within DM SDK require ImageData with a BufferType of ImagePlane[]. The ImagePlanes also need to have their buffers allocated as direct buffers. This method checks the content of the image to determine whether it will need to be repackaged before being passed to the readers.- Returns:
- True if the image needs repackaging, false otherwise.
-
getImageBufferSize
public int getImageBufferSize()Get the image buffer size needed to create a copy of this image. For images that are holding a byte[] this will be the size of the array. For images holding an ImagePlane[] it will be the size of the buffer in the first plane.- Returns:
- Size needed to copy this image.
-