Class RecognizerBundle
java.lang.Object
com.microblink.blinkid.intent.BaseIntentTransferable<RecognizerBundle>
com.microblink.blinkid.entities.recognizers.RecognizerBundle
- All Implemented Interfaces:
android.os.Parcelable
,com.microblink.blinkid.intent.MBIntentTransferable
public class RecognizerBundle
extends com.microblink.blinkid.intent.BaseIntentTransferable<RecognizerBundle>
Represents a bundle of
Recognizer
objects that can travel via Intent
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
-
Field Summary
Modifier and TypeFieldDescriptionstatic final android.os.Parcelable.Creator<RecognizerBundle>
static final int
Constant used as argument forsetNumMsBeforeTimeout(int)
method when timeout should be set to infinity.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ConstructorDescriptionRecognizerBundle
(Recognizer... recognizers) RecognizerBundle
(List<Recognizer> recognizerList) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
consumeContentFromLoadedObject
(RecognizerBundle loadedBundle) Consumes content from object loaded from intent.static final RecognizerBundle
createFromIntent
(android.content.Intent intent) Creates object of this class fromIntent
.boolean
protected android.os.Parcelable.Creator<RecognizerBundle>
Returns parcelable creator for concrete intent transferable type.int
Returns the duration in milliseconds that needs to pass since scanning has begun in order to define timeout.Returns the current recognition mode.Returns the array of recognizers associated with this bundle.protected String
Returns intent extra that will be used for transferring object unique ID.protected void
readFromParcel
(android.os.Parcel in) void
saveToIntent
(android.content.Intent intent) void
setAllowMultipleScanResultsOnSingleImage
(boolean multiScan) Sets whether or not outputting of multiple scan results from same image is allowed.void
Sets the mode of the frame quality estimation.void
setNumMsBeforeTimeout
(int numMsBeforeTimeout) Set the duration in milliseconds that needs to pass since scanning has begun in order to define timeout.void
setRecognitionDebugMode
(RecognizerBundle.RecognitionDebugMode recognitionMode) This method is for debugging and testing purposes only.boolean
Returns true if multiple scan results can be obtained from single image.void
writeToParcel
(android.os.Parcel dest, int flags) Methods inherited from class com.microblink.blinkid.intent.BaseIntentTransferable
clearSavedState, describeContents, existsInIntent, loadFromIntent, saveState
-
Field Details
-
TIMEOUT_INFINITY
public static final int TIMEOUT_INFINITYConstant used as argument forsetNumMsBeforeTimeout(int)
method when timeout should be set to infinity. Effectively, this means that recognition timeout will be disabled. -
CREATOR
-
-
Constructor Details
-
RecognizerBundle
-
RecognizerBundle
-
-
Method Details
-
createFromIntent
@Nullable public static final RecognizerBundle createFromIntent(@NonNull android.content.Intent intent) Creates object of this class fromIntent
.- Parameters:
intent
- intent in which object is stored.- Returns:
- created object or
null
if it does not exist in the given intent.
-
getRecognizers
Returns the array of recognizers associated with this bundle.- Returns:
- the array of recognizers associated with this bundle.
-
getRecognitionDebugMode
Returns the current recognition mode.- Returns:
- the current recognition mode.
-
setRecognitionDebugMode
This method is for debugging and testing purposes only. Please do not use it because calling it with wrong parameter might cause scanning loop to never terminate.- Parameters:
recognitionMode
- Requested mode of recognition.
-
shouldAllowMultipleScanResultsOnSingleImage
public boolean shouldAllowMultipleScanResultsOnSingleImage()Returns true if multiple scan results can be obtained from single image. SeesetAllowMultipleScanResultsOnSingleImage(boolean)
for details.- Returns:
- true if multiple scan results can be obtained from single image.
-
setAllowMultipleScanResultsOnSingleImage
public void setAllowMultipleScanResultsOnSingleImage(boolean multiScan) Sets whether or not outputting of multiple scan results from same image is allowed. If that is true, it is possible to return multiple recognition results from same image. If this option is false, at most single recognizer inside this bundle will be updated with latest results. If this option is true, it is possible that multiple recognizers inside this bundle will be updated with latest results. The upside of setting that option to false is the speed - if you have lots of recognizers in this bundle, as soon as the first recognizer succeeds in scanning, recognition chain will be terminated and other recognizers will not get a chance to analyze the image. The downside is that you are then unable to obtain multiple results from single image. -
setNumMsBeforeTimeout
public void setNumMsBeforeTimeout(int numMsBeforeTimeout) Set the duration in milliseconds that needs to pass since scanning has begun in order to define timeout. Please be aware that time counting does not start from the moment when scanning starts. Instead it starts from the moment when at least oneRecognizer.Result
inside recognizers in this bundle changes its stateRecognizer.Result.getResultState()
to eitherRecognizer.Result.State.Uncertain
orRecognizer.Result.State.Valid
. The reason for this is the better user experience in cases when for example timeout is set to 10 seconds and user starts scanning and leaves device lying on table for 9 seconds and then points the device towards the object it wants to scan: in such case it is better to let that user scan the object it wants instead of completing scan with empty scan result as soon as 10 seconds timeout ticks out.- Parameters:
numMsBeforeTimeout
- duration in milliseconds
-
getNumMsBeforeTimeout
public int getNumMsBeforeTimeout()Returns the duration in milliseconds that needs to pass since scanning has begun in order to define timeout.- Returns:
- the duration in milliseconds that needs to pass since scanning has begun in order to define timeout.
- See Also:
-
setFrameQualityEstimationMode
public void setFrameQualityEstimationMode(@NonNull RecognizerBundle.FrameQualityEstimationMode mode) Sets the mode of the frame quality estimation. If automatic, it will be used if at least one enabled recognizer requires it or if device is fast enough to perform it always (default). If always on or always off, it will not depend on active recognizers nor device. Frame quality estimation helps choosing the best possible frame from camera stream for processing.- Parameters:
mode
- Desired mode of frame quality estimation.
-
getFrameQualityEstimationMode
-
getUniqueIdIntentExtraKey
Description copied from class:com.microblink.blinkid.intent.BaseIntentTransferable
Returns intent extra that will be used for transferring object unique ID. Different concrete classes cannot use the same intent extra key for this purpose because that will make sending objects from different concrete classes over the same intent impossible.- Specified by:
getUniqueIdIntentExtraKey
in classcom.microblink.blinkid.intent.BaseIntentTransferable<RecognizerBundle>
- Returns:
- intent extra that will be used for transferring object unique ID.
-
getConcreteCreator
Description copied from class:com.microblink.blinkid.intent.BaseIntentTransferable
Returns parcelable creator for concrete intent transferable type.- Specified by:
getConcreteCreator
in classcom.microblink.blinkid.intent.BaseIntentTransferable<RecognizerBundle>
- Returns:
- parcelable creator for concrete intent transferable type.
-
consumeContentFromLoadedObject
Description copied from class:com.microblink.blinkid.intent.BaseIntentTransferable
Consumes content from object loaded from intent.- Specified by:
consumeContentFromLoadedObject
in classcom.microblink.blinkid.intent.BaseIntentTransferable<RecognizerBundle>
-
saveToIntent
public void saveToIntent(@NonNull android.content.Intent intent) - Specified by:
saveToIntent
in interfacecom.microblink.blinkid.intent.MBIntentTransferable
- Overrides:
saveToIntent
in classcom.microblink.blinkid.intent.BaseIntentTransferable<RecognizerBundle>
- Parameters:
intent
- Intent to whichRecognizerBundle
should be saved.
-
equals
-
readFromParcel
protected void readFromParcel(@NonNull android.os.Parcel in) - Overrides:
readFromParcel
in classcom.microblink.blinkid.intent.BaseIntentTransferable<RecognizerBundle>
-
writeToParcel
public void writeToParcel(@NonNull android.os.Parcel dest, int flags) - Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
- Overrides:
writeToParcel
in classcom.microblink.blinkid.intent.BaseIntentTransferable<RecognizerBundle>
-