decode a barcode from image

Discussion in 'C++' started by Krishna Sagiraju, Jun 12, 2004.

  1. 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
    Krishna Sagiraju, Jun 12, 2004
    #1
    1. Advertising

  2. Krishna Sagiraju

    Cy Edmunds Guest

    "Krishna Sagiraju" <> wrote in message
    news:...
    > 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/
    Cy Edmunds, Jun 12, 2004
    #2
    1. Advertising

  3. Cy Edmunds wrote:
    > "Krishna Sagiraju" <> wrote in message
    > news:...
    >
    >>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...
    Krishna Sagiraju, Jun 12, 2004
    #3
  4. On Sat, 12 Jun 2004 14:47:47 GMT, "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
    >


    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
    Bob Hairgrove, Jun 12, 2004
    #4
  5. Bob Hairgrove wrote:
    > On Sat, 12 Jun 2004 14:47:47 GMT, "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
    >>

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

    I'm sorry i forgot to mention i'm working in linux. I'm really sorry for
    my mistake.
    Krishna Sagiraju, Jun 12, 2004
    #5
  6. Krishna Sagiraju

    Eric Guest

    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
    Eric, Jun 12, 2004
    #6
  7. "Eric" <> 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
    Krishna Sagiraju, Jun 12, 2004
    #7
  8. Krishna Sagiraju

    Cy Edmunds Guest

    [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/
    Cy Edmunds, Jun 13, 2004
    #8
  9. Krishna Sagiraju

    David Harmon Guest

    On Sat, 12 Jun 2004 15:50:34 GMT in comp.lang.c++, Krishna Sagiraju
    <> 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.
    David Harmon, Jun 13, 2004
    #9
  10. 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
    Thomas Matthews, Jun 14, 2004
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Matthews

    Re: decode a barcode from image

    Thomas Matthews, Jun 14, 2004, in forum: C Programming
    Replies:
    0
    Views:
    398
    Thomas Matthews
    Jun 14, 2004
Loading...

Share This Page