New Projects - Fresh from the Labs
I realise I tend to cover wacky things like molecule imaging, telekinesis and 3-D knitting software, but this is something that actually may be of genuine industrial use in everyday life. libdmtx is an open-source project dedicated to providing tools for reading and writing 2-D Data Matrix barcodes. The Data Matrix standard (en.wikipedia.org/wiki/Data_Matrix) is gaining widespread popularity due to its impressive features, but it may be of particular interest to the FOSS community because it's unencumbered by patents and royalty-free (thus, free to use and distribute). Also, the existing proprietary solutions can be quite expensive, and libdmtx now has reached a point where it realistically can save some users six-digit savings every year.
Data Matrix barcodes have been around since the 1980s, but for years, they were used only to mark electronic components. More recently, they have been adopted by a wide variety of industries in the US and Europe, and they are becoming especially popular with mobile phone developers due to their affinity to work with small digital cameras. Most US readers instantly will recognize Data Matrix barcodes, as they appear on most first-class mail delivered by the US Postal Service. Curious readers can snap a photo of their mail with a camera or Webcam and scan it with libdmtx without purchasing any special hardware (it also works well with faxed and scanned images).
Installing libdmtx is fairly straightforward with either a Debian package available under the name of libdmtx-utils or a source tarball. For those installing via source, compiling is basically the standard affair of:
$ ./configure $ make
And, as root or sudo:
# make install
However, the configure script did come up with a dependency you probably won't have installed by default, GraphicsMagick. GraphicsMagick is in many distro repositories though, and to get past the configure script, I had to install libgraphicsmagick1 and libgraphicsmagick1-dev from the Ubuntu archive.
Once you have libdmtx compiled, before you can run the program, you probably will need to run the following command (as root or sudo):
I cover only very basic usage in reading barcodes for now, but libdmtx also will write barcodes along with a bunch of other features that make it worth checking the man pages. First, grab an image to test. If you have a photo of a barcode around, great stuff, use that. Otherwise, some test images are available from the source tarball under the folder test/images_opengl, which cover a variety of different situations and tricky tests on libdmtx's abilities. Once you're ready to go, use the following command:
$ dmtxread nameofimage.png
And, that's pretty much all you need to do. dmtxread will spend a few seconds analyzing the image you've given it, and if it finds a matrix barcode, it then outputs the contained text to the terminal. Check the screenshot for some of the hidden messages and real-world codes that you can contain within a barcode.
What really intrigued me about this project is that you can recover barcode data from old pictures that never would have been meant for the purpose originally. And, the James Bond in me gets a kick out of knowing you can hide a message in a barcode in a seemingly unrelated picture as a covert method of communication—neat! Although this has just a command-line utility for now, it's really only a basic program on top of a very clever and versatile library. This project is begging for a GUI front end, at which point, it could make some serious inroads and savings in the real industrial world.
John Knight is the New Projects columnist for Linux Journal.