如何在c#中使用Tesseract OCR来识别图像中的字符? [英] How to make use of Tesseract OCR in c# for recognizing characters from the image?

查看:1080
本文介绍了如何在c#中使用Tesseract OCR来识别图像中的字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用C#实现OCR软件;我是这个领域的新手;

任何人都可以告诉我如何在C#中使用Tesseract OCR Engine吗?

解决方案

< a href =https://gist.github.com/yatt/915443> https://gist.github.com/yatt/915443 [ ^ ]


这篇文章介绍了一种用C#编写OCR程序的简便方法。 />
http://www.codepool.biz/ocr-barcode-twain/twain-sdk/have-fun-with-the-wpf-demo-of-net-twain-5-0.html [ ^ ]



 dynamicDotNetTwainThum.IfShowCancelDialogWhenBarcodeOrOCR = < span class =code-keyword> true ; 
dynamicDotNetTwainThum.OCRResultFormat = Dynamsoft.DotNet.TWAIN.OCR.ResultFormat.Text;
dynamicDotNetTwainThum.OCRLanguage = eng;
byte [] bytes = dynamicDotNetTwainThum.OCR(dynamicDotNetTwainThum.CurrentSelectedImageIndicesInBuffer); // 识别缓冲图像
如果(bytes!= null
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.Filter = 文本文件(* .txt)| * .txt;
if (dlg.ShowDialog()。Value)
{
System.IO.File.WriteAllBytes(dlg.FileName,bytes) ); // 将已识别的文字写入文本文件
}
}


I am trying to implement the OCR Software using the C#; I'm new in this field;
Can any body tell me how to make use of Tesseract OCR Engine in C#?

解决方案

https://gist.github.com/yatt/915443[^]


This post introduces an easy way to write OCR program in C#.
http://www.codepool.biz/ocr-barcode-twain/twain-sdk/have-fun-with-the-wpf-demo-of-net-twain-5-0.html[^]

dynamicDotNetTwainThum.IfShowCancelDialogWhenBarcodeOrOCR = true;
dynamicDotNetTwainThum.OCRResultFormat = Dynamsoft.DotNet.TWAIN.OCR.ResultFormat.Text;
dynamicDotNetTwainThum.OCRLanguage = "eng";
byte[] bytes = dynamicDotNetTwainThum.OCR(dynamicDotNetTwainThum.CurrentSelectedImageIndicesInBuffer); // recognize the buffered image
if (bytes != null)
{
   SaveFileDialog dlg = new SaveFileDialog();
   dlg.Filter = "Text File(*.txt)|*.txt";
   if (dlg.ShowDialog().Value)
   {
      System.IO.File.WriteAllBytes(dlg.FileName, bytes); // write recognized text to text file
   }
}


这篇关于如何在c#中使用Tesseract OCR来识别图像中的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