Skip to main content

Read QR code from image using WeChat QR code reader in OpenCV

Project description

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.

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

readqr-0.0.2.tar.gz (926.5 kB view details)

Uploaded Source

Built Distribution

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

readqr-0.0.2-py3-none-any.whl (924.0 kB view details)

Uploaded Python 3

File details

Details for the file readqr-0.0.2.tar.gz.

File metadata

  • Download URL: readqr-0.0.2.tar.gz
  • Upload date:
  • Size: 926.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for readqr-0.0.2.tar.gz
Algorithm Hash digest
SHA256 815a7048ab22592b162d1193eb42657af77215cc3218b98cf0c290ac842f063d
MD5 a1f273dd5cadf1340d01a1e1c1255b9d
BLAKE2b-256 1105d9d4965873b34bede27f8902e13db60bc554cc3c1ac0d1f516ec60cc52d6

See more details on using hashes here.

File details

Details for the file readqr-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: readqr-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 924.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for readqr-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 52ee76fb7c8f08793d994509f061077ee487a85eb16ab36afcd25dd8a79db792
MD5 d042565084f4a745a479d1d48dae38fd
BLAKE2b-256 dffbb89c99dcebff5916dfbe2c695f752c5d1425b72e92df7de7fc7a13d16715

See more details on using hashes here.

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