I've been struggling to get MODI to work properly at all today. Here's the code I'm attempting to use (adapted from the VB given at the Wikipedia entry for MODI.
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;
}
When I execute this, I get an error on the OCR() line saying the following:
System.Runtime.InteropServices.COMException was unhandledMessage=OCR running error Source="" ErrorCode=-959967087
Now, I looked up that error code and found another stackoverflow question in which they found that they couldn't run the OCR on small images, but the one in question is 1700
x2338
, which should be plenty large enough for the cause.
Does anyone have any advice on where to go next with this?