Menu

Java and JNI integration

Help
ariolim
2012-06-14
2019-07-01
  • ariolim

    ariolim - 2012-06-14

    Provided that Java knows where to find zbar.jar and zbarjni library, can someone post a brief example of Java code in order to
    1) load an image (jpg, tiff or so what) somewhere in the file system
    2) scan that image
    3) print on stdout the result.

    Many thanks,
    Marco

     
  • Piotr Sobiech

    Piotr Sobiech - 2012-06-15

    Hi,
    I've attached my Proof of Concept code, I'd appreciate any feedback and/or fixes to the attached code.
    BSD license will let you use it whereever you want it.

    http://sobie.ch/ZbarBarcodeReaderImpl.java.gz

    Best regards,
    Piotr Sobiech

     
  • Piotr Sobiech

    Piotr Sobiech - 2012-06-15

    I didn't include reading the image and printing the results, but you should be able to do this part yourself :)

     
  • Jarek Czekalski

    Jarek Czekalski - 2012-06-15

    I'm surprised how much code is needed for this simple task. I guess parts of the code (like image conversion) could be included in zbar library. Piotr, maybe you would like to contribute it to the project? Currently your BSD license is not compatible with zbar license. For example because you require to include your name in binaries. Is it possible you publish your code under LGPL 2.1 also? Practically that means the copy of your file with the license copied from zbar java files (with copyright line changed).

     
  • Piotr Sobiech

    Piotr Sobiech - 2012-06-17

    Oh i totally forgot about the need for binary notice, I'll update the file on the server so feel free to include the code it zbar or any other project as LGPL 2.1 :).

    The amount of code could be reduced if you'd convert every image and not treat BufferedImage differently. You'd lost a few cycles though.

    Another thing one would need to think about is memory utilization.. I'll be working more closely with the library and the code in the next month so hopefully I'll be able to bring some feedback when i'll have some more data or idea how to optimize it further.

     
  • ariolim

    ariolim - 2012-07-02

    Thank you for your example.

     
  • Ubaldino Zurita

    Ubaldino Zurita - 2012-11-18

    Piotr Sobiech, puedes postear el proyecto completo de tu implementacion

     
  • Ubaldino Zurita

    Ubaldino Zurita - 2012-11-18

    Piotr Sobiech, you can post your entire project implementation

     
  • ram

    ram - 2019-07-01

    Can you pls share your POC, i dont see it @ http://sobie.ch/ZbarBarcodeReaderImpl.java.gz

     

Log in to post a comment.