def parse_text(self, img):
filename = "obj_{}.png".format(id(self))
self.save_bounding_box(img, filename)
cmd = [
'tesseract',
filename,
'stdout',
'--psm',
'7',
'-l',
'eng+equ',
'-c',
'tessedit_char_whitelist=abcdefghijklmnopqrstuvwxyz0123456789=+-*/'
]
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
self.text = result.stdout.decode('ascii').strip().lower() or ''
评论列表
文章目录