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-
Nested Class Summary
-
Field Summary
FieldsFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractOCREngineOptions
(long nativeContext, android.os.Parcel in) protected
AbstractOCREngineOptions
(long nativeContext, Object keep) -
Method Summary
Modifier and TypeMethodDescriptionfinal int
protected abstract void
deserializeNative
(byte[] bytes) protected final void
finalize()
final int
Returns the maximum allowed number of char recognition variants OCR engine will produce for eachOcrChar
.final int
Returns the maximum number of chars expected in the image.final long
final boolean
Returns true if the additional image processing which drops background colors will be performed.protected abstract byte[]
final T
setColorDropoutEnabled
(boolean colorDropoutEnabled) Specifies if the additional image processing which drops the background colors should be performed.final T
setMaximumAllowedCharRecognitionVariants
(int maximumAllowedCharRecognitionVariants) Sets the maximum allowed number of char recognition variants OCR engine will produce for each OcrChar.final T
setMaximumCharsExpected
(int maximumCharsExpected) Sets the maximum number of chars expected in the image.protected abstract void
terminateNative
(long nativeContext) final void
writeToParcel
(android.os.Parcel dest, int flags)
-
Field Details
-
mNativeContext
protected long mNativeContext
-
-
Constructor Details
-
AbstractOCREngineOptions
-
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 eachOcrChar
.- 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
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
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
-
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 interfaceandroid.os.Parcelable
-
writeToParcel
public final void writeToParcel(@NonNull android.os.Parcel dest, int flags) - Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
-