-
- All Implemented Interfaces:
-
io.scanbot.sdk.generictext.GenericTextRecognizer
public final class DefaultGenericTextRecognizer implements GenericTextRecognizer
Default implementation for GenericTextRecognizer
-
-
Field Summary
Fields Modifier and Type Field Description private IntegerminimumNumberOfRequiredFramesWithEqualRecognitionResultprivate IntegermaximumNumberOfAccumulatedFramesprivate IntegerocrResolutionLimitprivate Set<Language>supportedLanguagesprivate Set<Character>allowedSymbolsprivate BooleanmatchSubstringForPatternprivate TextFilterStrategytextFilterStrategy
-
Constructor Summary
Constructors Constructor Description DefaultGenericTextRecognizer(BlobManager blobManager)
-
Method Summary
Modifier and Type Method Description IntegergetMinimumNumberOfRequiredFramesWithEqualRecognitionResult()Minimum number of accumulated frames that have equal result UnitsetMinimumNumberOfRequiredFramesWithEqualRecognitionResult(Integer minimumNumberOfRequiredFramesWithEqualRecognitionResult)IntegergetMaximumNumberOfAccumulatedFrames()Maximum number of accumulated frames to inspect before actual result is returned UnitsetMaximumNumberOfAccumulatedFrames(Integer maximumNumberOfAccumulatedFrames)IntegergetOcrResolutionLimit()The image will be downscaled to the given value during the processing. UnitsetOcrResolutionLimit(Integer ocrResolutionLimit)Set<Language>getSupportedLanguages()Languages on which the recognition will be run UnitsetSupportedLanguages(Set<Language> supportedLanguages)Set<Character>getAllowedSymbols()Allowed symbols to be detected UnitsetAllowedSymbols(Set<Character> allowedSymbols)BooleangetMatchSubstringForPattern()Find and match only part of the whole string if the pattern is used UnitsetMatchSubstringForPattern(Boolean matchSubstringForPattern)TextFilterStrategygetTextFilterStrategy()Additional parameter to set the type of the scanned object. UnitsetTextFilterStrategy(TextFilterStrategy textFilterStrategy)GenericTextRecognitionResultscanNv21(ByteArray nv21, Integer width, Integer height, Integer orientation, Rect finderRect)Scan image to recognize text on it UnitsetValidator(String validator, GenericTextRecognizer.GenericTextValidationCallback callback)Sets the configuration to use during the validation UnitsetCleaner(GenericTextRecognizer.CleanRecognitionResultCallback callback)Sets the cleaner for the raw text to prepare the raw recognized string to validation. UnitcleanRecognitionQueue()Allows to clean the accumulated frames inside the recognizer. -
-
Method Detail
-
getMinimumNumberOfRequiredFramesWithEqualRecognitionResult
Integer getMinimumNumberOfRequiredFramesWithEqualRecognitionResult()
Minimum number of accumulated frames that have equal result
-
setMinimumNumberOfRequiredFramesWithEqualRecognitionResult
Unit setMinimumNumberOfRequiredFramesWithEqualRecognitionResult(Integer minimumNumberOfRequiredFramesWithEqualRecognitionResult)
-
getMaximumNumberOfAccumulatedFrames
Integer getMaximumNumberOfAccumulatedFrames()
Maximum number of accumulated frames to inspect before actual result is returned
-
setMaximumNumberOfAccumulatedFrames
Unit setMaximumNumberOfAccumulatedFrames(Integer maximumNumberOfAccumulatedFrames)
-
getOcrResolutionLimit
Integer getOcrResolutionLimit()
The image will be downscaled to the given value during the processing. If the quality of the scanning is not enough, try to increase the limit. This variable affects the performance of the scanning process. Higher the size limit - better the quality, but the recognition is slower
0 - do not rescale.
-
setOcrResolutionLimit
Unit setOcrResolutionLimit(Integer ocrResolutionLimit)
-
getSupportedLanguages
Set<Language> getSupportedLanguages()
Languages on which the recognition will be run
-
setSupportedLanguages
Unit setSupportedLanguages(Set<Language> supportedLanguages)
-
getAllowedSymbols
Set<Character> getAllowedSymbols()
Allowed symbols to be detected
-
setAllowedSymbols
Unit setAllowedSymbols(Set<Character> allowedSymbols)
-
getMatchSubstringForPattern
Boolean getMatchSubstringForPattern()
Find and match only part of the whole string if the pattern is used
-
setMatchSubstringForPattern
Unit setMatchSubstringForPattern(Boolean matchSubstringForPattern)
-
getTextFilterStrategy
TextFilterStrategy getTextFilterStrategy()
Additional parameter to set the type of the scanned object. TextFilterStrategy.Document by default
-
setTextFilterStrategy
Unit setTextFilterStrategy(TextFilterStrategy textFilterStrategy)
-
scanNv21
GenericTextRecognitionResult scanNv21(ByteArray nv21, Integer width, Integer height, Integer orientation, Rect finderRect)
Scan image to recognize text on it
- Parameters:
nv21- image in form of nv21-encoded byte arraywidth- image width, pixelsheight- image height, pixelsorientation- image orientation.finderRect- if non-null - perform scanning only in given area.
-
setValidator
Unit setValidator(String validator, GenericTextRecognizer.GenericTextValidationCallback callback)
Sets the configuration to use during the validation
- Parameters:
validator- sets a validation pattern (Supports ?callback- callback to validate a string in recognizer
-
setCleaner
Unit setCleaner(GenericTextRecognizer.CleanRecognitionResultCallback callback)
Sets the cleaner for the raw text to prepare the raw recognized string to validation. Allows to increase the quality and speed of the recognition
- Parameters:
callback- callback to clean the raw text extracted from the picture and to extract only valuable part from it
-
cleanRecognitionQueue
Unit cleanRecognitionQueue()
Allows to clean the accumulated frames inside the recognizer. Should be called if reusing the instance after getting the successful result
-
-
-
-