Skip to main content

QRDet

QRDet is a robust QR Detector based on YOLOv7.

QRDet will detect QR codes even in difficult positions or tricky images. If you are looking for a complete QR Detection + Decoding pipeline, take a look at QReader.

Installation

To install QRDet, simply run:

pip install qrdet

Usage

There is only one function you'll need to call to use QRDet, detect:

from qrdet import QRDetector
import cv2

detector = QRDetector()
image = cv2.imread(filename='resources/qreader_test_image.jpeg')
detections = detector.detect(image=image, is_bgr=True)

# Draw the detections
for (x1, y1, x2, y2), confidence in detections:
    cv2.rectangle(image, (x1, y1), (x2, y2), color=(0, 255, 0), thickness=2)
    cv2.putText(image, f'{confidence:.2f}', (x1, y1 - 10), fontFace=cv2.FONT_HERSHEY_SIMPLEX, fontScale=1,
                color=(0, 255, 0), thickness=2)
# Save the results
cv2.imwrite(filename='resources/qreader_test_image_detections.jpeg', img=image)
detections_output

API Reference

QReader.detect(image, return_confidences = True, as_float = False, is_bgr = False)

  • image: np.ndarray. NumPy Array containing the image to decode. The image is expected to be in uint8 format [HxWxC], RGB or BGR depending on the is_bgr parameter.

  • return_confidences: bool. If True, the output will be in the format (((x1, y1, x2, y2), confidence), ...). Otherwise, it will be in the format ((x1, y1, x2, y2), ...). Default: True.

  • return_confidences: bool. If True, the returned coordinates will be returned as float, with the complete precision outputted from the detection model. Otherwise, they will be rounded to the closest integer. Default: False.

  • is_bgr: bool. If True the image is expected to be in BGR. Otherwise, it will be expected to be RGB. Default: False

  • Returns: tuple[tuple[tuple[int, int, int, int], float], ...] | tuple[tuple[int, int, int, int]]: A tuple with the coordinates of all detected QR codes. If return_confidences is True, the output will look like: (((x1, y1, x2, y2), confidence), ...). If return_confidences is False it will look like: ((x1, y1, x2, y2), ...).

Acknowledgements

This library is based on the following projects:

  • YoloV7 model for Object Detection.

Metadata

Release files for qrdet 1.7

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

Source distribution (sdist)

Source distribution for qrdet 1.7
File Size Uploaded
qrdet-1.7.tar.gz 5.5 kB Details

Release files / qrdet-1.7.tar.gz

Download URL qrdet-1.7.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
12c60c127b3c850476ccafa4a567c1546c7f923e1e91b06dd99dd8c919100db5
BLAKE2b-256 checksum
How to use checksums
4a3b691cebaca37ef46cdf437e5178644cfc18309e756e3a02f96e986d83844c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.2

Release history Release notifications | RSS feed

2.5

2 release files

2.4

1 release file

2.3

1 release file

2.2

1 release file

2.1

1 release file

2.0

1 release file

1.10

1 release file

1.9

1 release file

1.8

1 release file

This release

1.7 This release

1 release file

1.6

1 release file

1.5

1 release file

1.4

1 release file

1.3

1 release file

1.2

1 release file

1.1

1 release file

1.0.0

1 release file

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