By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,156 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,156 IT Pros & Developers. It's quick & easy.

decode a barcode from image

P: n/a
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


Jul 22 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
"Krishna Sagiraju" <sa******@gmail.com> wrote in message
news:d3******************************@news.teranew s.com...
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.

--
Cy
http://home.rochester.rr.com/cyhome/
Jul 22 '05 #2

P: n/a
Cy Edmunds wrote:
"Krishna Sagiraju" <sa******@gmail.com> wrote in message
news:d3******************************@news.teranew s.com...
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.

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...


Jul 22 '05 #3

P: n/a
On Sat, 12 Jun 2004 14:47:47 GMT, "Krishna Sagiraju"
<sa******@gmail.com> wrote:
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.
--
Bob Hairgrove
No**********@Home.com
Jul 22 '05 #4

P: n/a
Bob Hairgrove wrote:
On Sat, 12 Jun 2004 14:47:47 GMT, "Krishna Sagiraju"
<sa******@gmail.com> wrote:

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.
--
Bob Hairgrove
No**********@Home.com

I'm sorry i forgot to mention i'm working in linux. I'm really sorry for
my mistake.

Jul 22 '05 #5

P: n/a
Krishna Sagiraju wrote:
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
Jul 22 '05 #6

P: n/a

"Eric" <no****@email.com> wrote in message
news:mtHyc.15179$2i5.3843@attbi_s52...
Krishna Sagiraju wrote:
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


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
Jul 22 '05 #7

P: n/a
[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.

--
Cy
http://home.rochester.rr.com/cyhome/
Jul 22 '05 #8

P: n/a
On Sat, 12 Jun 2004 15:50:34 GMT in comp.lang.c++, Krishna Sagiraju
<sa******@gmail.com> wrote,
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.

Jul 22 '05 #9

P: n/a
Krishna Sagiraju wrote:
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 news:comp.programming or
one of the news:comp.graphics.* 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

Jul 22 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.