Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sparkfish/pdf417decoder
PDF417 Decoder available in Python
https://github.com/sparkfish/pdf417decoder
barcode-decoder barcode-reader pdf417 pdf417-decoder pdf417-reader pdf417decoder pdf417reader
Last synced: 22 days ago
JSON representation
PDF417 Decoder available in Python
- Host: GitHub
- URL: https://github.com/sparkfish/pdf417decoder
- Owner: sparkfish
- Created: 2021-03-30T15:28:12.000Z (almost 4 years ago)
- Default Branch: dev
- Last Pushed: 2022-07-17T00:43:32.000Z (over 2 years ago)
- Last Synced: 2024-12-02T18:59:40.630Z (about 1 month ago)
- Topics: barcode-decoder, barcode-reader, pdf417, pdf417-decoder, pdf417-reader, pdf417decoder, pdf417reader
- Language: Python
- Homepage:
- Size: 1.74 MB
- Stars: 57
- Watchers: 9
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pdf417decoder
![Image of a PDF417 barcode](https://raw.githubusercontent.com/sparkfish/pdf417decoder/dev/python/images/haiku.png?id=1)pdf417decoder is a pure Python library for decoding [PDF417 barcodes](https://en.wikipedia.org/wiki/PDF417).
Reader is capable of Error Detection and Correction according to the standards for PDF417 which you can read about here [ISO/IEC 15438:2006](https://www.iso.org/standard/43816.html) or download an older version of the PDF [this website](https://www.expresscorp.com/public/uploads/specifications/44/USS-PDF-417.pdf).
## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install pdf417decoder.
```bash
pip install pdf417decoder
```## Usage
```python
from PIL import Image as PIL
from pdf417decoder import PDF417Decoderimage = PIL.open("barcode.png")
decoder = PDF417Decoder(image)if (decoder.decode() > 0):
decoded = decoder.barcode_data_index_to_string(0)
```## Testing Results
This library was tested using [pdf417gen](https://pypi.org/project/pdf417gen/) to create random barcodes and blurred with [OpenCV](https://pypi.org/project/opencv-python/) to test error correction. PyTest is used with several test images to show the libraries capability to decode barcodes in the following test cases.
* Binary data
* Multiple barcodes
* Upside down barcode
* Rotated barcode
* Error Corrections: Corrupted data due to blurred barcode
* Error Corrections: Missing data due marks concealing barcode
* Character type transitions (Upper, Lower, Mixed and Punctuation)## Roadmap
- [x] Initial port of C# to Python
- [x] Create tests for functionality
- [x] Create fuzzy testing of decoder
- [x] Decode from PIL.Image
- [ ] Decode from Numpy Array
- [ ] Convert THRESH_OTSU image processing to use original algorithm written in C# or alternative
- [ ] Performance testing and optimizations## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.## License
[CPOL](https://www.codeproject.com/info/cpol10.aspx)This project is a derivative of code licensed under the Code Project Open License (CPOL). The Code Project Open License (CPOL) is intended to provide developers who choose to share their code with a license that protects them and provides users of their code with a clear statement regarding how the code can be used.
## Credits
Source code is a port of a C# Library created and maintained by [Uzi Granot](https://www.codeproject.com/script/Membership/View.aspx?mid=193217). [PDF417 Barcode Decoder .NET Class Library and Two Demo Apps](https://www.codeproject.com/Articles/4042463/PDF417-Barcode-Decoder-NET-Class-Library-and-Two-D)