Skip to main content

A library for grading Data Matrix codes usingGS1 quality metrics

Project description

GS1Grader

Banner

GS1Grader is a Python library for grading Data Matrix codes using GS1 quality metrics with modulation and symbol contrast implementation.

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 required dependencies
brew install libdmtx
brew install ffmpeg

These system dependencies are required for proper functioning of OpenCV and pylibdmtx.

Installation

You can install GS1Grader using pip:

pip install gs1grader

If you want to install from source:

# Clone the repo
git clone --recurse-submodules https://github.com/Ceyeborg/GS1Grader.git
cd GS1Grader

# Make the script executable
chmod +x install.sh

# Run the installation script
./install.sh

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 Matrix
  • symbol_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 file
    • grade_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

gs1grader-0.1.1.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gs1grader-0.1.1-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file gs1grader-0.1.1.tar.gz.

File metadata

  • Download URL: gs1grader-0.1.1.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gs1grader-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bdfb1fb1fa0caf4f70374403f9673fedad647cbf3d50d3469d33618a1570e733
MD5 86f4d588cba6d66110516fc1d15ee32f
BLAKE2b-256 d1438f0cd9f4555357354c46e25c7e029e04fa71dda6910cf5b1bcad912ee3ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for gs1grader-0.1.1.tar.gz:

Publisher: publish.yml on Ceyeborg/GS1Grader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gs1grader-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gs1grader-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gs1grader-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 742c01e9d1b394d38e8efe66e6673e9188ca319c95e8f0b2f34c66cc45617f60
MD5 a77d0e7cbbab0a96e1c7f79a13030d9d
BLAKE2b-256 989236a9841d0a4d15951f3d70491a0365f9a5fe3186ead32655621dadb6dc05

See more details on using hashes here.

Provenance

The following attestation bundles were made for gs1grader-0.1.1-py3-none-any.whl:

Publisher: publish.yml on Ceyeborg/GS1Grader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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