From 13f0d59853cbf42c84cc80e4ccf5f207a43c0301 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 1 Jun 2021 05:05:31 +0300 Subject: [PATCH] Fix QR recognition code for Python 3 --- builder/test/test_qr.py | 2 +- docs/en/camera.md | 2 +- docs/ru/camera.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/test/test_qr.py b/builder/test/test_qr.py index 4120ceb7..438e18ac 100644 --- a/builder/test/test_qr.py +++ b/builder/test/test_qr.py @@ -17,7 +17,7 @@ def image_callback(data): cv_image = bridge.imgmsg_to_cv2(data, 'bgr8') # OpenCV image barcodes = pyzbar.decode(cv_image) for barcode in barcodes: - b_data = barcode.data.encode("utf-8") + b_data = barcode.data.decode("utf-8") b_type = barcode.type (x, y, w, h) = barcode.rect xc = x + w/2 diff --git a/docs/en/camera.md b/docs/en/camera.md index 337e724e..5dfe34fa 100644 --- a/docs/en/camera.md +++ b/docs/en/camera.md @@ -133,7 +133,7 @@ def image_callback(data): cv_image = bridge.imgmsg_to_cv2(data, 'bgr8') # OpenCV image barcodes = pyzbar.decode(cv_image) for barcode in barcodes: - b_data = barcode.data.encode("utf-8") + b_data = barcode.data.decode("utf-8") b_type = barcode.type (x, y, w, h) = barcode.rect xc = x + w/2 diff --git a/docs/ru/camera.md b/docs/ru/camera.md index 68441775..522f89ba 100644 --- a/docs/ru/camera.md +++ b/docs/ru/camera.md @@ -135,7 +135,7 @@ def image_callback(data): cv_image = bridge.imgmsg_to_cv2(data, 'bgr8') # OpenCV image barcodes = pyzbar.decode(cv_image) for barcode in barcodes: - b_data = barcode.data.encode("utf-8") + b_data = barcode.data.decode("utf-8") b_type = barcode.type (x, y, w, h) = barcode.rect xc = x + w/2