Question

I setup Tesseract by adding the tessdata by reference, then adding the tesseract-ios and tesseract-ios-lib as groups.

This is the guide I followed. Guide

I imported #import "Tesseract.h" in my ViewController.m file and I can successfully use Tesseract but can't use the methods defined in baseapi.h Tesseract.mm imports baseapi.h as a side note.

Tesseract *tesseract = [[Tesseract alloc]init];

[tesseract setImage:[UIImage imageNamed:@"card.jpg"]];
[tesseract recognize];
char *utf8Text=tesseract->GetHOCRText(0);

I am getting the error of "Tesseract" does not have a member named "GetHOCRText"

How can I use the methods defined in baseapi.h while developing on iOS?

Was it helpful?

Solution

You can refer my answer here. In that answer i have mentioned how can you set rect which defined in baseapi.h with tesseract. Same way you can try for this too.

Go to Tesseract.mm file and add this code there.

- (NSString *)getHOCRText {
        char *boxtext = _tesseract->GetHOCRText(0);
        return [NSString stringWithUTF8String:boxtext];
}

Go to Tesseract.h file and define method :

- (NSString *)getHOCRText;

Then you can use that method to get HOCRText.

[tesseract getHOCRText];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top