Java and JNI integration

  • 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,

  • Piotr Sobiech

    Piotr Sobiech - 2012-06-15

    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.

    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.

  • ozzirisc

    ozzirisc - 2012-11-18

    Piotr Sobiech, puedes postear el proyecto completo de tu implementacion

  • ozzirisc

    ozzirisc - 2012-11-18

    Piotr Sobiech, you can post your entire project implementation


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks