[Top] | [Contents] | [Index] | [ ? ] |
1. Character Sets | Input charsets and output formats | |
2. Invoking Ocrad | Command line interface | |
3. Image Format Conversion | How to convert other formats to pnm | |
4. Algorithm | How ocrad does its job | |
5. Reporting Bugs | Reporting bugs | |
Concept Index | Index of concepts |
Copyright © 2003, 2004, 2005, 2006 Antonio Diaz Diaz.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The character set internally used by ocrad is ISO 10646, also known as UCS (Universal Character Set), which can represent over two thousand million characters (2^31).
As it is unpractical to try to recognize one among so many different characters, you can tell ocrad what character sets to recognize. You do this with the `--charset' option.
If the input page contains characters from only one character set, say
`ISO-8859-15', you can use the default `byte' output
format. But in a page with `ISO-8859-9' and
`ISO-8859-15' characters, you can't tell if a code of 0xFD
represents a 'latin small letter i dotless' or a 'latin small letter y
with acute'. You should use `--format=utf8' instead.
Of course, you may request UTF-8 output in any case.
NOTE: Don't believe everything Usamericans tell you. A billion is a million millions (million^2), a trillion is a million million millions (million^3), and so on. Please, respect the meaning of prefixes to make communication among all people possible. Thanks.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The format for running ocrad is:
ocrad [options] [files] |
Ocrad supports the following options:
Print an informative help message describing the options and exit.
Print the version number of ocrad on the standard output and exit.
Append generated text to the output file instead of overwriting it.
Process only the specified text block, beginning from 1. Is only useful when used in conjunction with layout analysis (see below).
Enable recognition of the characters belonging to the given character set.
You can repeat this option multiple times with different names for
processing a page with characters from different character sets.
If no charset is specified, `iso-8859-15' (latin9) is assumed.
Try `--charset=help' for a list of valid charset names.
Crop the input image by the rectangle defined by left, top,
right and bottom. The values of left, top,
right and bottom may be relative to the image size
(0.0 <= value <= 1.0), or absolute (value > 1).
The cropping is performed before any other transformation (rotation or
mirroring) on the input image, and before scaling, layout analysis and
recognition.
Force overwrite of output file.
Select the output format. The valid names are `byte' and `utf8'.
If no output format is specified, `byte' (8 bit) is assumed.
Invert image levels (white on black).
Enable page layout analysis. The meaning of mode is:
`0' no analysis at all, `1' column separation, `2' full analysis.
Place the output into file instead of into the standard output.
Scale the input image by value before layout analysis and recognition. If value is negative, the input image is scaled down by -value.
Perform given transformation (rotation or mirroring) on the input image
before scaling, layout analysis and recognition.
Try `--transform=help' for a list of valid transformation names.
Set binarization threshold for pgm or ppm files or for `--scale' option (only for scaled down images). value should be a rational number between 0 an 1, and may be given as a percentage (50%), a fraction (1/2), or a decimal value (0.5). Image values greater than threshold are converted to white. The default value is 0.5.
Verbose mode.
Write (export) OCR Results File to file. `-x -' writes to stdout, overriding text output except if output has been also redirected with the -o option.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are a lot of image formats, but ocrad is able to decode only three of them; pbm, pgm and ppm. In this chapter you will find command examples and advice about how to convert image files to a format that ocrad can manage.
Portable Network Graphics file. Use the command
pngtopnm filename.png | ocrad
.
In some cases, like the ocrad.png icon, you have to invert the image
with the `-i' option: pngtopnm filename.png | ocrad -i
.
Postscript or Portable Document Format file. Use the command
gs -sPAPERSIZE=a4 -sDEVICE=pnmraw -r300 -dNOPAUSE -dBATCH -sOutputFile=- -q filename.ps | ocrad
.
You may also use the command
pstopnm -stdout -dpi=300 -pgm filename.ps | ocrad
,
but it seems not to work with pdf files. Also old versions of
pstopnm
don't recognize the `-dpi' option and produce an
image too small for OCR.
TIFF file. Use the command
tifftopnm filename.tiff | ocrad
.
JPEG file. Use the command
djpeg -greyscale -pnm filename.jpg | ocrad
.
JPEG is a lossy format and is in general not recommended for text images.
Pnm file compressed with bzip2. Use the command
bunzip2 -c filename.pnm.bz2 | ocrad
Pnm file compressed with gzip. Use the command
gunzip -c filename.pnm.gz | ocrad
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Ocrad is mainly a research project. Many of the algorithms ocrad uses are ad hoc, and will change in successive releases as I myself gain understanding about OCR issues.
The overall working of ocrad may be described as follows:
1) read the image.
2) optionally, perform some transformations (crop, rotate, scale, etc).
3) optionally, perform layout detection.
4) remove frames and images.
5) detect characters and group them in lines.
6) recognize characters (very ad hoc; one algorithm per character).
7) correct some errors (transform l.OOO into 1.000, etc).
8) output result.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If you find a bug in GNU Ocrad, please send electronic mail to bug-ocrad@gnu.org. Include the version number, which you can find by running `ocrad --version'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jump to: | A B G I O P U V |
---|
Jump to: | A B G I O P U V |
---|
[Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March, 20 2006 using texi2html 1.76.
The buttons in the navigation panels have the following meaning:
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ < ] | Back | previous section in reading order | 1.2.2 |
[ > ] | Forward | next section in reading order | 1.2.4 |
[ << ] | FastBack | beginning of this chapter or previous chapter | 1 |
[ Up ] | Up | up section | 1.2 |
[ >> ] | FastForward | next chapter | 2 |
[Top] | Top | cover (top) of document | |
[Contents] | Contents | table of contents | |
[Index] | Index | index | |
[ ? ] | About | about (help) |
where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:
This document was generated on March, 20 2006 using texi2html 1.76.