OpenCV has some tutorials that deal with trying to detect patterns in a live video stream. E.g.:
http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html
However, that is not really what I'm trying to do. I have static images, such as .jpgs, that include 2D barcodes.
My goal is to isolate one or more 2D barcodes from the image. If the .jpg is 1000 pixels by 500 pixels, and the 2D barcode is just 200 pixels by 200 pixels, I just want to save the 200x200 pixel sample to an output file.
I suspect that this requires either a Haar cascade or an LBP cascade. I suspect feature detection won't be able to do this.
However, I can't find any tutorials that address this problem.
Further, the opencv distribution automatically builds some executables that seem to be related, such as opencv_perf_objdetect and opencv_test_objdetect, but they don't seem to correspond to the tutorials, nor to anything else in the documentation.
Question: Is the problem of how to detect sub-images within a static image actually explained somewhere in the OpenCV documentation? If so, where?
Thanks.
It can be used to detect areas that may contain a barcode and eliminate most background. Then the precise barcode area can be found according to other barcode features.
I was recently working on a barcode detection project. At the beginning I supposed that a simple machine learning algorithm combined with a texture-based descriptor can resolve the barcode detection. However, I have experienced several problems because in the case of my application I don’t know if there is a barcode or not, it’s size, it’s type (UPC-A, EAN …), it’s orientation… which supposes to try many combinations in order to localize the barcode.
I also didn’t dispose of or have the time to create a training dataset adequate to the type of images I have, so I didn’t continue with this solution. Then I have read several articles. Many dedicated barcode detection methods start from the assumption that there is a barcode in the image and so they are trying to find it. Moreover, some of the algorithms suppose that the barcode is horizontal, and use this hypothesis as an a priori information.
The best solution I have found is BLaDE (http://www.ski.org/Rehab/Coughlan_lab/BLaDE/BLaDE_TechReport.pdf). The code is also available on the web, so you can easily test it. The only problem is that it was designed only for UPC-A barcodes.
To resume, the best solution for you depends on several aspects:
the type of barcode
you know for sure that there is a barcode
it’s orientation: any/a given angle
real time application/device to run it
you dispose of a training set
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With