Skip to content

Commit 56936e3

Browse files
author
Kevin Conley
committed
Only perform layout analysis once per image.
1 parent 7d504de commit 56936e3

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

TesseractOCR/G8Tesseract.mm

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -492,38 +492,33 @@ - (NSString *)recognizedText
492492

493493
- (G8Orientation)orientation
494494
{
495-
if (self.layoutAnalysed == NO) {
496-
[self analyseLayout];
497-
}
495+
[self analyseLayout];
498496
return _orientation;
499497
}
500498

501499
- (G8WritingDirection)writingDirection
502500
{
503-
if (self.layoutAnalysed == NO) {
504-
[self analyseLayout];
505-
}
501+
[self analyseLayout];
506502
return _writingDirection;
507503
}
508504

509505
- (G8TextlineOrder)textlineOrder
510506
{
511-
if (self.layoutAnalysed == NO) {
512-
[self analyseLayout];
513-
}
507+
[self analyseLayout];
514508
return _textlineOrder;
515509
}
516510

517511
- (CGFloat)deskewAngle
518512
{
519-
if (self.layoutAnalysed == NO) {
520-
[self analyseLayout];
521-
}
513+
[self analyseLayout];
522514
return _deskewAngle;
523515
}
524516

525517
- (void)analyseLayout
526518
{
519+
// Only perform the layout analysis if we haven't already
520+
if (self.layoutAnalysed) return;
521+
527522
tesseract::Orientation orientation;
528523
tesseract::WritingDirection direction;
529524
tesseract::TextlineOrder order;

0 commit comments

Comments
 (0)