i have a project by Xcode 5.1,and run on iOS 7. when i recognize without custom languages,things goes perfect. but when i using a custom languages,a error message come out: patterns argument is null. below is how i create CMocrRecognitionConfiguration.

- (CMocrRecognitionConfiguration*) bcrConfiguration2
{
CMocrUserLanguage* myLanguage = [CMocrUserLanguage languageWithId:1024];
CMocrRecognitionConfiguration* recognitionConfiguration = [[CMocrRecognitionConfiguration alloc]
                                                           initWithImageResolution:0
                                                           imageProcessingOptions:0
                                                           recognitionMode:MRM_Full
                                                           recognitionConfidenceLevel:MRCL_Level3
                                                           barcodeTypes:0
                                                           defaultCodePage:MSCP_Utf8
                                                           unknownLetter:L'^'
                                                           recognitionLanguages:nil];
NSSet* userLanguages = [NSSet setWithObject:myLanguage];
[recognitionConfiguration setUserRecognitionLanguages:userLanguages patternsDataFileName:@"Idcard"];
return recognitionConfiguration;

}

the Idcard.rom is putted into the folder "Pattern"

asked 26 Mar '14, 11:40

zx344819350's gravatar image

zx344819350
114

edited 26 Mar '14, 11:48


To recognize with a custom language try to use the code below:

-(CMocrRecognitionConfiguration*)
{
if(_ocrConfiguration==nil){
    CMocrUserLanguage* myLanguage = [CMocrUserLanguage languageWithId:1024];
    _ocrConfiguration = [[CMocrRecognitionConfiguration alloc]]
        initWithImageResolution:0
        imageProcessingOptions:0
        recognitionMode:MRM_Full
        recognitionConfidenceLevel:MRCL_Level3
        barcodeTypes:0
        defaultCodePage:MSCP_Utf8
        unknownLetter:L'^'
        recognitionLanguages:nil];
    NSSet*userLanguages = [NSSet setWithObjects:myLanguage, nil]
    [_ocrConfiguration setUserRecognitionLanguages:userLanguages     patternsDataFileName:@"UserPattern"];
}
return _ocrConfiguration;
}

Also please check if CMocrRecognitionConfiguration is correctly send for recognition.

link

answered 28 Mar '14, 14:05

Julia%20Anikushina's gravatar image

Julia Anikus... ♦♦
3628

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×59
×6
×2

Asked: 26 Mar '14, 11:40

Seen: 1,908 times

Last updated: 28 Mar '14, 14:05

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal