mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-23 06:57:50 +08:00
248 lines
11 KiB
Groff
248 lines
11 KiB
Groff
'\" t
|
|
.\" Title: tesseract
|
|
.\" Author: [see the "AUTHOR" section]
|
|
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
|
.\" Date: 06/28/2015
|
|
.\" Manual: \ \&
|
|
.\" Source: \ \&
|
|
.\" Language: English
|
|
.\"
|
|
.TH "TESSERACT" "1" "06/28/2015" "\ \&" "\ \&"
|
|
.\" -----------------------------------------------------------------
|
|
.\" * Define some portability stuff
|
|
.\" -----------------------------------------------------------------
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.\" http://bugs.debian.org/507673
|
|
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.ie \n(.g .ds Aq \(aq
|
|
.el .ds Aq '
|
|
.\" -----------------------------------------------------------------
|
|
.\" * set default formatting
|
|
.\" -----------------------------------------------------------------
|
|
.\" disable hyphenation
|
|
.nh
|
|
.\" disable justification (adjust text to left margin only)
|
|
.ad l
|
|
.\" -----------------------------------------------------------------
|
|
.\" * MAIN CONTENT STARTS HERE *
|
|
.\" -----------------------------------------------------------------
|
|
.SH "NAME"
|
|
tesseract \- command\-line OCR engine
|
|
.SH "SYNOPSIS"
|
|
.sp
|
|
\fBtesseract\fR \fIimagename\fR|\fIstdin\fR \fIoutputbase\fR|\fIstdout\fR [options\&...] [configfile\&...]
|
|
.SH "DESCRIPTION"
|
|
.sp
|
|
tesseract(1) is a commercial quality OCR engine originally developed at HP between 1985 and 1995\&. In 1995, this engine was among the top 3 evaluated by UNLV\&. It was open\-sourced by HP and UNLV in 2005, and has been developed at Google since then\&.
|
|
.SH "IN/OUT ARGUMENTS"
|
|
.PP
|
|
\fIimagename\fR
|
|
.RS 4
|
|
The name of the input image\&. Most image file formats (anything readable by Leptonica) are supported\&.
|
|
.RE
|
|
.PP
|
|
\fIstdin\fR
|
|
.RS 4
|
|
Instruction to read data from standard input
|
|
.RE
|
|
.PP
|
|
\fIoutputbase\fR
|
|
.RS 4
|
|
The basename of the output file (to which the appropriate extension will be appended)\&. By default the output will be named
|
|
\fIoutbase\&.txt\fR\&.
|
|
.RE
|
|
.PP
|
|
\fIstdout\fR
|
|
.RS 4
|
|
Instruction to sent output data to standard output
|
|
.RE
|
|
.SH "OPTIONS"
|
|
.PP
|
|
\fI\-\-tessdata\-dir /path\fR
|
|
.RS 4
|
|
Specify the location of tessdata path
|
|
.RE
|
|
.PP
|
|
\fI\-\-user\-words /path/to/file\fR
|
|
.RS 4
|
|
Specify the location of user words file
|
|
.RE
|
|
.PP
|
|
\fI\-\-user\-patterns /path/to/file specify\fR
|
|
.RS 4
|
|
The location of user patterns file
|
|
.RE
|
|
.PP
|
|
\fI\-c configvar=value\fR
|
|
.RS 4
|
|
Set value for control parameter\&. Multiple \-c arguments are allowed\&.
|
|
.RE
|
|
.PP
|
|
\fI\-l lang\fR
|
|
.RS 4
|
|
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
|
|
.RS 4
|
|
Set Tesseract to only run a subset of layout analysis and assume a certain form of image\&. The options for
|
|
\fBN\fR
|
|
are:
|
|
.sp
|
|
.if n \{\
|
|
.RS 4
|
|
.\}
|
|
.nf
|
|
0 = Orientation and script detection (OSD) only\&.
|
|
1 = Automatic page segmentation with OSD\&.
|
|
2 = Automatic page segmentation, but no OSD, or OCR\&.
|
|
3 = Fully automatic page segmentation, but no OSD\&. (Default)
|
|
4 = Assume a single column of text of variable sizes\&.
|
|
5 = Assume a single uniform block of vertically aligned text\&.
|
|
6 = Assume a single uniform block of text\&.
|
|
7 = Treat the image as a single text line\&.
|
|
8 = Treat the image as a single word\&.
|
|
9 = Treat the image as a single word in a circle\&.
|
|
10 = Treat the image as a single character\&.
|
|
.fi
|
|
.if n \{\
|
|
.RE
|
|
.\}
|
|
.RE
|
|
.PP
|
|
\fIconfigfile\fR
|
|
.RS 4
|
|
The name of a config to use\&. A config is a plaintext file which contains a list of variables and their values, one per line, with a space separating variable from value\&. Interesting config files include:
|
|
|
|
.sp
|
|
.RS 4
|
|
.ie n \{\
|
|
\h'-04'\(bu\h'+03'\c
|
|
.\}
|
|
.el \{\
|
|
.sp -1
|
|
.IP \(bu 2.3
|
|
.\}
|
|
hocr \- Output in hOCR format instead of as a text file\&.
|
|
.RE
|
|
.sp
|
|
.RS 4
|
|
.ie n \{\
|
|
\h'-04'\(bu\h'+03'\c
|
|
.\}
|
|
.el \{\
|
|
.sp -1
|
|
.IP \(bu 2.3
|
|
.\}
|
|
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\&.
|
|
.SH "SINGLE OPTIONS"
|
|
.PP
|
|
\fI\-v\fR
|
|
.RS 4
|
|
Returns the current version of the tesseract(1) executable\&.
|
|
.RE
|
|
.PP
|
|
\fI\-\-list\-langs\fR
|
|
.RS 4
|
|
list available languages for tesseract engine\&. Can be used with \-\-tessdata\-dir\&.
|
|
.RE
|
|
.PP
|
|
\fI\-\-print\-parameters\fR
|
|
.RS 4
|
|
print tesseract parameters to the stdout\&.
|
|
.RE
|
|
.SH "LANGUAGES"
|
|
.sp
|
|
There are currently language packs available for the following languages (in \m[blue]\fBhttps://github\&.com/tesseract\-ocr/tessdata\fR\m[]):
|
|
.sp
|
|
\fBafr\fR (Afrikaans) \fBamh\fR (Amharic) \fBara\fR (Arabic) \fBasm\fR (Assamese) \fBaze\fR (Azerbaijani) \fBaze_cyrl\fR (Azerbaijani \- Cyrilic) \fBbel\fR (Belarusian) \fBben\fR (Bengali) \fBbod\fR (Tibetan) \fBbos\fR (Bosnian) \fBbul\fR (Bulgarian) \fBcat\fR (Catalan; Valencian) \fBceb\fR (Cebuano) \fBces\fR (Czech) \fBchi_sim\fR (Chinese \- Simplified) \fBchi_tra\fR (Chinese \- Traditional) \fBchr\fR (Cherokee) \fBcym\fR (Welsh) \fBdan\fR (Danish) \fBdan_frak\fR (Danish \- Fraktur) \fBdeu\fR (German) \fBdeu_frak\fR (German \- Fraktur) \fBdzo\fR (Dzongkha) \fBell\fR (Greek, Modern (1453\-)) \fBeng\fR (English) \fBenm\fR (English, Middle (1100\-1500)) \fBepo\fR (Esperanto) \fBequ\fR (Math / equation detection module) \fBest\fR (Estonian) \fBeus\fR (Basque) \fBfas\fR (Persian) \fBfin\fR (Finnish) \fBfra\fR (French) \fBfrk\fR (Frankish) \fBfrm\fR (French, Middle (ca\&.1400\-1600)) \fBgle\fR (Irish) \fBglg\fR (Galician) \fBgrc\fR (Greek, Ancient (to 1453)) \fBguj\fR (Gujarati) \fBhat\fR (Haitian; Haitian Creole) \fBheb\fR (Hebrew) \fBhin\fR (Hindi) \fBhrv\fR (Croatian) \fBhun\fR (Hungarian) \fBiku\fR (Inuktitut) \fBind\fR (Indonesian) \fBisl\fR (Icelandic) \fBita\fR (Italian) \fBita_old\fR (Italian \- Old) \fBjav\fR (Javanese) \fBjpn\fR (Japanese) \fBkan\fR (Kannada) \fBkat\fR (Georgian) \fBkat_old\fR (Georgian \- Old) \fBkaz\fR (Kazakh) \fBkhm\fR (Central Khmer) \fBkir\fR (Kirghiz; Kyrgyz) \fBkor\fR (Korean) \fBkur\fR (Kurdish) \fBlao\fR (Lao) \fBlat\fR (Latin) \fBlav\fR (Latvian) \fBlit\fR (Lithuanian) \fBmal\fR (Malayalam) \fBmar\fR (Marathi) \fBmkd\fR (Macedonian) \fBmlt\fR (Maltese) \fBmsa\fR (Malay) \fBmya\fR (Burmese) \fBnep\fR (Nepali) \fBnld\fR (Dutch; Flemish) \fBnor\fR (Norwegian) \fBori\fR (Oriya) \fBosd\fR (Orientation and script detection module) \fBpan\fR (Panjabi; Punjabi) \fBpol\fR (Polish) \fBpor\fR (Portuguese) \fBpus\fR (Pushto; Pashto) \fBron\fR (Romanian; Moldavian; Moldovan) \fBrus\fR (Russian) \fBsan\fR (Sanskrit) \fBsin\fR (Sinhala; Sinhalese) \fBslk\fR (Slovak) \fBslk_frak\fR (Slovak \- Fraktur) \fBslv\fR (Slovenian) \fBspa\fR (Spanish; Castilian) \fBspa_old\fR (Spanish; Castilian \- Old) \fBsqi\fR (Albanian) \fBsrp\fR (Serbian) \fBsrp_latn\fR (Serbian \- Latin) \fBswa\fR (Swahili) \fBswe\fR (Swedish) \fBsyr\fR (Syriac) \fBtam\fR (Tamil) \fBtel\fR (Telugu) \fBtgk\fR (Tajik) \fBtgl\fR (Tagalog) \fBtha\fR (Thai) \fBtir\fR (Tigrinya) \fBtur\fR (Turkish) \fBuig\fR (Uighur; Uyghur) \fBukr\fR (Ukrainian) \fBurd\fR (Urdu) \fBuzb\fR (Uzbek) \fBuzb_cyrl\fR (Uzbek \- Cyrilic) \fBvie\fR (Vietnamese) \fByid\fR (Yiddish)
|
|
.sp
|
|
To use a non\-standard language pack named \fBfoo\&.traineddata\fR, set the \fBTESSDATA_PREFIX\fR environment variable so the file can be found at \fBTESSDATA_PREFIX\fR/tessdata/\fBfoo\fR\&.traineddata and give Tesseract the argument \fI\-l foo\fR\&.
|
|
.SH "CONFIG FILES AND AUGMENTING WITH USER DATA"
|
|
.sp
|
|
Tesseract config files consist of lines with variable\-value pairs (space separated)\&. The variables are documented as flags in the source code like the following one in tesseractclass\&.h:
|
|
.sp
|
|
STRING_VAR_H(tessedit_char_blacklist, "", "Blacklist of chars not to recognize");
|
|
.sp
|
|
These variables may enable or disable various features of the engine, and may cause it to load (or not load) various data\&. For instance, let\(cqs suppose you want to OCR in English, but suppress the normal dictionary and load an alternative word list and an alternative list of patterns \(em these two files are the most commonly used extra data files\&.
|
|
.sp
|
|
If your language pack is in /path/to/eng\&.traineddata and the hocr config is in /path/to/configs/hocr then create three new files:
|
|
.sp
|
|
/path/to/eng\&.user\-words:
|
|
.sp
|
|
.if n \{\
|
|
.RS 4
|
|
.\}
|
|
.nf
|
|
the
|
|
quick
|
|
brown
|
|
fox
|
|
jumped
|
|
.fi
|
|
.if n \{\
|
|
.RE
|
|
.\}
|
|
.sp
|
|
/path/to/eng\&.user\-patterns:
|
|
.sp
|
|
.if n \{\
|
|
.RS 4
|
|
.\}
|
|
.nf
|
|
1\-\ed\ed\ed\-GOOG\-411
|
|
www\&.\en\e\e\e*\&.com
|
|
.fi
|
|
.if n \{\
|
|
.RE
|
|
.\}
|
|
.sp
|
|
/path/to/configs/bazaar:
|
|
.sp
|
|
.if n \{\
|
|
.RS 4
|
|
.\}
|
|
.nf
|
|
load_system_dawg F
|
|
load_freq_dawg F
|
|
user_words_suffix user\-words
|
|
user_patterns_suffix user\-patterns
|
|
.fi
|
|
.if n \{\
|
|
.RE
|
|
.\}
|
|
.sp
|
|
Now, if you pass the word \fIbazaar\fR as a trailing command line parameter to Tesseract, Tesseract will not bother loading the system dictionary nor the dictionary of frequent words and will load and use the eng\&.user\-words and eng\&.user\-patterns files you provided\&. The former is a simple word list, one per line\&. The format of the latter is documented in dict/trie\&.h on read_pattern_list()\&.
|
|
.SH "HISTORY"
|
|
.sp
|
|
The engine was developed at Hewlett Packard Laboratories Bristol and at Hewlett Packard Co, Greeley Colorado between 1985 and 1994, with some more changes made in 1996 to port to Windows, and some C++izing in 1998\&. A lot of the code was written in C, and then some more was written in C++\&. The C\e++ code makes heavy use of a list system using macros\&. This predates stl, was portable before stl, and is more efficient than stl lists, but has the big negative that if you do get a segmentation violation, it is hard to debug\&.
|
|
.sp
|
|
Version 2\&.00 brought Unicode (UTF\-8) support, six languages, and the ability to train Tesseract\&.
|
|
.sp
|
|
Tesseract was included in UNLV\(cqs Fourth Annual Test of OCR Accuracy\&. See \m[blue]\fBhttps://github\&.com/tesseract\-ocr/docs/blob/master/AT\-1995\&.pdf\fR\m[]\&. With Tesseract 2\&.00, scripts are now included to allow anyone to reproduce some of these tests\&. See \m[blue]\fBhttps://github\&.com/tesseract\-ocr/tesseract/wiki/TestingTesseract\fR\m[] for more details\&.
|
|
.sp
|
|
Tesseract 3\&.00 adds a number of new languages, including Chinese, Japanese, and Korean\&. It also introduces a new, single\-file based system of managing language data\&.
|
|
.sp
|
|
Tesseract 3\&.02 adds BiDirectional text support, the ability to recognize multiple languages in a single image, and improved layout analysis\&.
|
|
.sp
|
|
For further details, see the file ReleaseNotes included with the distribution\&.
|
|
.SH "RESOURCES"
|
|
.sp
|
|
Main web site: \m[blue]\fBhttps://github\&.com/tesseract\-ocr\fR\m[] Information on training: \m[blue]\fBhttps://github\&.com/tesseract\-ocr/tesseract/wiki/TrainingTesseract\fR\m[]
|
|
.SH "SEE ALSO"
|
|
.sp
|
|
ambiguous_words(1), cntraining(1), combine_tessdata(1), dawg2wordlist(1), shape_training(1), mftraining(1), unicharambigs(5), unicharset(5), unicharset_extractor(1), wordlist2dawg(1)
|
|
.SH "AUTHOR"
|
|
.sp
|
|
Tesseract development was led at Hewlett\-Packard and Google by Ray Smith\&. The development team has included:
|
|
.sp
|
|
Ahmad Abdulkader, Chris Newton, Dan Johnson, Dar\-Shyang Lee, David Eger, Eric Wiseblatt, Faisal Shafait, Hiroshi Takenaka, Joe Liu, Joern Wanke, Mark Seaman, Mickey Namiki, Nicholas Beato, Oded Fuhrmann, Phil Cheatle, Pingping Xiu, Pong Eksombatchai (Chantat), Ranjith Unnikrishnan, Raquel Romano, Ray Smith, Rika Antonova, Robert Moss, Samuel Charron, Sheelagh Lloyd, Shobhit Saxena, and Thomas Kielbus\&.
|
|
.SH "COPYING"
|
|
.sp
|
|
Licensed under the Apache License, Version 2\&.0
|