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

[OpenCV] Extract en recognize barcode from image file.

P: n/a
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
Apr 10 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 11 avr, 00:30, kura...@gmail.com 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).
Apr 10 '08 #2

P: n/a
On 10 Apr 2008 at 22:30, ku*****@gmail.com 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?

Apr 10 '08 #3

P: n/a
On 11 avr, 00:47, Antoninus Twink <nos...@nospam.invalidwrote:
On 10 Apr 2008 at 22:30, kura...@gmail.com 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
Apr 11 '08 #4

P: n/a
On Apr 10, 3:47*pm, Antoninus Twink <nos...@nospam.invalidwrote:
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.
Apr 11 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.