Class AbstractOCREngineOptions<T extends AbstractOCREngineOptions<T>>

java.lang.Object
com.microblink.photopay.entities.ocrengine.AbstractOCREngineOptions<T>
All Implemented Interfaces:
android.os.Parcelable
Direct Known Subclasses:
BlinkOCREngineOptions, DeepOCREngineOptions

public abstract class AbstractOCREngineOptions<T extends AbstractOCREngineOptions<T>> extends Object implements android.os.Parcelable
Options used in OCR. Shared between BlinkOCREngineOptions and DeepOCREngineOptions
  • Field Details

    • mNativeContext

      protected long mNativeContext
  • Constructor Details

    • AbstractOCREngineOptions

      protected AbstractOCREngineOptions(long nativeContext, @Nullable Object keep)
    • AbstractOCREngineOptions

      protected AbstractOCREngineOptions(long nativeContext, @NonNull android.os.Parcel in)
  • Method Details

    • getNativeContext

      public final long getNativeContext()
    • getMaximumAllowedCharRecognitionVariants

      public final int getMaximumAllowedCharRecognitionVariants()
      Returns the maximum allowed number of char recognition variants OCR engine will produce for each OcrChar.
      Returns:
      the maximum allowed number of char recognition variants OCR engine will produce for each OcrChar.
    • setMaximumAllowedCharRecognitionVariants

      @NonNull public final T setMaximumAllowedCharRecognitionVariants(@IntRange(from=0L) int maximumAllowedCharRecognitionVariants)
      Sets the maximum allowed number of char recognition variants OCR engine will produce for each OcrChar. By default, OCR engine will not produce char recognition variants (i.e. maximum allowed char recognition variants is 0). By setting this number to higher values, you can create more flexible OCR postprocessing algorithm because more char recognition variants will be available to you. However, setting it too high can lead to significant performance problems.
      Parameters:
      maximumAllowedCharRecognitionVariants - maximum allowed number of char recognition variants OCR engine will produce for each OcrChar
      Returns:
      this object, to support chaining of operations.
      See Also:
    • getMaximumCharsExpected

      public final int getMaximumCharsExpected()
      Returns the maximum number of chars expected in the image.
      Returns:
      the maximum number of chars expected in the image.
    • setMaximumCharsExpected

      @NonNull public final T setMaximumCharsExpected(@IntRange(from=0L) int maximumCharsExpected)
      Sets the maximum number of chars expected in the image. Setting this value can speed up the OCR processing because all images with more chars than specified will be ignored (becuase in most cases they are noise). Please note that noise characters are also counted. This means that if you expect 17 characters and usually get 25 characters (8 of which are noise), setting this to 17 will cause to return empty OCR result (because 25 characters is more than expected 17, even though 8 characters are noise). Use this option solely to increase OCR speed. This option will not increase OCR accuracy.
      Parameters:
      maximumCharsExpected - the maximum number of chars expected in the image.
      Returns:
      this object, to support chaining of operations.
    • isColorDropoutEnabled

      public final boolean isColorDropoutEnabled()
      Returns true if the additional image processing which drops background colors will be performed.
      Returns:
      true if the additional image processing which drops background colors will be performed.
    • setColorDropoutEnabled

      @NonNull public final T setColorDropoutEnabled(boolean colorDropoutEnabled)
      Specifies if the additional image processing which drops the background colors should be performed.

      Use this if you have black text on color backgrounds. If you have black text on white background, using this is not needed as it slows down processing. If you have color text, don't use it at all because color dropout will remove the text.

      Parameters:
      colorDropoutEnabled - whether dropping of colors from image should be performed
      Returns:
      this object, to support chaining of operations.
    • finalize

      protected final void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • terminateNative

      protected abstract void terminateNative(long nativeContext)
    • serializeNative

      @NonNull protected abstract byte[] serializeNative()
    • deserializeNative

      protected abstract void deserializeNative(@NonNull byte[] bytes)
    • describeContents

      public final int describeContents()
      Specified by:
      describeContents in interface android.os.Parcelable
    • writeToParcel

      public final void writeToParcel(@NonNull android.os.Parcel dest, int flags)
      Specified by:
      writeToParcel in interface android.os.Parcelable