【发布时间】:2014-02-04 02:20:47
【问题描述】:
我正在学习如何使用 Tesseract API,我对 hOCR 输出函数很感兴趣。目前我正在使用此代码扫描图像。
Tesseract* tesseract = [[Tesseract alloc] initWithLanguage:@"eng"];
tesseract.delegate = self;
[tesseract setVariableValue:@"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@.-():" forKey:@"tessedit_char_whitelist"];
[tesseract setVariableValue:@"0" forKey:@"tessedit_create_hocr"];
UIImage *image = [UIImage imageNamed:@"card.jpg"];
CGFloat newWidth = 1200;
CGSize newSize = CGSizeMake(newWidth, newWidth);
image = [image resizedImage:newSize interpolationQuality:kCGInterpolationHigh];
[tesseract setImage:image]; //image to check
[tesseract recognize];
NSLog(@"Here is the text %@", [tesseract recognizedText]);
一切正常,但我想知道如何存储 hOCR 函数返回的 .html。 我可以将它存储在变量中吗?生成该文件后,我需要能够在我的程序中访问该文件。感谢您对如何在 iOS 上使用 hOCR 的任何见解。
【问题讨论】:
标签: ios objective-c tesseract hocr