Hi,

I am getting this exception when using recognizeBusinessCard() that accepts InputStream.

But If I pass Bitmap, it is working. I don't want to load large Bitmap before starting recognizing businesscard. Here's my code.

FileInputStream inputStream = new FileInputStream("/sdcard/businesscard.jpg");

Engine engine = Engine.createInstance(dataSources, license);
RecognitionManager recognitionManager = engine.getRecognitionManager(new RecognitionConfiguration());
ImageLoadingOptions loadingOptionsLocal = new ImageLoadingOptions();

MocrBusinessCard mocrBusinessCard = recognitionManager.recognizeBusinessCard(inputStream,
                    loadingOptionsLocal,
                    new RecognitionManager.RecognitionCallback() {
                        @Override
                        public boolean onRecognitionProgress(int i, int i1) {
                            return false;
                        }

                        @Override
                        public void onRotationTypeDetected(RecognitionManager.RotationType rotationType) {

                        }

                        @Override
                        public void onPrebuiltWordsInfoReady(MocrPrebuiltLayoutInfo mocrPrebuiltLayoutInfo) {

                        }
                    };

Here's the exception from logcat.

09-17 18:25:41.815  18586-18798/com.sample.businesscard W/System.err﹕ com.abbyy.mobile.ocr4.ImageLoadingFailedException: Failed to load image.
09-17 18:25:41.821  18586-18798/com.sample.businesscard W/System.err﹕ at com.abbyy.mobile.ocr4.RecognitionContext.nativeLoadImage(Native Method)
09-17 18:25:41.821  18586-18798/com.sample.businesscard W/System.err﹕ at com.abbyy.mobile.ocr4.RecognitionContext.loadImage(RecognitionContext.java:1014)
09-17 18:25:41.821  18586-18798/com.sample.businesscard W/System.err﹕ at com.abbyy.mobile.ocr4.RecognitionContext.prepareRecognitionData(RecognitionContext.java:319)
09-17 18:25:41.821  18586-18798/com.sample.businesscard W/System.err﹕ at com.abbyy.mobile.ocr4.RecognitionContext.recognizeBusinessCard(RecognitionContext.java:568)
09-17 18:25:41.822  18586-18798/com.sample.businesscard W/System.err﹕ at com.abbyy.mobile.ocr4.RecognitionManagerImpl.recognizeBusinessCard(RecognitionManagerImpl.java:99)
09-17 18:25:41.822  18586-18798/com.sample.businesscard W/System.err﹕ at com.sample.businesscard.AbbyBusinessCardRecognizer.recognize(AbbyBusinessCardRecognizer.java:125)
09-17 18:25:41.822  18586-18798/com.sample.businesscard W/System.err﹕ at com.sample.businesscard.ScanCardActivity$AsyncScanBusinessCardPictureTask.doInBackground(ScanCardActivity.java:474)
09-17 18:25:41.822  18586-18798/com.sample.businesscard W/System.err﹕ at com.sample.businesscard.ScanCardActivity$AsyncScanBusinessCardPictureTask.doInBackground(ScanCardActivity.java:403)
09-17 18:25:41.822  18586-18798/com.sample.businesscard W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:292)
09-17 18:25:41.822  18586-18798/com.sample.businesscard W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
09-17 18:25:41.822  18586-18798/com.sample.businesscard W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
09-17 18:25:41.822  18586-18798/com.sample.businesscard W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
09-17 18:25:41.822  18586-18798/com.sample.businesscard W/System.err﹕ at java.lang.Thread.run(Thread.java:818)

I have added permissions for reading files. I also tried passing ByteArrayInputStream (contains image byte[]). Still not working.

asked 17 Sep '15, 13:41

glenn_vm's gravatar image

glenn_vm
135

edited 17 Sep '15, 13:50

Could you, please, specify which Android and MSDK versions you use?

(22 Sep '15, 12:53) Julia Anikus... ♦♦

Hi, I'm using Android API 22 (5.1.1 Lollipop). MSDK version is 4.4.1.246.

(22 Sep '15, 13:34) glenn_vm

The reason of the issue is in the fact that you are using old version of MSDK. It does not include Android 5 support.

In order to get the last release of Mobile OCR Engine, please, contact your account manager.

link

answered 22 Sep '15, 15:06

Julia%20Anikushina's gravatar image

Julia Anikus... ♦♦
3628

@Julia Hi, I've acquired the latest version of sdk, 4.6.0.42. It is now working! Thanks you so much! Answer marked.

(23 Sep '15, 14:24) glenn_vm
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×52
×13

Asked: 17 Sep '15, 13:41

Seen: 1,495 times

Last updated: 23 Sep '15, 14:24

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal