Ask Your Question

Barcode/label detection

asked 2019-02-05 10:24:59 -0600

FreddyB gravatar image

updated 2019-02-05 10:50:35 -0600

I am learning opencv with the hope of developing a python program that will detect labels and identify numbers on cotton bales from a video camera mounted on a forklift. With what I have learned so far, I am assuming that the best way would be to use a haar cascade to detect and extract the label from the image, then implement some other library to decode a bar code or use ocr to read the numbers on the label.

My question(s) are:

  • Is my assumption correct that haar cascade is the best way
  • What kind of images would be best to train the cascade? My concern is that it will only detect the numbers that were used to train the cascade.
  • I do have the ability to change the label. Is there a change that would make the label easier to detect?
  • Is OCR number reading better/easier/more reliable than decoding bar codes or vice-versa

Any other advice or direction would be greatly appreciated. I am attaching pictures of bales and label. Thanks in advance.



edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2019-02-05 17:27:49 -0600

updated 2019-02-05 18:02:51 -0600

i think Cascade classifier is not can try for some ideas.

take a look at the image below to see some results if you can do right segmentation of digits

image description

you can get the image above by adding

frame = cv.imread("15494095161414931.jpg")

at line 39

using the image below which i manually cropped digits and resized 2.5x from your image to show just an idea to start (you need to improve )image description

edit flag offensive delete link more


Thank you. Most helpful.

FreddyB gravatar imageFreddyB ( 2019-02-07 21:07:43 -0600 )edit

answered 2019-02-05 13:55:08 -0600

I work in the barcode scanner industry. Some thoughts.

There is no one best detection+decode method; it depends on application needs: time, CPU, RAM, camera performance, co-processing, frame rate, pose of labels, etc. Researching public implementations and papers may educate you and save you time. Keep an open mind, keep your techniques simple.

Note: I haven't employed machine learning for detecting presence of or decoding barcodes.

Labels need to be big enough to be easily detected and decode elements with high contrast, not over/under printed, correctly illuminated, etc. In your multiple bale image, labels are too small with light reflections.

OCR reading: in general, it's hard to find and decode. Barcodes were designed to be easy to be detected/decoded reliably and naively.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-02-05 10:24:59 -0600

Seen: 2,863 times

Last updated: Feb 05 '19