Class DetectorRecognizer
java.lang.Object
com.microblink.blinkinput.entities.Entity<T>
com.microblink.blinkinput.entities.recognizers.Recognizer<R>
com.microblink.blinkinput.entities.recognizers.templating.TemplatingRecognizer<DetectorRecognizer.Result>
com.microblink.blinkinput.entities.recognizers.detector.DetectorRecognizer
- All Implemented Interfaces:
android.os.Parcelable,GlareDetectorOptions
Templating API recognizer for scanning generic documents by using custom
QuadWithSizeDetector.
This recognizer is used for implementing support for data extraction from custom document types
by using templating API. If you don't need data extraction, but only want to take cropped
document images, use DocumentCaptureRecognizer instead.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class com.microblink.blinkinput.entities.recognizers.templating.TemplatingRecognizer
CLASS_NAMEFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Create a copy of the entity.voidconsumeResultFrom(Entity other) Consume result from other entity.protected voiddeserializeNativeSettings(byte[] serializedSettings) Returns the detector that will be used for performing the document detection during recognitionbooleanReturns whether or not flipped recognition feature is enabled.protected byte[]voidsetAllowFlippedRecognition(boolean allowFlippedRecognition) Set this to true to enable recognition of document also in upside down direction.voidsetDetectGlare(boolean detectGlare) Defines whether glare detector will be used during recognition process.protected voidsetNativeTemplatingClasses(long[] nativeTemplatingClasses) booleanReturns whether glare detector is enabled.protected voidterminateNative(long nativeContext) voidwriteToParcel(android.os.Parcel dest, int flags) Methods inherited from class com.microblink.blinkinput.entities.recognizers.templating.TemplatingRecognizer
readFromParcel, setTemplatingClassesMethods inherited from class com.microblink.blinkinput.entities.recognizers.Recognizer
getName, isExcludedFromPing, requiresAutofocus, requiresLandscapeModeMethods inherited from class com.microblink.blinkinput.entities.Entity
describeContents, finalize, getNativeContext, getResult, nativeGetNativeResultContext
-
Field Details
-
CREATOR
-
-
Constructor Details
-
DetectorRecognizer
- Parameters:
detector- Detector that will be used for performing document detection during recognition
-
-
Method Details
-
getDetector
Returns the detector that will be used for performing the document detection during recognition- Returns:
- the detector
-
setAllowFlippedRecognition
public void setAllowFlippedRecognition(boolean allowFlippedRecognition) Set this to true to enable recognition of document also in upside down direction. This is useful if detector being used cannot determine correct orientation of detected document (for exampleDocumentDetector). Keep in mind that enabling this feature will make recognition two times slower and possibly less accurate. By default, this is turned off.- Parameters:
allowFlippedRecognition- whether or not flipped recognition is allowed
-
isAllowFlippedRecognition
public boolean isAllowFlippedRecognition()Returns whether or not flipped recognition feature is enabled. For more information, seesetAllowFlippedRecognition(boolean).- Returns:
- whether or not flipped recognition feature is enabled
-
setDetectGlare
public void setDetectGlare(boolean detectGlare) Description copied from interface:GlareDetectorOptionsDefines whether glare detector will be used during recognition process. By default this option is set totrueand glare detector is used. If the glare detector is used andGlareCallbackis set toMetadataCallbacks, it will receive glare status will. Also when glare is detected OCR will not be performed on the affected document position to prevent errors in the extracted data. By default, this is set to 'true'.- Parameters:
detectGlare- whether glare detector will be used during recognition process.
-
shouldDetectGlare
public boolean shouldDetectGlare()Description copied from interface:GlareDetectorOptionsReturns whether glare detector is enabled. By default, this is set to 'true'.- Returns:
- it the glare detector is enabled returns
true, otherwise returnsfalse.
-
setNativeTemplatingClasses
protected void setNativeTemplatingClasses(@Nullable long[] nativeTemplatingClasses) - Specified by:
setNativeTemplatingClassesin classTemplatingRecognizer<DetectorRecognizer.Result>
-
terminateNative
protected void terminateNative(long nativeContext) - Specified by:
terminateNativein classEntity<DetectorRecognizer.Result>
-
serializeNativeSettings
@Nullable protected byte[] serializeNativeSettings()- Specified by:
serializeNativeSettingsin classEntity<DetectorRecognizer.Result>
-
deserializeNativeSettings
protected void deserializeNativeSettings(@NonNull byte[] serializedSettings) - Specified by:
deserializeNativeSettingsin classEntity<DetectorRecognizer.Result>
-
clone
Description copied from class:EntityCreate a copy of the entity. This is required if properties of the entity must be modified while background thread performs processing. In order to avoid race conditions, changing properties is not allowed while entity is used in background processing. However, you are able to make a copy of the entity, change properties of it and then update theRecognizerRunnerVieworRecognizerRunnerwith the updated entity hierarchy.- Specified by:
clonein classRecognizer<DetectorRecognizer.Result>- Returns:
- a copy of the entity
-
consumeResultFrom
Description copied from class:EntityConsume result from other entity. The result from other will be put instead current result of this entity. This method is used insideBaseIntentTransferable.loadFromIntent(Intent)and similar methods to replace the result content of the saved entities with results that have arrived overIntent- Overrides:
consumeResultFromin classTemplatingRecognizer<DetectorRecognizer.Result>- Parameters:
other- Entity from which result should be consumed.
-
writeToParcel
public void writeToParcel(@NonNull android.os.Parcel dest, int flags) - Specified by:
writeToParcelin interfaceandroid.os.Parcelable- Overrides:
writeToParcelin classTemplatingRecognizer<DetectorRecognizer.Result>
-