Comments (7)
If data array is null, then nothing was scanned. Are you sure you are sending the correct orientation of bitmap? Your code reports bitmap in orientation portrait, i.e. as if the bitmap was taken with device camera while device being in portrait mode (i.e. the text lines are vertical and start at the bottom of the image and end at the top). If the bitmap image you are scanning has normal orientation (i.e. text lines are horizontal and text starts from the left and ends on the right - just like in web page), then you should pass LANDSCAPE_RIGHT orientation.
from blinkid-android.
Thanks for your response. You are right, I am taking a photo with the camera and I am placing it in an ImageView to check the orientation. Image has a number horizontally aligned displayed from left to right (when I place this image in the ImageView it has the correct orientation). I have tried to configure the orientation in ORIENTATION_LANDSCAPE_RIGHT but it's not working either. What orientation should I use?
from blinkid-android.
If ImageView is displaying image correctly, then landscape right is the correct orientation to use. However, it could be possible that OCR of the image was incorrect, so regex parser couldn't match your expression (i.e. it's possible that OCR produced punctuation or spaces inside your word and your regex does not account for that).
You can inspect the raw OCR result with the getOcrResult and if you know you only expect uppercase letters and digits, you might want to tweak RegexParser's OCR engine options and add only uppercase letters and digits to whitelist. However, bogus spaces could still appear within your words (though not so often), so you should also tweak your regex to account for that.
from blinkid-android.
Thanks I am getting some data now. However, the result is not as good as expected, I have tried the sample app of the regex expression and it's much more accurate with the same image. I am setting the SettingsRecognition as you mentioned:
private RecognizerSettings[] setupSettingsArray() {
BlinkOCREngineOptions engineOptions = new BlinkOCREngineOptions();
// only digits are allowed.
engineOptions.addAllDigitsToWhitelist(OcrFont.OCR_FONT_ANY);
engineOptions.setMinimumLineHeight(40);
RegexParserSettings regexParserSettings = new RegexParserSettings("[0-9]+", engineOptions);
BlinkOCRRecognizerSettings sett = new BlinkOCRRecognizerSettings();
sett.addParser("myRegexParser", regexParserSettings);
return new RecognizerSettings[] { sett };
}
To analyze the results I am looking at the OcrResult but it gives me lots of 1's and multiple lines for an image with a single line of text:
@Override
public void onScanningDone(RecognitionResults results) {
BaseRecognitionResult[] dataArray = results.getRecognitionResults();
// we've enabled only one recognizer, so we expect only one element in dataArray
Log.d(TAG, "Recognition settings: " + dataArray);
if(dataArray!= null && dataArray.length == 1){
if (dataArray[0] instanceof BlinkOCRRecognitionResult) {
BlinkOCRRecognitionResult result = (BlinkOCRRecognitionResult) dataArray[0];
if (result.isValid() && !result.isEmpty()) {
OcrResult ocrResult = result.getOcrResult();
if(ocrResult!= null){
Toast.makeText(context, "Result: " + ocrResult.toString(), Toast.LENGTH_LONG).show();
Log.d(TAG, "Result raw: " + ocrResult.getBlocks()[0].toString());
}
}
}
}
How can improve the analysis of the data to get a result as good as the obtained in the RegexExample handled in SegmentScanActivity
?
from blinkid-android.
Hi @LukeEdghar.
The difference between your code and SegmentScanActivity is that your code uses DirectAPI, which can process only single bitmap image you send for processing, while SegmentScanActivity processes camera frames as they arrive from the camera. While doing so, it can utilise time redundant information to improve the OCR quality, i.e. it combines consecutive OCR results from multiple video frames to obtain a better quality OCR result.
This feature is not available via DirectAPI - you need to use either SegmentScanActivity, or custom scan activity with our camera management.
from blinkid-android.
To help others if they face the same problem. I have notice that if you pass an image with a very high resolution it doesn't recognize the text properly (it makes artifacts). To improve the accuracy it's better to scale down the image.
from blinkid-android.
Closing the issue, please reopen if you have questions or contact us directly at [email protected].
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.