Skip to content

Commit

Permalink
Only perform layout analysis once per image.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Conley committed Apr 3, 2015
1 parent 7d504de commit 56936e3
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions TesseractOCR/G8Tesseract.mm
Original file line number Diff line number Diff line change
Expand Up @@ -492,38 +492,33 @@ - (NSString *)recognizedText

- (G8Orientation)orientation
{
if (self.layoutAnalysed == NO) {
[self analyseLayout];
}
[self analyseLayout];
return _orientation;
}

- (G8WritingDirection)writingDirection
{
if (self.layoutAnalysed == NO) {
[self analyseLayout];
}
[self analyseLayout];
return _writingDirection;
}

- (G8TextlineOrder)textlineOrder
{
if (self.layoutAnalysed == NO) {
[self analyseLayout];
}
[self analyseLayout];
return _textlineOrder;
}

- (CGFloat)deskewAngle
{
if (self.layoutAnalysed == NO) {
[self analyseLayout];
}
[self analyseLayout];
return _deskewAngle;
}

- (void)analyseLayout
{
// Only perform the layout analysis if we haven't already
if (self.layoutAnalysed) return;

tesseract::Orientation orientation;
tesseract::WritingDirection direction;
tesseract::TextlineOrder order;
Expand Down

0 comments on commit 56936e3

Please sign in to comment.