Android: com.abbyy.mobile.ocr4.ImageLoadingFailedException: Failed to load image

  • 1.5K Views
  • Last Post 23 September 2015
  • Topic Is Solved
glenn_vm posted this 17 September 2015

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.

Order By: Standard | Newest | Votes
Julia Anikushina posted this 22 September 2015

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

glenn_vm posted this 22 September 2015

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

Julia Anikushina posted this 22 September 2015

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.

  • Liked by
  • glenn_vm
glenn_vm posted this 23 September 2015

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

Close