fix: [ocr] catch cv2 errors

This commit is contained in:
terrtia 2024-05-02 10:36:20 +02:00
parent e21257a3fe
commit adbce24128
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -9,6 +9,7 @@ The OcrExtractor Module
################################## ##################################
# Import External packages # Import External packages
################################## ##################################
import cv2
import os import os
import sys import sys
@ -103,7 +104,7 @@ class OcrExtractor(AbstractModule):
print(image.id, languages) print(image.id, languages)
try: try:
texts = Ocrs.extract_text(path, languages) texts = Ocrs.extract_text(path, languages)
except (OSError, ValueError) as e: except (OSError, ValueError, cv2.error) as e:
self.logger.warning(e) self.logger.warning(e)
self.obj.add_tag('infoleak:confirmed="false-positive"') self.obj.add_tag('infoleak:confirmed="false-positive"')
texts = None texts = None