Libdmtx vs ZXing for DataMatrix Decoding? - java

How reliable is ZXing's barcode localization for DataMatrix decoding compared to libdmtx?
I have a set of png image files of stickers (proprietary, so unfortunately I'm not able to share them) containing DataMatrix barcodes. These stickers sit on flat surfaces, have very nice quiet zones and are generally centered in the image, but suffer from inequal lighting conditions and slight dust, likely the largest obstacle to reliable decoding.
I'd like to use a modifiable Java library to decode them and it seems that ZXing is the only open-source option (open to other suggestions). However, upon running these images through the ZXing online decoder, I consistently get NO BARCODE FOUND, even on the cleanest images. In contrast, when I run the same images through proprietary online decoders, like Inlite's Free Online Barcode Reader, I get reliable decodes for all the images. My company has implemented a library in C that also reliable decodes the barcode images by processing them and calling libdmtx. Similarly, this online DataMatrix decoder built on libdmtx can also reliably read my image files.
Is the barcode localization in ZXing significantly inferior to libdmtx?
If I attempt the same preprocessing on the image files before I run them through ZXing, could I achieve similar results? I have a strong preference for a Java library (ZXing), but I may have no choice but to use libdmtx. Would appreciate any insight, thanks!

I had similar problem as you but on encoding side. As per my findings Zxing is certainly inferior to Libdmtx. We are using both libraries in house in C++ and Java project.
There is a case when Zxing breaks while generating barcode look at my comments here:
https://github.com/zxing/zxing/issues/624
However Libdmtx works flowless. The other free options you have in java world are (they are for encoding):
barcode4j
OkapiBarcode

Another alternative is the relatively new ZXing cpp port here: https://github.com/nu-book/zxing-cpp.
It contains a completely new DataMatrix detector that was meant to fix serious limitations of the Java upstream version. It was specifically designed to deal with low resolution images (module size as low as around 2 pixels) and symbols that have just the required 1 module quite zone and a busy background.
The following comparison is certainly not 'fair' but I just had the dmtxread utility of the libdmtx try my test set of images and it missed 3 of 17 samples and took a whooping 300 times as long compared to my code :).

Related

Java OCR for images with complicated backgrounds

I'm trying to get some text from images which look like this:
This example would actually be the best case scenario as most of them would have a colored and more complex background instead.
I don't need it to be 100% accurate since I know the possible outcomes and could try to do a partial match with them.
I tried Aspose OCR and Tess4j. Aspose gives me random characters and Tess4j gives nothing.
Is this doable with a free library?
Tesseract seems to be the best free library for this purpose.
I know some projects using Tesseract do pre-processing to images they are OCR'ing. Like changing contrast, rotating, resolution, etc. Then they OCR same image with multiple times for different pre-processing changes and then compare the results.
More information here

Optimize images - Losslessly compress images in Java

Having an ecommerce website, We have thousands of product images. On checking pagespeed on google it shows me something like this:
I was wondering, if there is any built in feature in Java or any third party library is available with which we can losslessly compress all the images that we host. Hence we can save few KBs of our customers.
On searching through internet I found few like punnypng and kraken which are paid, hence we do not have heavy image uploaded every month, subscribing to them is not worth. I would prefer any built in feature in Java or any open source third party library.
I came across JAI, but not sure about whether it addresses this problem or not. Anyone with hands-on experience with this?
P.S. We are using Java 8
Have you looked at classes in the javax.imageio package (http://docs.oracle.com/javase/7/docs/api/javax/imageio/package-summary.html) ?
You can do decoding and re-encoding of the images. The class ImageWriteParam (http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageWriteParam.html) lets you customize the compression settings.
~600 KB jpeg images are quite large for screen, though not for print. Having several images on a page would mean making more or less "thumb" views being smaller. And provide an individual product page with higher resolution, say 600 KB JPEG.
Standard ImageIO suffices for conversion, see #NicolaFerraro.
Faster page loading can be achieved on the overview page with multiple images, by storing the smaller views into one large image. PNG might then be appriopriate to prevent JPEG artifacts.
To provide a higher resolution for a print, one can use the CSS media setting.
Check thumbnailator. It is great at making smaller images from larger images.
Besides you should consider when you are going to make these smaller images. At each call, at the first call (any keeping a cache), ...

Fast conversion from mp3 to WAV on Android

I am trying to convert a mp3 file into WAVE format in my Android application. This operation should take little time, as the application is social, and it is not acceptable for the user to wait for too long.
So here is where I am :
I have already tried to use JLayer (proposed in a similar question Convert mp3 to wav on Android), but the conversion is too slow: it takes about 40 seconds for a 2 minutes mp3 file.
Concerning the library LAME (as in Lame4Android), I also tried it (with Android NDK) but the result is still too slow (15s to 10s).
I came across another library: JUCE, but it is too vast, and including the entire library in the project in order to do that simple conversion seems a bit... excessive. And I am also afraid it will slow the application.
So what I am currently looking for is a C/C++ library to use in order to do that.
Do you know any fast libraries?
Thank you.
Not sure if the license will work for you (GPLv2), but have you considered libmad?
As I understand it, there's not a NDK build available for download, but here is a page describing how to make one yourself...
Another option is libmpg123, which is LGPLv2.1. The same blog has an article describing how to use it in Android.

How can I convert image sequence to quicktime movie?

I have been searching on this. I Need to build an independent utility that should:
Convert image sequence to .mov format
Take input from user and display it inside the mov.
I plan to do this using Java since this is a cross platform language.
How to do it?
See JpegImagesToMovie.java it requires the x-plat version of the JMF (or more importantly jmf.jar).
For a more modern alternative, look to JFFMPEG (JMF with more formats & encodings).
I have earlier used XUGGLER for making videos from image frames. It is easy to use XUGGLER with the help of the comprehensive tutorials available here. You can also add audio to the video generated from the image frames.
Xuggler supports a large number of video codecs and video container formats so you will have the option of creating the video in different formats, leave alone .mov. Hope this helps. I can post my own code for this utility if required.

Improving the visual quality of Theora when using Xuggler

I'm looking for fellow users, who are using Xuggler to produce video encoded with Theora. I've tried a lot of different options to get "good" quality using presets to no avail. I would love to get quality anywhere close to what I can produce with the Miro converter tools defaults. Sadly, the web doesn't seem to have much to say except that we should all "use ffmpeg2theora" which is not an option when using Xuggler, and I have to use Xuggler in this case.
My listener which configures the codecs is here: http://pastebin.com/MX2r5KsC
And my reference preset file is here: http://pastebin.com/fBeZxSGr
A solution was found by a colleague / client on a related project. The resolution is surprisingly simple, and consists of the following three lines of code:
coder.setFlag(IStreamCoder.Flags.FLAG_QSCALE, false);
coder.setBitRate(200000);
coder.setTimeBase(IRational.make(1,25));
This forces Xuggler to encode using a constant bitrate of 200kbps and with a frame rate of 25 fps. I hope this helps my fellow Xuggle users out there.

Categories