" OCR运行错误"使用MODI 2003 C#时 [英] "OCR running error" when using MODI 2003 with C#

查看:670
本文介绍了" OCR运行错误"使用MODI 2003 C#时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力让MODI今天正常在所有的工作。这里的code,我尝试使用(改编自维基百科条目给出 MODI

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;
}

当我执行,我得到的OCR()行话说以下错误:

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

现在,我抬头一看是错误code,发现在另一个计算器问题他们发现,他们不能对小图像运行OCR,但是一有问题是 1700 X 2338 ,这应该是足够足够大的原因。

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 1700x2338, which should be plenty large enough for the cause.

有没有人有哪里有这下走什么建议?

Does anyone have any advice on where to go next with this?

推荐答案

看来,MODI故障可能是累积性的;然而,通过不同的调查看起来好像它可连接到DPI。修改的PixelFormat ,清除的背景下,调整RAW图像尺寸,以及调整 OCROrientImage OCRStraightenImage 标记没有影响。

It appears that the MODI failures may be cumulative; however through varying investigation it looks as though it may be tied to the DPI. Modifying the PixelFormat, clearing the background, adjusting the raw image size, and adjusting the OCROrientImage and OCRStraightenImage flags had no effect.

什么工作对我来说是修改写入位图的DPI为水平和垂直为300的位图 96,并与没有工作我注意到DPI为300特定图像的工作。

What worked for me was modifying the DPI of the written Bitmap for both horizontal and vertical to 300. The default for a Bitmap is 96 and in working with a specific image that did work I noted the DPI was set at 300.

这篇关于&QUOT; OCR运行错误&QUOT;使用MODI 2003 C#时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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