Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, July 17, 2019 1:53:40 PM(UTC)

Groups: Registered
Posts: 4

I'm using the Android MICR demo to play around with some of Leadtool's functionality. I want to display the image that is captured and analyzed to get the MICR information. To do that, I try to convert the RasterImage to a Bitmap image, but get the following error:

Failed converting to bmp
    leadtools.RasterException: Invalid parameter passed
        at leadtools.RasterImage.updateBitmapHandle(RasterImage.java:704)
        at leadtools.converters.RasterImageConverter.convertToBitmap(RasterImageConverter.java:64)
        at leadtools.converters.RasterImageConverter.convertToBitmap(RasterImageConverter.java:53)
        at leadtools.micrdemo.MicrDemoActivity.showAboutDialog(MicrDemoActivity.java:1213)
        at leadtools.micrdemo.MicrDemoActivity.access$800(MicrDemoActivity.java:97)
        at leadtools.micrdemo.MicrDemoActivity$10.run(MicrDemoActivity.java:771)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

I added one line to MicrDemoActivity.java in the MicrDemo example, and I've tried both 0 and null for the second parameter (line 770 or so of the actual file):
if (displayResult && mContinueCapture) {
                  // MICR data found, display the result
                  runOnUiThread(new Runnable() {
                     public void run() {
                        android.graphics.Bitmap displayableImg = RasterImageConverter.convertToBitmap(img, null);

Any ideas why it fails to convert the image? Thanks

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, July 18, 2019 11:19:45 AM(UTC)

Groups: Registered
Posts: 4

Solved, added this line to
protected MicrResult doInBackground(YUVImage... yuvImages)


                RasterImage rasterImage = RasterImage.createFromYUVImage(mYUVImage, 24);
                imgToConvert = new RasterImage(rasterImage); // Added this
                if (mPreviewBufferRotation != 0) { ..................................

imgToConvert can then be converted to a Bitmap
#3 Posted : Friday, July 19, 2019 10:31:54 AM(UTC)
Marcus Andra

Groups: Registered, Manager, Tech Support, Administrators
Posts: 107

Was thanked: 9 time(s) in 9 post(s)


You can find more documentation regarding the usage of the RasterImage class here: https://www.leadtools.co...20/dh/l/rasterimage.html
This should indeed fix your issue.

I'm glad that this change worked for you. If any additional issues arise, please email us at support@leadtools.com.

Marcus Andra
Developer Support Engineer
LEAD Technologies, Inc.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.077 seconds.