Skip to main content

Image 1D Barcode EXtractor - Detect and Extract 1D Barcode(s) in Photographs

Project description

IBEX 1D : Image 1D Barcode EXtractor

Detect 1D Barcode(s) in Photographs, Extract & Straighten them!

A Python 3 command line script to detect & extract barcode(s) in images, using OpenCV and NumPy.

Example of barcode extraction

Install

Via PIP

pip3 install ibex_1d

Then (if you have for example a photograph located at ~/Desktop/IMG_3212.png):

ibex_1d -i ~/Desktop/IMG_3212.png

Via Source Code

Download the latest release or clone/download this repository, then:

python3 ibex_1d.py -i ~/Desktop/IMG_3212.png

NOTE: Using this method you will need to call the script with python3 ibex_1d.py ...

Results

The barcode images extracted will be saved into a newly created folder inside ./results/, if nothing has been generated please check the log(s) in your terminal.

Multiple images

You can pass one or more images/photographs to the script like this:

ibex_1d -i ~/Desktop/IMG_3205.png ./object_12.jpg ~/Documents/photo_0345.jpeg

Inside the result sub-folder, extracted paper sheets will be named barcode_001.png, barcode_002.png, barcode_003.png, ...

Incorrect result ?

If the barcode hasn't been extracted (or the resulting barcode image isn't good) this can be due to the OTSU threshold method. You can try using the script with the argument -a (or --adaptive-threshold):

ibex_1d -i ~/Desktop/IMG_3205.png -a

This threshold method isn't set as default because it's slower than OTSU.

Debug

You can visualize some steps of the sheet detection by adding the argument -d or --debug to the command:

ibex_1d -i ~/Documents/product_03.jpeg -d

This will add debug images into the result sub-folder.

Errors / Warnings

In case of an error you should see a formatted log message in your terminal telling you exactly what is the issue. If the script crash or something don't work you can open an issue here.

Author / Maintainer

IBEX 1D has been created and is currently maintained by Ben Souchet.

Licenses

The code present in this repository is under MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ibex_1d-1.2.0.tar.gz (13.2 kB view hashes)

Uploaded Source

Built Distribution

ibex_1d-1.2.0-py3-none-any.whl (13.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page