Skip to main content

Read QR code

Description

This is a simple python script that reads a QR code from an image and prints the result. It uses the WeChat QR code reader API in OpenCV to read the QR code from a CV2 image.

Requirements

Important: This package requires opencv-contrib-python, NOT the standard opencv-python package.

Installation

Option 1: Install from pip (recommended)

pip install readQR

Option 2: Install from source

# Clone the repository
git clone https://github.com/CollinsWakholi/QR_Code.git
cd QR_Code

# Uninstall any existing opencv packages to avoid conflicts
pip uninstall opencv-python opencv-contrib-python -y

# Install dependencies (opencv-contrib-python includes all standard OpenCV features)
pip install -r requirements.txt

Note: If you have opencv-python installed, you MUST uninstall it first:

pip uninstall opencv-python opencv-contrib-python -y
pip install opencv-contrib-python>=4.5.0

The WeChat QR code detector is only available in opencv-contrib-python, not in the standard opencv-python package. Having both installed can cause conflicts.

Verify Installation

After installation, verify everything is set up correctly:

python check_installation.py

Usage

from readQR import ReadQR
import readQR.wechat_artefacts as artefacts
import cv2

art_dir = artefacts.__path__[0]
img = cv2.imread('test.png')
reader = ReadQR(artefact_path=art_dir)
show = None # Set to "single" or "continuous" to show the image with the QR code highlighted for single or continuous frames (video)
result = reader.decode(img, show=show)
[print(r) for r in result]

Sample input and output images

Input images

Output images

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

None

Acknowledgemnts

I am gratefully acknowledge Devin Rippner, ORISE, and the USDA for their invaluable assistance and funding support in the development of this Repo. This project would not have been possible without their guidance and opportunities provided.

Metadata

Release files for readQR 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for readQR 0.0.3
File Size Uploaded
readqr-0.0.3.tar.gz 926.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for readQR 0.0.3
File Interpreter ABI Platform
readqr-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 1.9 MB

Release files / readqr-0.0.3.tar.gz

Download URL readqr-0.0.3.tar.gz
Size 926.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b8034d94a362a5e835b6df9fc4e8adbbcf99728e141053e7c8211755e4cfd6f3
BLAKE2b-256 checksum
How to use checksums
6382e579543f33f95cb66eeeec674232e15fb68b95e1fda8c65d7bceee83efae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / readqr-0.0.3-py3-none-any.whl

Download URL readqr-0.0.3-py3-none-any.whl
Size 924.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e74d943947fba6c0d139822ccab65c066f85dcfd25d5041e1e0be5ce4fad78f5
BLAKE2b-256 checksum
How to use checksums
83870b9a98aafaee203d7dd186baf9ccdb31035dbd5150bfb74e0cebb9f45b54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page