The samples demonstrate how to detect QR with YOLO and how to decode QR with Dynamsoft Barcode Reader.
-
OpenCV
pip install opencv-python
-
Dynamsoft Barcode Reader
pip install dbr
Image file:
python3 opencv-yolo.py
Camera:
python3 opencv-yolo-camera.py
from dbr import *
reader = BarcodeReader()
# Apply for a trial license: https://www.dynamsoft.com/customer/license/trialLicense
license_key = "LICENSE KEY"
reader.init_license(license_key)
settings = reader.reset_runtime_settings()
settings = reader.get_runtime_settings()
settings.region_bottom = bottom
settings.region_left = left
settings.region_right = right
settings.region_top = top
reader.update_runtime_settings(settings)
try:
text_results = reader.decode_buffer(frame)
if text_results != None:
for text_result in text_results:
print("Barcode Format :")
print(text_result.barcode_format_string)
print("Barcode Text :")
print(text_result.barcode_text)
print("Localization Points : ")
print(text_result.localization_result.localization_points)
print("-------------")
except BarcodeReaderError as bre:
print(bre)
Image file:
python3 yolo-dbr.py
Camera:
python3 yolo-dbr-camera.py