×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    32

    Problem in scanning 2d barocode using ZXing on J2ME

    I am developing a 2D Barcode scanner application using Zxing 1.7 on J2ME.

    When I scan the bar code,it is giving me following error:

    Sorry,no barcode was found.

    Please provide me the solution.

    I also want to know whether isn't it possible to scan the barocode using Zxing on J2me similiar to using Zxing on Andoid where we don't have to capture the image,just place it in viewfinder.

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Problem in scanning 2d barocode using ZXing on J2ME

    Quote Originally Posted by nayal_genext View Post
    I am developing a 2D Barcode scanner application using Zxing 1.7 on J2ME.

    When I scan the bar code,it is giving me following error:

    Sorry,no barcode was found.

    Please provide me the solution.

    I also want to know whether isn't it possible to scan the barocode using Zxing on J2me similiar to using Zxing on Andoid where we don't have to capture the image,just place it in viewfinder.
    Try to open the camera view finder, take getSnapshot() and try to process it with your library - keep on repeating in a loop - till you do not the barcode decoded.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  3. #3
    Registered User
    Join Date
    May 2012
    Posts
    32

    Re: Problem in scanning 2d barocode using ZXing on J2ME

    Please let me know the code for opening camera view finder as zxing library for j2me has not used it whereas while using zxing for android it is there

    Quote Originally Posted by im2amit View Post
    Try to open the camera view finder, take getSnapshot() and try to process it with your library - keep on repeating in a loop - till you do not the barcode decoded.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Problem in scanning 2d barocode using ZXing on J2ME

    Quote Originally Posted by nayal_genext View Post
    Please let me know the code for opening camera view finder as zxing library for j2me has not used it whereas while using zxing for android it is there
    Please refer to Nokia J2me Code example Wiki - http://www.developer.nokia.com/Commu..._using_Java_ME

    You can try to decode the snapshots from above using zxing.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  5. #5
    Registered User
    Join Date
    May 2012
    Posts
    32

    Re: Problem in scanning 2d barocode using ZXing on J2ME

    But how to use this code so that when I place the mobile camera over barcode it automatically focuses and scans the barcode similiar to zxing bacode scanner on android phones or beetag qr reader for nokia mobiles.
    Since when I am running the zxing j2me application I have to take the snapshot and then barcode scanning occurs.
    Whereas I require that this application automatically scans the barcode using viewfinder.

    Quote Originally Posted by im2amit View Post
    Please refer to Nokia J2me Code example Wiki - http://www.developer.nokia.com/Commu..._using_Java_ME

    You can try to decode the snapshots from above using zxing.

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Problem in scanning 2d barocode using ZXing on J2ME

    Quote Originally Posted by nayal_genext View Post
    But how to use this code so that when I place the mobile camera over barcode it automatically focuses and scans the barcode similiar to zxing bacode scanner on android phones or beetag qr reader for nokia mobiles.
    Since when I am running the zxing j2me application I have to take the snapshot and then barcode scanning occurs.
    Whereas I require that this application automatically scans the barcode using viewfinder.
    Instead of using zxing j2me application, you need to use the Zxing J2me library along with the above code example -you need to create your own 2D Barcode reader, use the example code to capture continuous screenshots and pass them to the decoding library 1 after other till you get the decode.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  7. #7
    Registered User
    Join Date
    May 2012
    Posts
    32

    Re: Problem in scanning 2d barocode using ZXing on J2ME

    But how to pass the captured snapshot for decoding as currently the code that is used for decoding is:

    byte[] snapshot = takeSnapshot();
    Image capturedImage = Image.createImage(snapshot, 0, snapshot.length);
    LuminanceSource source = new LCDUIImageLuminanceSource(capturedImage);
    BinaryBitmap bitmap = new BinaryBitmap(new GlobalHistogramBinarizer(source));
    Reader reader = new MultiFormatReader();
    Result result = reader.decode(bitmap);
    private byte[] takeSnapshot() throws MediaException {

    String bestEncoding = guessBestEncoding();

    VideoControl videoControl = zXingMIDlet.getVideoControl();
    byte[] snapshot = null;
    try {
    snapshot = videoControl.getSnapshot("".equals(bestEncoding) ? null : bestEncoding);
    } catch (MediaException me) {
    }
    if (snapshot == null) {
    // Fall back on JPEG; seems that some cameras default to PNG even
    // when PNG isn't supported!
    snapshot = videoControl.getSnapshot("encoding=jpeg");
    if (snapshot == null) {
    throw new MediaException("Can't obtain a snapshot");
    }
    }
    return snapshot;
    }


    Quote Originally Posted by im2amit View Post
    Instead of using zxing j2me application, you need to use the Zxing J2me library along with the above code example -you need to create your own 2D Barcode reader, use the example code to capture continuous screenshots and pass them to the decoding library 1 after other till you get the decode.

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Problem in scanning 2d barocode using ZXing on J2ME

    byte[] snapshot = takeSnapshot(); // takes snapshot
    Image capturedImage = Image.createImage(snapshot, 0, snapshot.length);
    LuminanceSource source = new LCDUIImageLuminanceSource(capturedImage);
    BinaryBitmap bitmap = new BinaryBitmap(new GlobalHistogramBinarizer(source));
    Reader reader = new MultiFormatReader();
    Result result = reader.decode(bitmap); // decode the image/barcode
    You need to take images in loop, continuously and send it to the decoder after converting to bitmap till you do not get a good result.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  9. #9
    Registered User
    Join Date
    May 2012
    Posts
    32

    Re: Problem in scanning 2d barocode using ZXing on J2ME

    But even after doing this I have to capture the image whereas what I requires is that as I place the mobile over barcode it automatically scans it like it does in zxing barcode scanner for android application or beetag qr reader

    Quote Originally Posted by im2amit View Post
    You need to take images in loop, continuously and send it to the decoder after converting to bitmap till you do not get a good result.

Similar Threads

  1. Problem in integrating zxing to j2me for nokia mobile paltform
    By nayal_genext in forum Mobile Java Tools & SDKs
    Replies: 11
    Last Post: 2012-05-31, 13:12
  2. Bluetooth Barcode Scanning with J2ME
    By eretief in forum General Development Questions
    Replies: 2
    Last Post: 2012-02-10, 11:45
  3. problem for access point scanning on E7/Symbian^3
    By cglolo in forum Wired and Wireless interfaces (Closed)
    Replies: 2
    Last Post: 2010-10-28, 04:32
  4. Bar code scanning in J2ME
    By saran.tli in forum Mobile Java General
    Replies: 1
    Last Post: 2010-10-22, 12:59
  5. hidden wlan scanning problem
    By miikkis in forum Symbian
    Replies: 0
    Last Post: 2008-08-05, 09:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×