Class ImageBuilder
- java.lang.Object
-
- com.microblink.documentverification.image.ImageBuilder
-
public class ImageBuilder extends java.lang.ObjectUtility class that can buildImageobject from various sources.
-
-
Constructor Summary
Constructors Constructor Description ImageBuilder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ImagebuildImageFromCamera1NV21Frame(byte[] imageBuffer, int imageWidth, int imageHeight, Orientation imageOrientation, Rectangle scanningRegion)static ImagebuildImageFromCamera2Image(android.media.Image image, Orientation imageOrientation, Rectangle scanningRegion)Builds image object from Camera2 frame in YUV_420_888 format.static ImagebuildImageFromJpegBytes(byte[] bytes, int imageOrientation)static ImagebuildImageFromNativeContext(long nativeContext, boolean ownsNativeObject, java.lang.Object keep)Builds image object from native context.
-
-
-
Method Detail
-
buildImageFromNativeContext
@NonNull public static Image buildImageFromNativeContext(long nativeContext, boolean ownsNativeObject, @Nullable java.lang.Object keep)
Builds image object from native context. This method is called from native code. Calling it directly from Java with invalid native context will crash the app.- Parameters:
nativeContext- Native pointer containing native image object.ownsNativeObject- Is native image owned by java object (i.e. should it be deleted on finalization)keep- Object that must be kept alive while Image object is alive.- Returns:
Imageobject for usage via RecognizerRunner'sRecognizerRunnerobject.
-
buildImageFromCamera2Image
@NonNull public static Image buildImageFromCamera2Image(@NonNull android.media.Image image, @NonNull Orientation imageOrientation, @Nullable Rectangle scanningRegion)
Builds image object from Camera2 frame in YUV_420_888 format.- Parameters:
image-Imageobject that contains image from which MicroBlinkImagewill be built. You must ensure that this object is not closed while returnedImageis in use. Doing so will lead to undefined behaviour.imageOrientation- Orientation of the device at the timeImagewas created. Cannot be null norOrientation.ORIENTATION_UNKNOWN.scanningRegion- Region of image that will be used for recognition. If null, entire image will be used.- Returns:
Imageobject for usage via RecognizerRunner'sRecognizerRunnerobject.
-
buildImageFromCamera1NV21Frame
@NonNull public static Image buildImageFromCamera1NV21Frame(@NonNull byte[] imageBuffer, int imageWidth, int imageHeight, @NonNull Orientation imageOrientation, @Nullable Rectangle scanningRegion)
-
buildImageFromJpegBytes
@NonNull public static Image buildImageFromJpegBytes(@Nullable byte[] bytes, int imageOrientation)
-
-