个人工具

“UbuntuHelp:OCR”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/OCR}}
 
{{From|https://help.ubuntu.com/community/OCR}}
 
{{Languages|UbuntuHelp:OCR}}
 
{{Languages|UbuntuHelp:OCR}}
#title OCR
 
Parent: [[UbuntuHelp:Software|Software]]
 
 
== OCR - Optical Character Recognition ==
 
== OCR - Optical Character Recognition ==
 
OCR is a technology that allows you to convert scanned images of text into plain text. This enables you to save space, edit the text and search/index it.
 
OCR is a technology that allows you to convert scanned images of text into plain text. This enables you to save space, edit the text and search/index it.

2009年11月17日 (二) 20:15的版本

OCR - Optical Character Recognition

OCR is a technology that allows you to convert scanned images of text into plain text. This enables you to save space, edit the text and search/index it.

Available OCR tools

The Ubuntu Universe repositories contain the following OCR tools:

Tesseract

Introduction

Arguably the one producing the best (most accurate) results is Tesseract. It is a technology initially developed by HP Labs between 1985 and 1995, then they open-sourced it in 2005. Tesseract can recognize text in 7 different languages: English, German, French, Italian, Spanish, Brazilian Portuguese and Dutch. You can install more than one dictionaries if you need. It does not support layout analysis, so multi-column text, images, equations etc. should give you a garbled text output. Also, it only supports TIFF images as input.

Usage

Tesseract is currently a command-line-only tool (although they're working on an integration with OCROpus for a GUI). After successful installation, the command to use is tesseract <path to tiff image> <output file>. Tesseract will automatically give the output file a .txt extension. It is critical that the tiff image have a ".tif" extension and not a ".tiff" extension. The command line should look like this example: $ tesseract /home/johnsmith/input.tif output Where johnsmith is your home user account name, input.tif is the document to be converted and output is the document that Tesseract will create as output.txt. The .txt file extansion will be added by Tesseract automatically.

Preparing images for Tesseract

Tesseract is not very flexible about the format of its input images. It will only accept TIFF images. According to user reports, compressed TIFF images are quite problematic, and the same goes for grey-scale and colour images. So you're better of with single-bit uncompressed TIFF images. The process to prepare them with GIMP is very simple:

  1. Go to the Image→Mode menu and make sure the image is in RGB or Grayscale mode.
  2. Select from the menu Tools→Color Tools→Threshold and choose an adequate threshold value.
  3. Select from the menu Image→Mode→Indexed and from the options choose 1-bit and no dithering.
  4. Save the image in TIFF format.

Further Reading