10

我是 tesseract OCR 的新手。我试图将图像转换为 tif 并运行它以查看 tesseract 在 windows 中使用 cmd 的输出,但我做不到。你能帮助我吗?将使用什么命令?

这是我的示例图片:

在此处输入图像描述

4

1 回答 1

18

最简单的 tesseract.exe 语法是tesseract.exe inputimage output-text-file. 这里的假设是将 tesseract.exe 添加到PATH环境变量中。-psm N如果您的文本参数特别难以识别,您可以添加该参数。

我看到常规语法(没有任何-psm开关)与您附加的图像配合得很好,除非准确度不够好。

请注意,非英文字符(例如处方旁边的符号)无法识别;我的默认安装只包含英语训练数据。

这是 tesseract 语法描述:

C:\Users\vish\Desktop>tesseract.exe
Usage:tesseract.exe imagename outputbase [-l lang] [-psm pagesegmode] [configfile...]

pagesegmode values are:
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.
-l lang and/or -psm pagesegmode must occur before anyconfigfile.

Single options:
  -v --version: version info
  --list-langs: list available languages for tesseract engine

这是您的图像的输出(注意:当我下载它时,它已转换为 PNG 图像):

C:\Users\vish\Desktop>tesseract.exe ECL8R.png out.txt
Tesseract Open Source OCR Engine v3.02 with Leptonica

C:\Users\vish\Desktop>type out.txt.txt
1 Project Background

A prescription (R) is a written order by a physician or medical doctor to a pharmacist in the form of
medication instructions for an individual patient. You can't get prescription medicines unless someone
with authority prescribes them. Usually, this means a written prescription from your doctor. Dentists,

optometrists, midwives and nurse practitioners may also be authorized to prescribe medicines for you.

It can also be defined as an order to take certain medications.

A prescription has legal implications; this means the prescriber must assume his responsibility for the
clinical care ofthe patient.

Recently, the term "prescriptionΓÇ¥ has known a wider usage being used for clinical assessments,
于 2014-10-17T05:31:28.893 回答