简体   繁体   中英

How do I get accurate text using Tesseract OCR in iOS?

I am working on iPhone application.Here I need to get text from the images, after googling I found Tesseract can do that.Its working fine but not getting accurate results.I used this and processed the image but still not getting good results.

Tesseract* tesseract = [[Tesseract alloc] initWithDataPath:@"tessdata" language:@"eng"];
UIImage *selectedImage=[UIImage imageNamed:@"download.jpg"];
[tesseract setImage:selectedImage];

ImageWrapper *greyScale=Image::createImage(selectedImage, selectedImage.size.width+100, selectedImage.size.height+100);
ImageWrapper *edges = greyScale.image->autoLocalThreshold();
[tesseract setImage:edges.image->toUIImage()];
[tesseract recognize];
NSLog(@"%@", [tesseract recognizedText]);

I used below image for testing.But I am getting results like .-|llIAT&T JG H109 PM ED ' '» "rr ~ ' ma» mania-J 'E, 'M, 4 ., -_ \\ ~ \\ Download Image 53.0 KB \\ _11.04 PM | Hey | am in buenos aires right 'now. Check out this mm phfllu 111:5 PM |' lam in Budapest on WiF. n is \\ maePMu 001d here. ; l 1 . , ' l, . 11.05 PM u, .——; _ | Nice picture. Let me send you an audio nuke. _11 08PM .-|llIAT&T JG H109 PM ED ' '» "rr ~ ' ma» mania-J 'E, 'M, 4 ., -_ \\ ~ \\ Download Image 53.0 KB \\ _11.04 PM | Hey | am in buenos aires right 'now. Check out this mm phfllu 111:5 PM |' lam in Budapest on WiF. n is \\ maePMu 001d here. ; l 1 . , ' l, . 11.05 PM u, .——; _ | Nice picture. Let me send you an audio nuke. _11 08PM

How to solve the above issue.If any one worked on it please guide me.Thanks in advance.

在此处输入图片说明

I tried to recognise your image with ABBYY Cloud OCR SDK and decided to share result with you. I think its rather accurate: 苹果手机

You can try demo recognition here: http://cloud.ocrsdk.com/demo (its a marketing tool without opportunity to extract data).

I work for ABBYY and ready to help you. Just let me know in comments.

I tried it to recognise my image with ABBYY Cloud OCR SDK.

Here to solved like this , I tried to extract text and export it in XML format. This format contains recognized text, with structure and parameters which are described with the help of XML. The par tag corresponces to one paragraph of a recognized text. After getting the text from XML you could work with it as you want.

I processed chat screen shots with the following settings:

"…/processImage?language=English&profile=documentConversion&exportFormat=xml"

and got the attached XML files. These images are processed correctly, each dialog block is detected as separate paragraph.

Hope the information is helpful.

Thanks to Abbyy OCR SDK team for providing solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM