mirror of https://github.com/CIRCL/AIL-framework
fix: [qrcode extractor] fix catch cv2 exception
parent
ef932545b2
commit
970a169270
|
@ -69,16 +69,22 @@ class QrCodeReader(AbstractModule):
|
||||||
|
|
||||||
if not contents:
|
if not contents:
|
||||||
detector = cv2.QRCodeDetector()
|
detector = cv2.QRCodeDetector()
|
||||||
|
try:
|
||||||
qr, decodeds, qarray, _ = detector.detectAndDecodeMulti(image)
|
qr, decodeds, qarray, _ = detector.detectAndDecodeMulti(image)
|
||||||
if qr:
|
if qr:
|
||||||
qr_codes = True
|
qr_codes = True
|
||||||
for d in decodeds:
|
for d in decodeds:
|
||||||
if d:
|
if d:
|
||||||
contents.append(d)
|
contents.append(d)
|
||||||
|
except cv2.error as e:
|
||||||
|
self.logger.error(f'{e}: {self.obj.get_global_id()}')
|
||||||
|
try:
|
||||||
data_qr, box, qrcode_image = detector.detectAndDecode(image)
|
data_qr, box, qrcode_image = detector.detectAndDecode(image)
|
||||||
if data_qr:
|
if data_qr:
|
||||||
contents.append(data_qr)
|
contents.append(data_qr)
|
||||||
qr_codes = True
|
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 New Issue