Commit 1e4c407d for tesseract
commit 1e4c407d398449a76207da4d892cd86f09b884f0
Author: Stefan Weil <sw@weilnetz.de>
Date: Sun Jun 21 08:38:33 2026 +0200
Remove unused function parameters and optimize class Tesseract
Signed-off-by: Stefan Weil <sw@weilnetz.de>
diff --git a/src/ccmain/pagesegmain.cpp b/src/ccmain/pagesegmain.cpp
index 3efd37af..7e66b150 100644
--- a/src/ccmain/pagesegmain.cpp
+++ b/src/ccmain/pagesegmain.cpp
@@ -223,7 +223,7 @@ int Tesseract::AutoPageSeg(PageSegMode pageseg_mode, BLOCK_LIST *blocks, TO_BLOC
finder->SetEquationDetect(equ_detect_);
}
#endif // ndef DISABLED_LEGACY_ENGINE
- result = finder->FindBlocks(pageseg_mode, scaled_color_, scaled_factor_, to_block,
+ result = finder->FindBlocks(pageseg_mode, to_block,
photomask_pix, pix_thresholds_, pix_grey_, &pixa_debug_,
&found_blocks, diacritic_blobs, to_blocks);
if (result >= 0) {
diff --git a/src/ccmain/tesseractclass.cpp b/src/ccmain/tesseractclass.cpp
index f1406913..ce896a84 100644
--- a/src/ccmain/tesseractclass.cpp
+++ b/src/ccmain/tesseractclass.cpp
@@ -457,8 +457,6 @@ Tesseract::Tesseract()
, source_resolution_(0)
, textord_(this)
, right_to_left_(false)
- , scaled_color_(nullptr)
- , scaled_factor_(-1)
, deskew_(1.0f, 0.0f)
, reskew_(1.0f, 0.0f)
, gradient_(0.0f)
@@ -496,12 +494,10 @@ void Tesseract::Clear() {
pix_binary_.destroy();
pix_grey_.destroy();
pix_thresholds_.destroy();
- scaled_color_.destroy();
deskew_ = FCOORD(1.0f, 0.0f);
reskew_ = FCOORD(1.0f, 0.0f);
gradient_ = 0.0f;
splitter_.Clear();
- scaled_factor_ = -1;
for (auto &sub_lang : sub_langs_) {
sub_lang->Clear();
}
diff --git a/src/ccmain/tesseractclass.h b/src/ccmain/tesseractclass.h
index 55fcb3fe..9a8875c3 100644
--- a/src/ccmain/tesseractclass.h
+++ b/src/ccmain/tesseractclass.h
@@ -262,16 +262,6 @@ public:
int ImageHeight() const {
return pixGetHeight(pix_binary_);
}
- Image scaled_color() const {
- return scaled_color_;
- }
- int scaled_factor() const {
- return scaled_factor_;
- }
- void SetScaledColor(int factor, Image color) {
- scaled_factor_ = factor;
- scaled_color_ = color;
- }
const Textord &textord() const {
return textord_;
}
@@ -1003,8 +993,6 @@ private:
Textord textord_;
// True if the primary language uses right_to_left reading order.
bool right_to_left_;
- Image scaled_color_;
- int scaled_factor_;
FCOORD deskew_;
FCOORD reskew_;
float gradient_;
diff --git a/src/textord/colfind.cpp b/src/textord/colfind.cpp
index 8fec3241..11e63896 100644
--- a/src/textord/colfind.cpp
+++ b/src/textord/colfind.cpp
@@ -270,8 +270,6 @@ void ColumnFinder::CorrectOrientation(TO_BLOCK *block, bool vertical_text_lines,
// removed and placed in the output blocks, while unused ones will be deleted.
// If single_column is true, the input is treated as single column, but
// it is still divided into blocks of equal line spacing/text size.
-// scaled_color is scaled down by scaled_factor from the input color image,
-// and may be nullptr if the input was not color.
// grey_pix is optional, but if present must match the photo_mask_pix in size,
// and must be a *real* grey image instead of binary_pix * 255.
// thresholds_pix is expected to be present iff grey_pix is present and
@@ -283,7 +281,7 @@ void ColumnFinder::CorrectOrientation(TO_BLOCK *block, bool vertical_text_lines,
// noise/diacriticness determined via classification.
// Returns -1 if the user hits the 'd' key in the blocks window while running
// in debug mode, which requests a retry with more debug info.
-int ColumnFinder::FindBlocks(PageSegMode pageseg_mode, Image scaled_color, int scaled_factor,
+int ColumnFinder::FindBlocks(PageSegMode pageseg_mode,
TO_BLOCK *input_block, Image photo_mask_pix, Image thresholds_pix,
Image grey_pix, DebugPixa *pixa_debug, BLOCK_LIST *blocks,
BLOBNBOX_LIST *diacritic_blobs, TO_BLOCK_LIST *to_blocks) {
diff --git a/src/textord/colfind.h b/src/textord/colfind.h
index fac0d3c6..075c2e39 100644
--- a/src/textord/colfind.h
+++ b/src/textord/colfind.h
@@ -144,8 +144,6 @@ public:
// removed and placed in the output blocks, while unused ones will be deleted.
// If single_column is true, the input is treated as single column, but
// it is still divided into blocks of equal line spacing/text size.
- // scaled_color is scaled down by scaled_factor from the input color image,
- // and may be nullptr if the input was not color.
// grey_pix is optional, but if present must match the photo_mask_pix in size,
// and must be a *real* grey image instead of binary_pix * 255.
// thresholds_pix is expected to be present iff grey_pix is present and
@@ -156,7 +154,7 @@ public:
// appropriate word after the rest of layout analysis.
// Returns -1 if the user hits the 'd' key in the blocks window while running
// in debug mode, which requests a retry with more debug info.
- int FindBlocks(PageSegMode pageseg_mode, Image scaled_color, int scaled_factor, TO_BLOCK *block,
+ int FindBlocks(PageSegMode pageseg_mode, TO_BLOCK *block,
Image photo_mask_pix, Image thresholds_pix, Image grey_pix, DebugPixa *pixa_debug,
BLOCK_LIST *blocks, BLOBNBOX_LIST *diacritic_blobs, TO_BLOCK_LIST *to_blocks);
diff --git a/unittest/textlineprojection_test.cc b/unittest/textlineprojection_test.cc
index 907adffd..9637933c 100644
--- a/unittest/textlineprojection_test.cc
+++ b/unittest/textlineprojection_test.cc
@@ -100,7 +100,7 @@ protected:
denorm_ = finder_->denorm();
TO_BLOCK_LIST to_blocks;
BLOBNBOX_LIST diacritic_blobs;
- EXPECT_GE(finder_->FindBlocks(tesseract::PSM_AUTO, nullptr, 1, to_block, photomask_pix, nullptr,
+ EXPECT_GE(finder_->FindBlocks(tesseract::PSM_AUTO, to_block, photomask_pix, nullptr,
nullptr, nullptr, &found_blocks, &diacritic_blobs, &to_blocks),
0);
projection_ = finder_->projection();