NaturalHistoryMuseum / pyzbar

Read one-dimensional barcodes and QR codes from Python 2 and 3.
MIT License
728 stars 176 forks source link

How might I prevent grouping of same barcodes? #104

Open alexander-soare opened 3 years ago

alexander-soare commented 3 years ago

I'm mostly interested in barcode detection rather than scanning, so I care about the bounding polygons being accurate. Sometimes my image may have multiple copies of the same barcode, and I want to ensure that each gets it's own polygon, whereas now they are being grouped like this:

image

Looking at the code, I can't see a Python way to solve this. Could anyone provide tips?

Best, Alex

Ranecdev commented 1 year ago

@alexander-soare Did you ever find a solution for this ?

alexander-soare commented 1 year ago

@Ranecdev I ended up using pyzbar and zxing https://github.com/dlenski/python-zxing. I think pyzbar is better because it gives a bounding polygon whereas I'm pretty sure zxing only gives a line passing through the barcode, but at least it separates barcodes. So I combined both: pyzbar for the actual detection, but zxing to indicate when there are multiple detections in one polygon.