oz/dev/: cobra-2.1.0 metadata and description
corners model includes STN and UNET style architecture.
| author | Oz Wilson |
| author_email | oz.wilson@trulioo.com |
| description_content_type | text/markdown |
| requires_dist |
|
| requires_python | <3.11 |
Because this project isn't in the mirror_whitelist,
no releases from root/pypi are included.
| File | Tox results | History |
|---|---|---|
cobra-2.1.0-py3-none-any.whl
|
|
Cobra Barcode Decoder
pdf417 barcodes (no other barcodes types supported):
- Predict rows and columns of barcode.
- Predict 4 edge corners of barcode.
- Using rows, columns and corners then grid the barcode to predict each individual codeword.
- Decode all codewords in barcode.
Installation
Within a cmd prompt, create a virtual python environment - to isolate dependencies:
python -m venv cobra_env
py -3.9 -m venv cobra_env (create env with specific python version)
Switch into that environment by running:
cobra_env\Scripts\activate
On linux:
source cobra_env/bin/activate
To install package needed with devpi url (there will be warnings if https is still not working - switched to http for now):
pip install --index-url http://pip.ml.prod.trulioo.com/oz/dev --trusted-host pip.ml.prod.trulioo.com cobra
To set up devpi:
pip install devpi-client
devpi use https://pip.ml.prod.trulioo.com
devpi login <user> (devpi user -c user if user doesn't exist)
Usage Overview
import cobra
reader = cobra.PDF417Reader(device='cpu', cropped_image_pad=27, wanted_img_size=(128, 384), codewords_wanted_img_size=(36, 64), padding_multi=2)
Takes device name - by default not needed and uses cpu (other paramaters defaults are based on models added).
barcodes_data, extracted_codewords, pred_rows, pred_cols, pred_corners = reader.decode_single(PIL.Image.Image, box=None)
Expects a PIL image and must provide a box for cropping barcode for decode_single to work properly or method will raise an exception if box is not given in a correct format: [x1, y1, x2 ,y2].
-The first value is -
Barcode data.
-The second value is -
A list of codewords in row-major order.
-The third value is -
Number of rows.
-The fourth value is -
Number of columns.
-The fith value is -
A list of (x, y) coordinates starting from left top corner going counterclockwise.
Note: If can not decode an image, returns None for first and second value but still returns rows, columns and corners if possible.