Registry / devops / qreader

qreader

JSON →
library3.16pypypi✓ verified 86d ago

QReader is a robust and straight-forward QR code detection and decoding library for Python, powered by a YOLOv8-based QR segmentation model. It excels at reading difficult, blurry, or tricky QR codes. The current version is 3.16, with active development and frequent updates.

pip install qreader
INSTALL
IMPORT
SIG · QREADER
Q
qreader
devopspythonv3.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QReader
from qreader import QReader
import QReader
QReader is a class exported from the qreader package.

Basic usage: load an image, detect and decode QR codes, and print the result.

from qreader import QReader import cv2 # Initialize QReader qreader = QReader() # Read image image = cv2.imread('path/to/qr_code.jpg') if image is None: print('Could not load image') import sys sys.exit(1) # Detect and decode decoded_text = qreader.detect_and_decode(image=image) if decoded_text: print('Decoded text:', decoded_text) else: print('No QR code found')
Debug
Known issues
gotchaReturns empty list if no QR code is found, not None.
fix
Check if the list is empty with 'if not decoded_text' instead of 'if decoded_text is None'.
affects: >=3.0
gotchaInput image must be a numpy array (OpenCV format). QReader does not accept file paths directly.
fix
Load the image using cv2.imread() or another method to get a numpy array before passing to QReader.
affects: all
deprecatedThe 'detect_and_decode' method with argument 'img' (instead of 'image') is deprecated in version 3.0+.
fix
Use 'image' as the keyword argument instead of 'img'.
affects: >=3.0, <3.16
gotchaQReader downloads the YOLOv8 model on first use, which requires internet and may take a few seconds.
fix
Ensure internet connectivity on first run, or consider pre-downloading the model.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'qreader'
QReader is not installed.
fix
Run 'pip install qreader'.
AttributeError: module 'qreader' has no attribute 'QReader'
Incorrect import statement.
fix
Use 'from qreader import QReader'.
TypeError: detect_and_decode() missing 1 required positional argument: 'img'
Using old API with 'img' parameter.
fix
Use 'image' instead of 'img' as the argument name.
ValueError: Could not find a QR code
No QR code detected in the image or decoding failed.
fix
Ensure the image contains a visible QR code, try different image preprocessing.
Upgrade
Version history
3.16latest on PyPI · released Feb 16, 2025
Audit
Dependencies
opencv-pythonrequiredRequired for image loading and processing.
pyzbarrequiredRequired for decoding QR codes.
ultralyticsrequiredRequired for YOLOv8 model loading and inference.
Agent activity
5 hits · last 30 days
node
5
Resources
qreader — pip install qreader · libregistry