Class ImageBuilder

java.lang.Object
com.microblink.blinkid.image.ImageBuilder

public class ImageBuilder extends Object
Utility class that can build Image object from various sources.
  • Constructor Details

    • ImageBuilder

      public ImageBuilder()
  • Method Details

    • buildImageFromNativeContext

      @NonNull public static Image buildImageFromNativeContext(long nativeContext, boolean ownsNativeObject, @Nullable 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:
      Image object for usage via RecognizerRunner's RecognizerRunner object.
    • buildImageFromJpegBytes

      @NonNull public static Image buildImageFromJpegBytes(@NonNull byte[] bytes, int imageOrientation)
    • buildInputImageFromNativeContext

      @NonNull public static InputImage buildInputImageFromNativeContext(long nativeContext, boolean ownsNativeObject, @Nullable 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:
      Image object for usage via RecognizerRunner's RecognizerRunner object.
    • buildInputImageFromCamera2Image

      @NonNull public static InputImage buildInputImageFromCamera2Image(@NonNull android.media.Image image, @NonNull Orientation imageOrientation, @Nullable Rectangle scanningRegion)
      Builds input image object from Camera2 frame in YUV_420_888 format.
      Parameters:
      image - Image object that contains image from which MicroBlink Image will be built. You must ensure that this object is not closed while returned Image is in use. Doing so will lead to undefined behaviour.
      imageOrientation - Orientation of the device at the time Image was created. Cannot be null nor Orientation.ORIENTATION_UNKNOWN.
      scanningRegion - Region of image that will be used for recognition. If null, entire image will be used.
      Returns:
      Image object for usage via RecognizerRunner's RecognizerRunner object.
    • buildInputImageFromCamera1NV21Frame

      @NonNull public static InputImage buildInputImageFromCamera1NV21Frame(@NonNull byte[] imageBuffer, int imageWidth, int imageHeight, @NonNull Orientation imageOrientation, @Nullable Rectangle scanningRegion)
    • buildInputImageFromImage

      @NonNull public static InputImage buildInputImageFromImage(Image img)