1

我正在开发一个使用 Abbyy OCR 的 iphone 应用程序。

使用 iphone 的包装类有一个方法:

[ocrManager recognizeImage:[choosenImage image] withCallback:self];

UIImage 作为用于识别字符的参数传递。但是每次我收到异常“缺少所需的数据文件”。

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{

    [picker dismissModalViewControllerAnimated:YES];
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
    if(check == 1)
    {
        return;
    }
    check = 1;
    UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    [choosenImage setImage:image];
    [process setHidden:NO];
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"license" ofType:@""];
    NSData *license = [[NSData alloc] initWithContentsOfFile:filePath];
    CMocrManager *ocrManager = [CMocrManager createManager:license];

    NSSet *languages = [[NSSet alloc] initWithArray:[NSArray arrayWithObject:@"English"]];
    [ocrManager setLanguages:languages];
    [ocrManager setDefaultImageResolution:0];
    @try {
        [ocrManager recognizeImage:[choosenImage image] withCallback:self];
    }
    @catch (NSException *exception) {
        NSString *ex = exception.reason;
    }

    CMocrLayout* recognitionResult = [ocrManager copyRecognitionResults];
    NSArray* strings = [recognitionResult copyStrings];

}

可以看到图像,UIImageView但是当我将它传递给recognizeImage方法时,它会引发异常。

我一直在研究很多,但无法找到解决方案。任何帮助表示赞赏。

4

1 回答 1

2

我的名字是 Nikolay Khlebinsky,我在 ABBYY 工作。

缺少资源文件(关键字、模式或字典)时,会显示“缺少必需的数据文件”错误消息。请参阅《如何在 iPhone 上使用 ABBYY 移动 OCR 引擎库》帮助文章以获取项目组织指南。您还可以在引擎分发中查找 iPhone 项目示例。

If you would still experience any difficulties, please visit our technical support contacts page at http://www.abbyy.com/support/contacts/ Choose your country and your product, hit 'Search' and you'll get contacts of the proper ABBYY representatives. Contacting them is the fastest way to solve technical issues.

于 2011-11-29T11:18:56.290 回答