A library for grading Data Matrix codes via GS1 QA metrics
Project description
GS1Grader for UDI Vision Inspection
GS1Grader is a Python library for grading Data Matrix codes using GS1 quality metrics with modulation and symbol contrast implementation essential for UDI (Unique Device Identification) compliance in medical devices.
Prerequisites
Before installing GS1Grader, you need to install some system dependencies:
Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y \
libdmtx0b \
ffmpeg \
libsm6 \
libxext6
Mac OS
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install the required dependencies
brew install libdmtx
brew install ffmpeg
brew install uv
brew install poetry
These system dependencies are required for proper functioning of OpenCV and pylibdmtx.
Installation with uv
create a virtual environment using uv and a suitable Python version (3.11 or higher):
uv venv .venv --python 3.11
source .venv/bin/activate
You can now install GS1Grader using pip:
uv pip install gs1grader
Or if you want to install from source:
# Clone the repo
git clone https://github.com/Ceyeborg/GS1Grader.git
cd GS1Grader
poetry install
Usage
Here's a simple example of how to use GS1Grader:
from gs1grader.grader_api import DataMatrixGradeAPI
# Create a grading API instance
grader_api = DataMatrixGradeAPI()
# Grade an image using the modulation grader
grade, explanation = grader_api.grade_datamatrix(
image_path="path/to/your/datamatrix.png",
grade_type="modulation",
explanation_path="."
)
# Print the results
print(f"Grade: {grade}")
if explanation:
print(f"Explanation: {explanation}")
Available Grading Methods
The library currently supports the following grading methods:
modulation: Evaluates the modulation quality of the Data Matrixsymbol_contrast: Evaluates the symbol contrast quality
API Reference
DataMatrixGradeAPI
The main class for grading Data Matrix codes.
Methods:
grade_datamatrix(image_path: str, grade_type: str, explain: bool = False):image_path: Path to the Data Matrix image filegrade_type: Type of grading to perform ("modulation" or "symbol_contrast")explanation_path: Provide a path to save png of the detailed explanation of the grade (optional)- Returns: A tuple of (grade, explanation)
License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.
The AGPL-3.0 is a copyleft license that requires anyone who distributes your code or a derivative work to make the source available under the same terms, and also requires you to provide the source code to users who interact with your software as a service.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gs1grader-1.0.0.tar.gz.
File metadata
- Download URL: gs1grader-1.0.0.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9f8f6ac7e659c3d8993fd351e1da0e63eb679eb28b5469403370d349963b0b0
|
|
| MD5 |
58cdb91271032b64e0ed37c59351105d
|
|
| BLAKE2b-256 |
b7093cc31c9c6607be63453894cfda7286f1be25c9193269ca753424005f98f8
|
Provenance
The following attestation bundles were made for gs1grader-1.0.0.tar.gz:
Publisher:
ci.yml on Ceyeborg/GS1Grader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gs1grader-1.0.0.tar.gz -
Subject digest:
b9f8f6ac7e659c3d8993fd351e1da0e63eb679eb28b5469403370d349963b0b0 - Sigstore transparency entry: 227393011
- Sigstore integration time:
-
Permalink:
Ceyeborg/GS1Grader@ac180078165950fc3bc729b8e81d3cb92e536479 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ceyeborg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@ac180078165950fc3bc729b8e81d3cb92e536479 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gs1grader-1.0.0-py3-none-any.whl.
File metadata
- Download URL: gs1grader-1.0.0-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dd9436ead9168a8d0b63501ddcb83a5cc9edf427ec1edfc079c86889a2b0797
|
|
| MD5 |
e6230c408091bab4ac67721514d88b52
|
|
| BLAKE2b-256 |
c788eaa940a77e7b74d28d9accd7d3f9d07812641d6741e9667c0c6fa6560ae4
|
Provenance
The following attestation bundles were made for gs1grader-1.0.0-py3-none-any.whl:
Publisher:
ci.yml on Ceyeborg/GS1Grader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gs1grader-1.0.0-py3-none-any.whl -
Subject digest:
3dd9436ead9168a8d0b63501ddcb83a5cc9edf427ec1edfc079c86889a2b0797 - Sigstore transparency entry: 227393014
- Sigstore integration time:
-
Permalink:
Ceyeborg/GS1Grader@ac180078165950fc3bc729b8e81d3cb92e536479 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ceyeborg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@ac180078165950fc3bc729b8e81d3cb92e536479 -
Trigger Event:
push
-
Statement type: