Comments (11)
When creating RecognizerSettings object, you can add multiple recognizers to it.
By default, when multiple recognizers are active, the first one who recognises the image returns the result - this means that either barcode or OCR will be performed on camera frame. However, if you want to ensure both recognizers are executed for every camera frame (regardless if first one has already successfully recognised image), you can allow returning multiple results.
from blinkid-android.
I still cannot get 2 type of scan in same time. May I know what is the problem? Thank you
RecognitionSettings settings = new RecognitionSettings();
settings.setAllowMultipleScanResultsOnSingleImage(true);
// setup array of recognition settings (described in chapter "Recognition
// settings and results")
//settings.setRecognizerSettingsArray(setupPhoneNumberReader());
settings.setRecognizerSettingsArray(setupBarcodeReader());
intent.putExtra(ScanCard.EXTRAS_RECOGNITION_SETTINGS, settings);
// Starting Activity
startActivityForResult(intent, MY_REQUEST_CODE);
.
.
.
private RecognizerSettings[] setupBarcodeReader(){
Log.i(TAG, "barcode is Recognised, Select barcode Setting. ");
ZXingRecognizerSettings sett = new ZXingRecognizerSettings();
BlinkOCRRecognizerSettings sett1 = BarcodeTemplate.barcodeTemplate();
sett.setInverseScanning(false);
sett.setScanCode128(true);
return new RecognizerSettings[]{sett1, sett};
}
from blinkid-android.
Hi @leeyikkong,
if you allow multiple scan results on a single image, that does not mean that you will always obtain results from all used recognizers. This just means that when some recognizer has produced the result on the current frame, recognition chain will not be stopped and other recognizers will get a chance to use current frame to produce the result. It is not mandatory for all recognizers to produce results and you will obtain results only from successful recognizers. In your case barcode recognizer is faster than BlinkOCRRecognizer and needs a less number of frames to produce the result. BlinkOCRRecognizer gets chance to produce the result from the same number of frames, but it does not succeed and only barcode result is returned.
If you want to be sure that you will always obtain both results, you have two options:
-
Use provided scan activity (ScanCard for example) and when you obtain results, store them and exclude RecognizerSettings for the recognizer/recognizers that have produced the result/results. Then start activity again with updated recognition settings (exclude successful recognizers) to obtain missing results.
-
Implement your own custom scan activity and when you obtain results in onScanningDone method, store the results and use the reconfigureRecognizers method on RecognizerView to set new recognition settings with excluded recognizers that have already produced results.
Second option is much better because you do not have to start scan activity multiple times, which means better user experience, but it will take more time to implement.
from blinkid-android.
for the first option, which mean is after first scan activity done, then it auto restart another scancard activity again, but using the other recognizer setting?
from blinkid-android.
if use blinkocr, it can scan barcode and other information in the same time? I go through one of the demo application of blinkOCR, if not mistaken is the blinkOCRFullScreen, when i scan the barcode, it also will show the other information in the same time.
from blinkid-android.
Yes, you are right for the first option.
The demo app that you have mentioned (BlinkOCRFullScreen) uses the second approach which is better, you can use code from FullScreenOCR activity as an example for implementing your own activity. BlinkOCR SDK is included in the BlinkID SDK and you can use all its components in BlinkID.
from blinkid-android.
public void onScanningDone(RecognitionResults results) {
Barcode barcode = null;
// called when scanning completes. In this example, we first check if dataArray contains
// barcode result and display a barcode contents in the Toast.
// We also check if dataArray contains raw parser result and log it to ADB.
BaseRecognitionResult[] dataArray = results.getRecognitionResults();
for (BaseRecognitionResult r : dataArray) {
if (r instanceof BarDecoderScanResult) { // r is barcode scan result
BarDecoderScanResult bdsr = (BarDecoderScanResult) r;
//BlinkOCRRecognitionResult bocrRes = (BlinkOCRRecognitionResult) r;
// create toast with contents: Barcode type: barcode contents
String res = bdsr.getStringData();
barcodeNo = res;
Log.i("Parsed bar", res.replace("[^0-9 ]", ""));
} else if (r instanceof BlinkOCRRecognitionResult) {
BlinkOCRRecognitionResult bocrRes = (BlinkOCRRecognitionResult) r;
// obtain parse result from the parser named "Raw"
String result = bocrRes.getParsedResult("Raw");
String rawParsed = result.replaceAll("[^0-9]", "");
Log.i(TAG, "Parsed >> " + rawParsed.replaceAll("[^0-9]", ""));
if (rawParsed.substring(0, 3).equals("015") || rawParsed.substring(0, 3).equals("010")) {
if (rawParsed.substring(0, 3).equals("015")) {
phoneNo = rawParsed.substring(0, 3) + "-" + rawParsed.substring(3, 7) + " " + rawParsed.substring(7, 11);
} else {
phoneNo = rawParsed.substring(0, 3) + "-" + rawParsed.substring(3, 6) + " " + rawParsed.substring(6, 10);
}
Log.i(TAG, "My Phone Number = " + phoneNo);
Log.i(TAG, "My Barcode Number = " + barcodeNo);
} else {
Log.i(TAG, " BECAUSE OF HERE CRASH MY APPLICATION");
}
/* // obtain OCR result that was used for parsing
OcrResult ocrResult = bocrRes.getOcrResult();
Log.i(TAG,"OcrResult >>" + ocrResult.toString());*/
}
}
// Finally we reset recognizer's internal state so it will not combine old recognition
// results with new one. Scanning is resumed automatically after this method ends.
mRecognizerView.resetRecognitionState();
}
May I know how to rescan the information when I get the information that I do not need? The application will crash because of the results get from the scan which are NOT I want. When the First Scan is started, it will get the result, that why if sometime my camera did not point to the information that I want to scan, it will get the wrong information. Thank You.
from blinkid-android.
Hi @leeyikkong,
you should not crash your application when you obtain the result(information) which you don't need. Just continue scanning until you get the desired information.
from blinkid-android.
because of it continue scanning, I can see the result in Log, it continue show the result, sometime the result is symbol, sometime show digit/characters. if I want to get the correct result, then how should I get it?
from blinkid-android.
You should try different parser for the information you want to recognize, RawParser
returns raw text (everything). You can try using the RegexParser with regular expression that describes the information which you want to read. Please, take a look at this example.
from blinkid-android.
Its WORK! Thanks a lot..
from blinkid-android.
Related Issues (20)
- Camera view has no children?!? HOT 1
- How to change to front-facing camera using `RecognizerRunnerView`? HOT 3
- Blink id scan screen crashes for this. HOT 2
- USDL - Louisiana - Doesn't OCR/Decode the PDF barcode at the back of the card HOT 4
- Can't scan backside of ID card with BlinkIdSingleSideRecognizer() in custom option. HOT 3
- Error Migration from 5.20.0 to 6.0.0 - NoClassDefFoundError MicroblinkSDK HOT 3
- Reinstate x86 and x86_64 support. HOT 1
- Warning: This feature is not supported on camera without autofocus HOT 8
- How to set outer layer of the quad view with grey transparent overlay HOT 4
- The native library is loaded in the main thread, which generates an ANR HOT 7
- This entity is not allowed by currently active license! HOT 1
- Can not close error popup on 6.2.1 version HOT 3
- Background ANR at jdk.internal.misc.Unsafe.park HOT 10
- Invalid license buffer magic number. HOT 5
- doesn't read first/last name or doc number from some type of Chinese passport HOT 2
- DateResult and Date toString returns appended data instead of interleaved HOT 4
- Sample apps use an outdated version of BlinkID and don't compile with the current version (6.5.0) HOT 1
- com.microblink.blinkid.licence.exception.InvalidLicenceKeyException HOT 1
- Upgrading to Version 6.6.0 but the SDK is not working HOT 2
- Feature Request: Height, Eye Color, Hair Color, Weight Support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blinkid-android.