1
votes

I am trying to set writing direction in Tesseract for Arabic, Urdu and other languages for my iOS application.When I tried to set like this

G8RecognitionOperation *tesseract;
tesseract.tesseract.writingDirection = G8WritingDirectionRightToLeft;

It gives error "Assignment read only property". Please answer with correct code. https://github.com/gali8/Tesseract-OCR-iOS/blob/master/TesseractOCR/G8Constants.h

1

1 Answers

3
votes

writingDirection property is read only and will be detected when recognized text.

G8WritingDirection in G8Constants.h are the possible writing directions.

I tried to recognize this image :

sample image

with the following code:

G8RecognitionOperation *operation = [[G8RecognitionOperation alloc] initWithLanguage:@"ara"];
operation.tesseract.language = @"ara";
operation.tesseract.image = [[UIImage imageNamed:@"ara.png"] g8_blackAndWhite];
operation.recognitionCompleteBlock = ^(G8Tesseract *recognizedTesseract) {
    NSLog(@"recognizedText=%@", [recognizedTesseract recognizedText]);
    NSLog(@"writingDirection=%lu", (unsigned long) recognizedTesseract.writingDirection);
};

And I got the output as:

recognizedText=شكر ا جزيلا
writingDirection=1