Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > [OpenCV] Extract en recognize barcode from image file.

Reply
Thread Tools

[OpenCV] Extract en recognize barcode from image file.

 
 
kurapix@gmail.com
Guest
Posts: n/a
 
      04-10-2008
Hi there!!!

I've been working on recognizing EAN barcodes from images. Yes it's
about recognizing barcodes from images but from bars not from the
digit with the help of OCR software but with "Open Computer Vision
library" (OpenCV).
I haven't been successful yet.

Here is my idea at how I should do it :
- Image capture
- Grays levels
- Binarize image
- Search the angle with Hough Transform
- Rotate the image using the found angle.
- Average of several lines for the color of the bars
- Convert to binary digit
- Convert in decimal

(I'm unable to show the lines found with Hough Transform anyway ...
><)

I can rotate the image and all.

I don't have the slighest idea at how to do to extract the rectangular
zone of the barcode and then averaging the lines.

Then, I have problems with some barcodes with some reflections, some
bars won't be continue bars so ... it inputs errors and dunno how to
correct it (how to reform correctly the bar since some point are
presents).

Here what I have for now :
http://img527.imageshack.us/img527/4...codeuo0.th.jpg
http://img525.imageshack.us/img525/1...rayseq3.th.jpg
http://img153.imageshack.us/img153/4...rizexb6.th.jpg
http://img398.imageshack.us/img398/6...tatesz3.th.jpg

I would like to post the source code but it's more than 100 lines ...
When my problem is resolved, I think I'll contribute to the community
by giving out the sources for recognizing a barcode from image.

Help would be much appreciate.

Thank you

Kurapix

P.S. : Sorry for my bad english
 
Reply With Quote
 
 
 
 
kurapix@gmail.com
Guest
Posts: n/a
 
      04-10-2008
