ocr sdk ios

  • Last Post 19 May 2015
Michael Sheinfeild posted this 14 May 2015

i want to call ocr abby for ios withou callback how i can do it , i loaded licence + init the engine how to get the string result from ocr in the sample project they have casllback but i cant implement it in other project is there other sample without any callback , threads , gcd etc just load engine then return string from image !!! cant continue with i have problems with NSObject<imocrrecognitionmanager>* _recognitionManager; i dont understand the callback function i cant recive cmocrlayot class

my code :

-(void)  initializeRecognitionEngine

// Load the license data from file.
NSString* licenseDataFilePath = [[self pathToData] stringByAppendingPathComponent:@"ABBYY.License"];//@"license"];
NSFileHandle* licenseDataFile = [NSFileHandle fileHandleForReadingAtPath:licenseDataFilePath];
NSData* licenseData = [licenseDataFile readDataToEndOfFile];

// Intialize MobileOCR engine
NSArray* dataSources = [NSArray arrayWithObject:[CMocrDirectoryDataSource dataSourceWithDirectoryPath:[self pathToData]]];
CMocrLicense* license = [CMocrLicense licenseWithLicenseData:licenseData applicationId:@"iOS_ID"];
_mocrEngine = [CMocrEngine createSharedEngineWithDataSources:dataSources license:license];

if( _mocrEngine == nil ) {
    // Failed to create singleton instance of the CMocrEngine class.
    TMocrErrorCode errorCode;
    NSString* errorMessage;
    [CMocrEngine getLastError:&errorCode message:&errorMessage];
    NSLog(@"Error code: %@. Error message: %@", [ImageImporterViewController stringFromMocrErrorCode:errorCode], errorMessage);
_ocrConfiguration = nil;
_bcrConfiguration = nil;

} - (CMocrRecognitionConfiguration) ocrConfiguration { if( _ocrConfiguration == nil ) { NSSet recognitionLanguages = [NSSet setWithObjects:@"English", nil]; _ocrConfiguration = [[CMocrRecognitionConfiguration alloc] initWithImageResolution:300 imageProcessingOptions:0 recognitionMode:MRM_Full recognitionConfidenceLevel:MRCL_Level3 barcodeTypes:MBT_ANY1D | MBT_SQUARE2D defaultCodePage:MSCP_Utf8 unknownLetter:L'^' recognitionLanguages:recognitionLanguages]; } return _ocrConfiguration; }

Anna Falevskaya posted this 19 May 2015

Dear Michael,

All available samples are included in the MSDK distributive, we have no other samples besides those.

We kindly ask you to read the «How to Use the iOS Wrapper» article from our Help file (Guided Tour→How to Use the iOS Wrapper). It describes how to add the library and the resources to your own project and how to use the library on iOS. Hope it will be helpful!