可以通过配置Tesseract来使用Tesseract进行OCR,opencv和opencv的C#版本Emgu都集成了Tesseract这个工具。
但是在使用时经常会出现误判,比如把“s”识别成“5”,把“1”识别成“l”或“i”。可以设置相应的参数来识别指定范围的字符。
下面是Emgu中关于这个函数的API文档:
Emgu.CV.OCR.Tesseract.Tesseract(string, string, Emgu.CV.OCR.Tesseract.OcrEngineMode, string)
public Tesseract(string dataPath, string language, Emgu.CV.OCR.Tesseract.OcrEngineMode mode, string whiteList)
Member of Emgu.CV.OCR.Tesseract
Summary:
Create an tesseract OCR engine.
Parameters:
dataPath: The datapath must be the name of the parent directory of tessdata and must end in / . Any name after the last / will be stripped.
language: The language is (usually) an ISO 639-3 string or NULL will default to eng. It is entirely safe (and eventually will be efficient too) to call Init multiple times on the same instance to change language, or just to reset the classifier. The language may be a string of the form [~]%lt

通过配置Emgu.CV.OCR.Tesseract的Tesseract对象,可以设置白名单参数"tessedit_char_whitelist"来限制Tesseract仅识别特定字符,如数字或字母,从而提高识别准确率。例如,设置"tessedit_char_whitelist"为"0123456789"可只识别数字,将它改为"abcdefghijklmnopqrstuvwxyz"则仅识别字母。
最低0.47元/天 解锁文章
2594





