mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-28 21:03:54 -06:00

Platforms we target have new enough tesseract that it suffices to merely check if the binary exists. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20241217155953.3950506-7-berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
25 lines
708 B
Python
25 lines
708 B
Python
# ...
|
|
#
|
|
# Copyright (c) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
|
|
#
|
|
# This work is licensed under the terms of the GNU GPL, version 2 or
|
|
# later. See the COPYING file in the top-level directory.
|
|
|
|
import logging
|
|
|
|
from . import run_cmd
|
|
|
|
def tesseract_ocr(image_path, tesseract_args=''):
|
|
console_logger = logging.getLogger('console')
|
|
console_logger.debug(image_path)
|
|
(stdout, stderr, ret) = run_cmd(['tesseract', image_path,
|
|
'stdout'])
|
|
if ret:
|
|
return None
|
|
lines = []
|
|
for line in stdout.split('\n'):
|
|
sline = line.strip()
|
|
if len(sline):
|
|
console_logger.debug(sline)
|
|
lines += [sline]
|
|
return lines
|