Skip to content

Commit 7d504de

Browse files
author
Kevin Conley
committed
Auto-run layout analysis in G8RecognitionOperation.
Fixes #155.
1 parent 1fba58b commit 7d504de

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

TesseractOCR/G8RecognitionOperation.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ - (id) initWithLanguage:(NSString *)language
4949
- (void)main
5050
{
5151
@autoreleasepool {
52+
// Analyzing the layout must be performed before recognition
53+
[self.tesseract analyseLayout];
54+
5255
[self.tesseract recognize];
5356
}
5457
}

TesseractOCR/G8Tesseract.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ extern NSInteger const kG8MaxCredibleResolution;
146146
*/
147147
- (NSString *)recognizedHOCRForPageNumber:(int)pageNumber;
148148

149+
/**
150+
* Run Tesseract's page analysis on the target image.
151+
*
152+
* @note You must have a file called "osd.traineddata" in the "tessdata"
153+
* folder to use this method. You can download this file from:
154+
* https://code.google.com/p/tesseract-ocr/downloads/list
155+
*/
156+
- (void)analyseLayout;
157+
149158
/**
150159
* The result of Tesseract's orientation analysis of the target image. See
151160
* `G8Orientation` in G8Constants.h for the possible orientations.

0 commit comments

Comments
 (0)