UPC Barcode Decoder
I did this out of curiousity of barcodes. So basically what I'm doing is:
I take a photo with a digital camera, convert it to a 24 bit bmp so
it's easy to read in, then this program will convert it to a 2 color image
by first converting to a (pseudo) monochrome image, and from there I
can convert it to a 2 color image using a threshold. After that I scan
the image from left to right line by line until I find a pattern of
a block of white, then a strip of black, white, and black all of the
same size. Then I use that size to see if the lines of white and
black are 1, 2, 3, or 4 times as big. Using the table on this page:
I convert those patterns into digits.
As a recent addition to the program, I also scan through the images
in 4 different directions and make it try multiple thresholds.
The image on the left is the original taken from the digital camera
and then scaled down. The picture on the right was generated by the
software before scanning for the barcode.
barcode-2010-12-30.tar.gz (Source Code)
Copyright 1997-2018 - Michael Kohn