On 11 avr, 00:30, (E-Mail Removed) wrote:
> Hi there!!!
>
> I've been working on recognizing EAN barcodes from images. Yes it's
> about recognizing barcodes from images but from bars not from the
> digit with the help of OCR software but with "Open Computer Vision
> library" (OpenCV).
> I haven't been successful yet.
>
> Here is my idea at how I should do it :
> - Image capture
> - Grays levels
> - Binarize image
> - Search the angle with Hough Transform
> - Rotate the image using the found angle.
> - Average of several lines for the color of the bars
> - Convert to binary digit
> - Convert in decimal
>
> (I'm unable to show the lines found with Hough Transform anyway ...><)
>
> I can rotate the image and all.
>
> I don't have the slighest idea at how to do to extract the rectangular
> zone of the barcode and then averaging the lines.
>
> Then, I have problems with some barcodes with some reflections, some
> bars won't be continue bars so ... it inputs errors and dunno how to
> correct it (how to reform correctly the bar since some point are
> presents).
>
> Here what I have for now :http://img527.imageshack.us/img527/4...tatesz3.th.jpg
>
> I would like to post the source code but it's more than 100 lines ...
> When my problem is resolved, I think I'll contribute to the community
> by giving out the sources for recognizing a barcode from image.
>
> Help would be much appreciate.
>
> Thank you
>
> Kurapix
>
> P.S. : Sorry for my bad english


Wooops.

For the pictures, remove .th in the links to have real size pictures
(taken from a webcam).
 
Reply With Quote
 
 
 
 
Antoninus Twink
Guest
Posts: n/a
 
      04-10-2008
On 10 Apr 2008 at 22:30, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I've been working on recognizing EAN barcodes from images. Yes it's
> about recognizing barcodes from images but from bars not from the
> digit with the help of OCR software but with "Open Computer Vision
> library" (OpenCV).

[snip]
> I don't have the slighest idea at how to do to extract the rectangular
> zone of the barcode and then averaging the lines.
>
> Then, I have problems with some barcodes with some reflections, some
> bars won't be continue bars so ... it inputs errors and dunno how to
> correct it (how to reform correctly the bar since some point are
> presents).

[snip]
> I would like to post the source code but it's more than 100 lines ...
> When my problem is resolved, I think I'll contribute to the community
> by giving out the sources for recognizing a barcode from image.


That sounds like an interesting and worthwhile project, but probably a
very challenging one. It's hard to say anything useful without the
source code - for sure there'll be people here who'll be interested to
have a look at it, and probably some experts who'll be able to give you
good advice, so why not post the code, or put it on a website and post a
link?

 
Reply With Quote
 
kurapix@gmail.com
Guest
Posts: n/a
 
      04-11-2008
On 11 avr, 00:47, Antoninus Twink <(E-Mail Removed)> wrote:
> On 10 Apr 2008 at 22:30, (E-Mail Removed) wrote:
>
>
>
> > I've been working on recognizing EAN barcodes from images. Yes it's
> > about recognizing barcodes from images but from bars not from the
> > digit with the help of OCR software but with "Open Computer Vision
> > library" (OpenCV).

> [snip]
> > I don't have the slighest idea at how to do to extract the rectangular
> > zone of the barcode and then averaging the lines.

>
> > Then, I have problems with some barcodes with some reflections, some
> > bars won't be continue bars so ... it inputs errors and dunno how to
> > correct it (how to reform correctly the bar since some point are
> > presents).

> [snip]
> > I would like to post the source code but it's more than 100 lines ...
> > When my problem is resolved, I think I'll contribute to the community
> > by giving out the sources for recognizing a barcode from image.

>
> That sounds like an interesting and worthwhile project, but probably a
> very challenging one. It's hard to say anything useful without the
> source code - for sure there'll be people here who'll be interested to
> have a look at it, and probably some experts who'll be able to give you
> good advice, so why not post the code, or put it on a website and post a
> link?


I'm far from being a master.
My code is really not good since I've coded this quite fast since I
was in a hurry at the time I wrote it.

It doesn't really do anything but it's a good starting point I hope.

I'm not promising anything about it because I don't forcefully have
the time but I'll try as usual .

It would be great if people who want to contribute send their patch to
me (I didn't set up a versionning system since it's a SMALL project).

Here it is : http://www.savefile.com/files/1496871

Have fun

Kurapix
 
Reply With Quote
 
Kaz Kylheku
Guest
Posts: n/a
 
      04-11-2008
On Apr 10, 3:30*pm, (E-Mail Removed) wrote:
> Hi there!!!
>
> I've been working on recognizing EAN barcodes from images.


[ snip ]

> I haven't been successful yet.


Send the image to a laser printer, and pop up a dialog box telling the
user to get a commercial scanner + software.

> Here is my idea at how I should do it :
> - Image capture
> - Grays levels
> - Binarize image
> - Search the angle with Hough Transform
> - Rotate the image using the found angle.
> - Average of several lines for the color of the bars
> - Convert to binary digit
> - Convert in decimal


Rotate the image? Hough transform? What?

How does laser scanning work? it cris-crosses the image with a
laserbeam that is rapidly deflected by mirrors. The beam scatters with
an intensity that depends on the amount of pigmentation in the bar
code. Fluctuations in the reflected intensity are captured; from this
signal, the data packet is detected, if possible. Garbage signals are
rejected by error detection. There are patterns in the signal which
indicate the start and end of data, and patterns that code the digits.

You could simulate this lasert beam traversal of the image at various
angles using, guess what, the Bresenham line drawing algorithm.
Averaging a few surrounding pixels along the way would give you the
intensity signal to feed to the receiver arlgorithm.

Just like the laser scanner at the grocery checkout counter, you can
try several crossings at a number of orientations, until you can
successfully decode a piece of data.

There is no need whatsoever to rotate the image.

Doh?

Four orienations might be enough: - \ | /. Eight is probably better.
This pattern could be tried at various horizontal and vertical
displacements across the image.

> I don't have the slighest idea at how to do to extract the rectangular
> zone of the barcode and then averaging the lines.


No such depth image recognition is required.

You aren't writing software to read car license plates from security
camera output!

Remember, bar codes were deliberately designed to make scanning easy.
 
Reply With Quote
 
Kaz Kylheku
Guest
Posts: n/a
 
      04-11-2008
On Apr 10, 3:47*pm, Antoninus Twink <(E-Mail Removed)> wrote:
> That sounds like an interesting and worthwhile project, but probably a
> very challenging one.


I'd give my boss a four day estimate to have this code complete, put
through basic tests and ready for beta testing by the QA team.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Singapore Post 4-State Barcode Support & Postnet Barcode Recognition sherazam Java 0 05-24-2012 09:55 AM
Generate, Recognize OPC, Leitcode & VIN Barcode Symbologies sherazam Java 0 05-18-2011 08:17 AM
Read Barcode from Specific Area of Img & Create Fixed Size Barcode sherazam Java 0 03-01-2011 08:12 AM
Aztec 2D Barcode Recognition Support is Added in Aspose.BarCode sherazam Java 0 09-16-2010 10:44 AM
How do i extract vidios when winrar wont extract them??? help plzzzzzzzz smuttdog@sc.rr.com Computer Support 2 12-23-2007 07:03 AM



Advertisments