decode a barcode from image

K

Krishna Sagiraju

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
 
C

Cy Edmunds

Krishna Sagiraju said:
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 wrote some type 128 barcode reading software not too long ago using
information from this site:

http://www.adams1.com/pub/russadam/128code.html

My employer might not like me sharing the software with you but I can give
you the outline of the algorithm:

1) average down to 1D
2) determine the location of all edges using gray interpolation
3) subtract to get the width of each bar and space
4) estimate the scaling factor which makes each bar and space approximately
1, 2, 3, or 4 times the smallest one
5) decode as shown on the website

Of course this assumes you are reading type 128 barcodes. Other types work
about the same except for the encoding.
 
K

Krishna Sagiraju

Cy said:
I wrote some type 128 barcode reading software not too long ago using
information from this site:

http://www.adams1.com/pub/russadam/128code.html

My employer might not like me sharing the software with you but I can give
you the outline of the algorithm:

1) average down to 1D
2) determine the location of all edges using gray interpolation
3) subtract to get the width of each bar and space
4) estimate the scaling factor which makes each bar and space approximately
1, 2, 3, or 4 times the smallest one
5) decode as shown on the website

Of course this assumes you are reading type 128 barcodes. Other types work
about the same except for the encoding.
Thanks for your reply. But right now i'm not able to efficiently detect
a barcode with in the image. Is there any kind of library that would do
that?.. by the way i'm using linux.

the web page is very informative.. and that sure would gimme a decent
start ... I'm really thankful to you...
 
B

Bob Hairgrove

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

Do yourself a big favor and visit this site:

http://www.axtel.com

They have DLLs with C-style interface (for Windows) as well as ActiveX
objects which read and write just about every kind of barcode
available. They handle lots of image formats as well. You can download
a free demo from their website.
 
K

Krishna Sagiraju

Bob said:
Do yourself a big favor and visit this site:

http://www.axtel.com

They have DLLs with C-style interface (for Windows) as well as ActiveX
objects which read and write just about every kind of barcode
available. They handle lots of image formats as well. You can download
a free demo from their website.
I'm sorry i forgot to mention i'm working in linux. I'm really sorry for
my mistake.
 
E

Eric

Krishna said:
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

please dont MULTI-post, crosspost instead. you posted this same exact
question in comp.lang.c
Whats the difference?
Multipost - like sending a separate single email to each recipient on your
list (or hitting Reply on an email for every recipient in the CC list and
sending each individual the same reply text)
CrossPost - like sending one email but CC'ing everybody
 
K

Krishna Sagiraju

Eric said:
please dont MULTI-post, crosspost instead. you posted this same exact
question in comp.lang.c
Whats the difference?
Multipost - like sending a separate single email to each recipient on your
list (or hitting Reply on an email for every recipient in the CC list and
sending each individual the same reply text)
CrossPost - like sending one email but CC'ing everybody

I'm sorry this is the first time i'm using the groups, I'm not aware of the
etiquettes. Thanx for letting me know i'll follow your suggestion from my
next postings..

sorry once again
 
C

Cy Edmunds

[snip]
Thanks for your reply. But right now i'm not able to efficiently detect
a barcode with in the image. Is there any kind of library that would do
that?.. by the way i'm using linux.

the web page is very informative.. and that sure would gimme a decent
start ... I'm really thankful to you...


I couldn't find a free library when I was looking about 2 years ago. I found
some commercial libraries (e.g. LeadTools) but I thought they were too
expensive. I was right too -- it only took me about three days to code and
test barcode reading software which is used successfully every day where I
work.
 
D

David Harmon

On Sat, 12 Jun 2004 15:50:34 GMT in comp.lang.c++, Krishna Sagiraju
Thanks for your reply. But right now i'm not able to efficiently detect
a barcode with in the image.

I guess that you should not try to detect the barcode first and then
decode it. Instead, apply the decoding algorithm to all parts of the
image; when one of them passes the barcode quality and checksum test you
have both detected and decoded it.
 
T

Thomas Matthews

Krishna said:
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

Since you don't have an issue about the C or C++ languages,
I suggest that you visit either or
one of the newsgroups. Your task does
not depend on the language, but rather file formats.


--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top