我一直在努力让MODI在今天正常工作.这是我试图使用的代码(改编自维基百科MODI条目中给出的VB .
private void button1_Click( object sender, EventArgs e )
{
string inputFile = @"C:\testImage.bmp";
textBox1.Text = GetTextFromImage( inputFile );
}
private string GetTextFromImage( string fileName )
{
string output = "";
var doc1 = new MODI.Document();
doc1.Create( fileName );
doc1.OCR( MiLANGUAGES.miLANG_ENGLISH, false, false );
for ( int i = 0; i < doc1.Images.Count; i++ )
{
output += doc1.Images[i].Layout.Text;
}
doc1.Close();
return output;
}
Run Code Online (Sandbox Code Playgroud)
当我执行此操作时,我在OCR()行上出现错误,说明以下内容:
System.Runtime.InteropServices.COMException was unhandledMessage=OCR running error Source="" ErrorCode=-959967087
Run Code Online (Sandbox Code Playgroud)
现在,我查找了该错误代码,发现了另一个stackoverflow 问题,他们发现他们无法在小图像上运行OCR,但问题是1700x …