mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-14 18:48:29 +00:00
fix: [qrcode extractor] fix catch cv2 exception
This commit is contained in:
parent
ef932545b2
commit
970a169270
1 changed files with 16 additions and 10 deletions
|
@ -69,16 +69,22 @@ class QrCodeReader(AbstractModule):
|
||||||
|
|
||||||
if not contents:
|
if not contents:
|
||||||
detector = cv2.QRCodeDetector()
|
detector = cv2.QRCodeDetector()
|
||||||
qr, decodeds, qarray, _ = detector.detectAndDecodeMulti(image)
|
try:
|
||||||
if qr:
|
qr, decodeds, qarray, _ = detector.detectAndDecodeMulti(image)
|
||||||
qr_codes = True
|
if qr:
|
||||||
for d in decodeds:
|
qr_codes = True
|
||||||
if d:
|
for d in decodeds:
|
||||||
contents.append(d)
|
if d:
|
||||||
data_qr, box, qrcode_image = detector.detectAndDecode(image)
|
contents.append(d)
|
||||||
if data_qr:
|
except cv2.error as e:
|
||||||
contents.append(data_qr)
|
self.logger.error(f'{e}: {self.obj.get_global_id()}')
|
||||||
qr_codes = True
|
try:
|
||||||
|
data_qr, box, qrcode_image = detector.detectAndDecode(image)
|
||||||
|
if data_qr:
|
||||||
|
contents.append(data_qr)
|
||||||
|
qr_codes = True
|
||||||
|
except cv2.error as e:
|
||||||
|
self.logger.error(f'{e}: {self.obj.get_global_id()}')
|
||||||
|
|
||||||
if qr_codes and not contents:
|
if qr_codes and not contents:
|
||||||
# # # # 0.5s per image
|
# # # # 0.5s per image
|
||||||
|
|
Loading…
Reference in a new issue