mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-04 18:29:06 +08:00
19ddc89c44
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1131 d0cd1f9f-072b-0410-8dd7-cf729c803f20
248 lines
9.8 KiB
Groff
248 lines
9.8 KiB
Groff
'\" t
|
|
.\" Title: tesseract
|
|
.\" Author: [see the "AUTHOR" section]
|
|
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
|
.\" Date: 08/02/2014
|
|
.\" Manual: \ \&
|
|
.\" Source: \ \&
|
|
.\" Language: English
|
|
.\"
|
|
.TH "TESSERACT" "1" "08/02/2014" "\ \&" "\ \&"
|
|
.\" -----------------------------------------------------------------
|
|
.\" * 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:
|
|
.sp
|
|
\fBara\fR (Arabic), \fBaze\fR (Azerbauijani), \fBbul\fR (Bulgarian), \fBcat\fR (Catalan), \fBces\fR (Czech), \fBchi_sim\fR (Simplified Chinese), \fBchi_tra\fR (Traditional Chinese), \fBchr\fR (Cherokee), \fBdan\fR (Danish), \fBdan\-frak\fR (Danish (Fraktur)), \fBdeu\fR (German), \fBell\fR (Greek), \fBeng\fR (English), \fBenm\fR (Old English), \fBepo\fR (Esperanto), \fBest\fR (Estonian), \fBfin\fR (Finnish), \fBfra\fR (French), \fBfrm\fR (Old French), \fBglg\fR (Galician), \fBheb\fR (Hebrew), \fBhin\fR (Hindi), \fBhrv\fR (Croation), \fBhun\fR (Hungarian), \fBind\fR (Indonesian), \fBita\fR (Italian), \fBjpn\fR (Japanese), \fBkor\fR (Korean), \fBlav\fR (Latvian), \fBlit\fR (Lithuanian), \fBnld\fR (Dutch), \fBnor\fR (Norwegian), \fBpol\fR (Polish), \fBpor\fR (Portuguese), \fBron\fR (Romanian), \fBrus\fR (Russian), \fBslk\fR (Slovakian), \fBslv\fR (Slovenian), \fBsqi\fR (Albanian), \fBspa\fR (Spanish), \fBsrp\fR (Serbian), \fBswe\fR (Swedish), \fBtam\fR (Tamil), \fBtel\fR (Telugu), \fBtgl\fR (Tagalog), \fBtha\fR (Thai), \fBtur\fR (Turkish), \fBukr\fR (Ukrainian), \fBvie\fR (Vietnamese)
|
|
.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]\fBhttp://www\&.isri\&.unlv\&.edu/downloads/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]\fBhttp://code\&.google\&.com/p/tesseract\-ocr/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]\fBhttp://code\&.google\&.com/p/tesseract\-ocr/\fR\m[] Information on training: \m[blue]\fBhttp://code\&.google\&.com/p/tesseract\-ocr/wiki/TrainingTesseract3\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
|