Skip to content
This repository was archived by the owner on Jun 14, 2018. It is now read-only.

Commit c136838

Browse files
Use '--psm' instead of '-psm' as the option was deprecated.
This recently changed in the official tesseract engine [0]. '-psm' is not allowed as an option anymore and '--psm' has to be used instead. [0] tesseract-ocr/tesseract@ee201e1
1 parent 31fb5f1 commit c136838

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/pyocr/builders.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ class TextBuilder(BaseBuilder):
305305
def __init__(self, tesseract_layout=3, cuneiform_dotmatrix=False,
306306
cuneiform_fax=False, cuneiform_singlecolumn=False):
307307
file_ext = ["txt"]
308-
tess_flags = ["-psm", str(tesseract_layout)]
308+
tess_flags = ["--psm", str(tesseract_layout)]
309309
cun_args = ["-f", "text"]
310310
# Add custom cuneiform parameters if needed
311311
for par, arg in [(cuneiform_dotmatrix, "--dotmatrix"),
@@ -562,7 +562,7 @@ class WordBoxBuilder(BaseBuilder):
562562

563563
def __init__(self, tesseract_layout=1):
564564
file_ext = ["html", "hocr"]
565-
tess_flags = ["-psm", str(tesseract_layout)]
565+
tess_flags = ["--psm", str(tesseract_layout)]
566566
tess_conf = ["hocr"]
567567
cun_args = ["-f", "hocr"]
568568
super(WordBoxBuilder, self).__init__(file_ext, tess_flags, tess_conf,
@@ -638,7 +638,7 @@ class LineBoxBuilder(BaseBuilder):
638638

639639
def __init__(self, tesseract_layout=1):
640640
file_ext = ["html", "hocr"]
641-
tess_flags = ["-psm", str(tesseract_layout)]
641+
tess_flags = ["--psm", str(tesseract_layout)]
642642
tess_conf = ["hocr"]
643643
cun_args = ["-f", "hocr"]
644644
super(LineBoxBuilder, self).__init__(file_ext, tess_flags, tess_conf,

src/pyocr/tesseract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def detect_orientation(image, lang=None):
178178
"""
179179
_set_environment()
180180
with temp_dir() as tmpdir:
181-
command = [TESSERACT_CMD, "input.bmp", 'stdout', "-psm", "0"]
181+
command = [TESSERACT_CMD, "input.bmp", 'stdout', "--psm", "0"]
182182
version = get_version()
183183
if version[0] >= 4:
184184
# XXX: temporary fix to remove once Tesseract 4 is stable

0 commit comments

Comments
 (0)