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

Commit

Permalink
Use '--psm' instead of '-psm' as the option was deprecated.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ddddavidmartin committed Jun 7, 2018
1 parent 31fb5f1 commit c136838
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/pyocr/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class TextBuilder(BaseBuilder):
def __init__(self, tesseract_layout=3, cuneiform_dotmatrix=False,
cuneiform_fax=False, cuneiform_singlecolumn=False):
file_ext = ["txt"]
tess_flags = ["-psm", str(tesseract_layout)]
tess_flags = ["--psm", str(tesseract_layout)]
cun_args = ["-f", "text"]
# Add custom cuneiform parameters if needed
for par, arg in [(cuneiform_dotmatrix, "--dotmatrix"),
Expand Down Expand Up @@ -562,7 +562,7 @@ class WordBoxBuilder(BaseBuilder):

def __init__(self, tesseract_layout=1):
file_ext = ["html", "hocr"]
tess_flags = ["-psm", str(tesseract_layout)]
tess_flags = ["--psm", str(tesseract_layout)]
tess_conf = ["hocr"]
cun_args = ["-f", "hocr"]
super(WordBoxBuilder, self).__init__(file_ext, tess_flags, tess_conf,
Expand Down Expand Up @@ -638,7 +638,7 @@ class LineBoxBuilder(BaseBuilder):

def __init__(self, tesseract_layout=1):
file_ext = ["html", "hocr"]
tess_flags = ["-psm", str(tesseract_layout)]
tess_flags = ["--psm", str(tesseract_layout)]
tess_conf = ["hocr"]
cun_args = ["-f", "hocr"]
super(LineBoxBuilder, self).__init__(file_ext, tess_flags, tess_conf,
Expand Down
2 changes: 1 addition & 1 deletion src/pyocr/tesseract.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def detect_orientation(image, lang=None):
"""
_set_environment()
with temp_dir() as tmpdir:
command = [TESSERACT_CMD, "input.bmp", 'stdout', "-psm", "0"]
command = [TESSERACT_CMD, "input.bmp", 'stdout', "--psm", "0"]
version = get_version()
if version[0] >= 4:
# XXX: temporary fix to remove once Tesseract 4 is stable
Expand Down

0 comments on commit c136838

Please sign in to comment.