Do you have a question? Post it now! No Registration Necessary
Subject
- Posted on
decode a barcode from image
- 06-12-2004
- Krishna Sagiraju
June 12, 2004, 2:52 pm

Hai,
I gotta decode a barcode from an image ( ppm, bmp, or jpg). I realize the
first milestone would be to recognize a barcode with in the image:
I took a small window (say 80X80 pixels) and if a barcode is present in
this window all pixels horizontally would have the same values. Well as you
can see this is not perfect. I'm right now working with PPM image.
and then to decode the barcode itself (which i've no clue how to do).
I've searched the for a long time but could not find any help regarding
barcode decoding. I would appritiate if any of you can provide me any help
at all.
Thanks in advance.
Krishna
I gotta decode a barcode from an image ( ppm, bmp, or jpg). I realize the
first milestone would be to recognize a barcode with in the image:
I took a small window (say 80X80 pixels) and if a barcode is present in
this window all pixels horizontally would have the same values. Well as you
can see this is not perfect. I'm right now working with PPM image.
and then to decode the barcode itself (which i've no clue how to do).
I've searched the for a long time but could not find any help regarding
barcode decoding. I would appritiate if any of you can provide me any help
at all.
Thanks in advance.
Krishna

Re: decode a barcode from image

The first step should be to find the orientation. Are the lines
paralell to the border? If not, you should first rotate the picture
or find the orientation.

What kind of bar code? EAN, UPC, Code39............ There are so
many coding schemes for bar codes.
Regards, Kurt
--
PiN - Präsenz im Netz GITmbH
Kurt Harders
PiN - Präsenz im Netz GITmbH
Kurt Harders
We've slightly trimmed the long signature. Click to see the full one.

Re: decode a barcode from image

Please allow me to explain the senario, I use a ccd camera to capture the
image, then i need to check the image for a barcode, which still remains my
primary objective, and let's assume the barcode is parallel to height and
that i;m working with code 128 currently. If i sucessfully implement the
decoder i would consider other encodings. Oh! i forgot to mention i'm using
Linux.

Re: decode a barcode from image

Not necessarily. I've decoded UPCish and Postnet barcodes in images
without bothering to locate the barcode first.

Yup, I was only able to find commercial solutions and (scanning) hardware
information.
I'm planning on working on decoding of UPC-like barcodes again soon for a
newly-started project.
--kyler

Re: decode a barcode from image

You can find lots of barcode information at links at
http://www.epanorama.net/links/smartcards.html#barcode
Check this article out:
http://www.linuxjournal.com/article.php?sid45%45
Adapt the ideas on it to image instead of hardware.
--
Tomi Engdahl (http://www.iki.fi/then /)
Take a look at my electronics web links and documents at
Tomi Engdahl (http://www.iki.fi/then /)
Take a look at my electronics web links and documents at
We've slightly trimmed the long signature. Click to see the full one.

Re: decode a barcode from image

Here is a technical reference,
The Bar Code Book: Reading, Printing, and Specification of Bar Code
Symbols by Roger C. Palmer
"http://en.wikipedia.org/wiki/Barcode "
"(Amazon.com product link shortened)
Depending on your application, you can limit the symbologies. The
type of bar code you use depends a great deal on the application. For
instance, 2D bar codes pack so much info they can be used without
access to a DB. Code3of9 have a richer information set (similar to
track 1/3 of a magnetic card) allowing numbers and alpha characters.
These are typically used on skids of merchandise and hence are common
in warehouse application. UPC is the de-facto for consumer/retail
uses. These only include product numbers that are managed like a MAC
addresses. One portion represents a manufacture another is the
specific product.
You really need better requirements. Either from your boss or if you
are doing this on your own, try to figure out exactly what you are
doing. If you limit to a few symbologies, pre-processing to find the
"barcode" is unnecessary (as another poster noted). However, if you do
*all known* symbologies, you will pick up barcodes in noise. Some
seldom used barcodes have no redundancy and you can _erroneously_ read
"blue jeans" or anything with striped patterns on it.
fwiw,
Bill Pringlemeir.
--
I can remember when the air was clean and sex was dirty. - George
Burns
I can remember when the air was clean and sex was dirty. - George
Burns
Site Timeline
- » opie make menuconfing broken pipe error
- — Next thread in » Embedded Linux
-
- » DEVICE DRIVER DEVELOPMENT IN EMBEDDED LINUX SYSTEMS
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Sieci raz jeszcze: PoE, Å›wiatÅ‚owody, giga bit ethernet.
- — The site's Newest Thread. Posted in » Electronics (Polish)
-