Change tesseract parameter -psm to --psm

For compatibility reasons the old variant is still supported.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2016-11-30 22:23:08 +01:00
parent d2f9264383
commit 92d981b93a
7 changed files with 16 additions and 11 deletions

View File

@ -63,7 +63,7 @@ You can either [Install Tesseract via pre-built binary package](https://github.c
Basic command line usage:
tesseract imagename outputbase [-l lang] [-psm pagesegmode] [configfiles...]
tesseract imagename outputbase [-l lang] [--psm pagesegmode] [configfiles...]
For more information about the various command line options use `tesseract --help` or `man tesseract`.

View File

@ -142,7 +142,7 @@ void PrintHelpMessage(const char* program) {
" -l LANG[+LANG] Specify language(s) used for OCR.\n"
" -c VAR=VALUE Set value for config variables.\n"
" Multiple -c arguments are allowed.\n"
" -psm NUM Specify page segmentation mode.\n"
" --psm NUM Specify page segmentation mode.\n"
" --oem NUM Specify OCR Engine mode.\n"
"NOTE: These options must occur before any configfile.\n";
@ -275,6 +275,11 @@ void ParseArgs(const int argc, char** argv, const char** lang,
noocr = true;
*list_langs = true;
} else if (strcmp(argv[i], "-psm") == 0 && i + 1 < argc) {
// The parameter -psm is deprecated and was replaced by --psm.
// It is still supported for compatibility reasons.
*pagesegmode = static_cast<tesseract::PageSegMode>(atoi(argv[i + 1]));
++i;
} else if (strcmp(argv[i], "--psm") == 0 && i + 1 < argc) {
*pagesegmode = static_cast<tesseract::PageSegMode>(atoi(argv[i + 1]));
++i;
} else if (strcmp(argv[i], "--oem") == 0 && i + 1 < argc) {

View File

@ -84,7 +84,7 @@ Set value for control parameter\&. Multiple \-c arguments are allowed\&.
The language to use\&. If none is specified, English is assumed\&. Multiple languages may be specified, separated by plus characters\&. Tesseract uses 3\-character ISO 639\-2 language codes\&. (See LANGUAGES)
.RE
.PP
\fI\-psm N\fR
\fI\--psm N\fR
.RS 4
Set Tesseract to only run a subset of layout analysis and assume a certain form of image\&. The options for
\fBN\fR
@ -139,7 +139,7 @@ pdf \- Output in pdf instead of a text file\&.
.RE
.RE
.sp
\fBNota Bene:\fR The options \fI\-l lang\fR and \fI\-psm N\fR must occur before any \fIconfigfile\fR\&.
\fBNota Bene:\fR The options \fI\-l lang\fR and \fI\--psm N\fR must occur before any \fIconfigfile\fR\&.
.SH "SINGLE OPTIONS"
.PP
\fI\-v\fR

View File

@ -54,7 +54,7 @@ OPTIONS
Multiple languages may be specified, separated by plus characters.
Tesseract uses 3-character ISO 639-2 language codes. (See LANGUAGES)
'-psm N'::
'--psm N'::
Set Tesseract to only run a subset of layout analysis and assume
a certain form of image. The options for *N* are:
@ -78,7 +78,7 @@ OPTIONS
* hocr - Output in hOCR format instead of as a text file.
* pdf - Output in pdf instead of a text file.
*Nota Bene:* The options '-l lang' and '-psm N' must occur
*Nota Bene:* The options '-l lang' and '--psm N' must occur
before any 'configfile'.

View File

@ -847,7 +847,7 @@ at Google since then.</p></div>
</p>
</dd>
<dt class="hdlist1">
<em>-psm N</em>
<em>--psm N</em>
</dt>
<dd>
<p>
@ -893,7 +893,7 @@ pdf - Output in pdf instead of a text file.
</ul></div>
</dd>
</dl></div>
<div class="paragraph"><p><strong>Nota Bene:</strong> The options <em>-l lang</em> and <em>-psm N</em> must occur
<div class="paragraph"><p><strong>Nota Bene:</strong> The options <em>-l lang</em> and <em>--psm N</em> must occur
before any <em>configfile</em>.</p></div>
</div>
</div>

View File

@ -130,7 +130,7 @@ at Google since then.</simpara>
</varlistentry>
<varlistentry>
<term>
<emphasis>-psm N</emphasis>
<emphasis>--psm N</emphasis>
</term>
<listitem>
<simpara>
@ -176,7 +176,7 @@ pdf - Output in pdf instead of a text file.
</listitem>
</varlistentry>
</variablelist>
<simpara><emphasis role="strong">Nota Bene:</emphasis> The options <emphasis>-l lang</emphasis> and <emphasis>-psm N</emphasis> must occur
<simpara><emphasis role="strong">Nota Bene:</emphasis> The options <emphasis>-l lang</emphasis> and <emphasis>--psm N</emphasis> must occur
before any <emphasis>configfile</emphasis>.</simpara>
</refsect1>
<refsect1 id="_single_options">

View File

@ -64,7 +64,7 @@ do
srcdir="$imdir"
fi
# echo "$srcdir/$page.tif"
$tess $srcdir/$page.tif $resdir/$page -psm 6 $config 2>&1 |grep -v "OCR Engine"
$tess $srcdir/$page.tif $resdir/$page --psm 6 $config 2>&1 |grep -v "OCR Engine"
if [ -r times.txt ]
then
read t <times.txt