Remove a local function from class TableRecognizer

This allows the compiler to remove the unused function IsWeakTableRow.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2022-02-05 21:13:26 +01:00
parent 101ed0036b
commit 44ddde1692
2 changed files with 23 additions and 25 deletions

View File

@ -59,6 +59,28 @@ const double kGoodRowNumberOfColumnsLarge = 0.7;
// be considered "filled"
const double kMinFilledArea = 0.35;
// Indicates that a table row is weak. This means that it has
// many missing data cells or very large cell heights compared.
// to the rest of the table.
// Code is buggy right now. It is disabled in the calling function.
// It seems like sometimes the row that is passed in is not correct
// sometimes (like a phantom row is introduced). There's something going
// on in the cell_y_ data member before this is called... not certain.
static bool IsWeakTableRow(StructuredTable *table, int row) {
if (!table->VerifyRowFilled(row)) {
return false;
}
double threshold;
if (table->column_count() < countof(kGoodRowNumberOfColumnsSmall)) {
threshold = kGoodRowNumberOfColumnsSmall[table->column_count()];
} else {
threshold = table->column_count() * kGoodRowNumberOfColumnsLarge;
}
return table->CountFilledCellsInRow(row) < threshold;
}
////////
//////// StructuredTable Class
////////
@ -1059,23 +1081,4 @@ int TableRecognizer::NextHorizontalSplit(int left, int right, int y, bool top_to
return last_y;
}
// Code is buggy right now. It is disabled in the calling function.
// It seems like sometimes the row that is passed in is not correct
// sometimes (like a phantom row is introduced). There's something going
// on in the cell_y_ data member before this is called... not certain.
bool TableRecognizer::IsWeakTableRow(StructuredTable *table, int row) {
if (!table->VerifyRowFilled(row)) {
return false;
}
double threshold;
if (table->column_count() < countof(kGoodRowNumberOfColumnsSmall)) {
threshold = kGoodRowNumberOfColumnsSmall[table->column_count()];
} else {
threshold = table->column_count() * kGoodRowNumberOfColumnsLarge;
}
return table->CountFilledCellsInRow(row) < threshold;
}
} // namespace tesseract

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////
// File: tablerecog.h
// Description: Functions to detect structure of tables.
// Author: Nicholas Beato
// Author: Nicholas Beato
//
// (C) Copyright 2010, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -352,11 +352,6 @@ protected:
// as I thought. I went with alternatives for most of the other uses.
int NextHorizontalSplit(int left, int right, int y, bool top_to_bottom);
// Indicates that a table row is weak. This means that it has
// many missing data cells or very large cell heights compared.
// to the rest of the table.
static bool IsWeakTableRow(StructuredTable *table, int row);
// Input data, used as read only data to make decisions.
ColPartitionGrid *text_grid_ = nullptr; // Text ColPartitions
ColPartitionGrid *line_grid_ = nullptr; // Line ColPartitions