#include <tablerecog.h>
List of all members.
Detailed Description
Definition at line 72 of file tablerecog.h.
Constructor & Destructor Documentation
tesseract::StructuredTable::StructuredTable |
( |
| ) |
|
tesseract::StructuredTable::~StructuredTable |
( |
| ) |
|
Member Function Documentation
void tesseract::StructuredTable::AbsorbNearbyLines |
( |
| ) |
|
|
protected |
Definition at line 531 of file tablerecog.cpp.
{
gsearch.SetUniqueMode(true);
ColPartition* line =
NULL;
while ((line = gsearch.NextVerticalSearch(
false)) !=
NULL) {
if (!line->IsHorizontalLine())
break;
break;
break;
}
while ((line = gsearch.NextVerticalSearch(
true)) !=
NULL) {
if (!line->IsHorizontalLine())
break;
break;
break;
}
}
const TBOX & tesseract::StructuredTable::bounding_box |
( |
| ) |
const |
double tesseract::StructuredTable::CalculateCellFilledPercentage |
( |
int |
row, |
|
|
int |
column |
|
) |
| |
Definition at line 263 of file tablerecog.cpp.
{
gsearch.SetUniqueMode(true);
gsearch.StartRectSearch(kCellBox);
double area_covered = 0;
ColPartition* text =
NULL;
while ((text = gsearch.NextRectSearch()) !=
NULL) {
if (text->IsTextType())
area_covered += text->bounding_box().intersection(kCellBox).area();
}
return MIN(1.0, area_covered / kCellBox.area());
}
void tesseract::StructuredTable::CalculateMargins |
( |
| ) |
|
|
protected |
void tesseract::StructuredTable::CalculateStats |
( |
| ) |
|
|
protected |
Definition at line 511 of file tablerecog.cpp.
{
const int kMaxCellHeight = 1000;
const int kMaxCellWidth = 1000;
STATS height_stats(0, kMaxCellHeight + 1);
STATS width_stats(0, kMaxCellWidth + 1);
}
int tesseract::StructuredTable::cell_count |
( |
| ) |
const |
void tesseract::StructuredTable::ClearStructure |
( |
| ) |
|
|
protected |
int tesseract::StructuredTable::column_count |
( |
| ) |
const |
int tesseract::StructuredTable::column_width |
( |
int |
column | ) |
const |
int tesseract::StructuredTable::CountFilledCells |
( |
| ) |
|
int tesseract::StructuredTable::CountFilledCells |
( |
int |
row_start, |
|
|
int |
row_end, |
|
|
int |
column_start, |
|
|
int |
column_end |
|
) |
| |
Definition at line 229 of file tablerecog.cpp.
{
ASSERT_HOST(0 <= column_start && column_start <= column_end &&
for (int row = row_start; row <= row_end; ++row) {
for (int col = column_start; col <= column_end; ++col) {
}
}
}
int tesseract::StructuredTable::CountFilledCellsInColumn |
( |
int |
column | ) |
|
int tesseract::StructuredTable::CountFilledCellsInRow |
( |
int |
row | ) |
|
int tesseract::StructuredTable::CountHorizontalIntersections |
( |
int |
y | ) |
|
|
protected |
Definition at line 655 of file tablerecog.cpp.
{
horizontal_box.
set_top(y + kGridSize);
gsearch.SetUniqueMode(true);
gsearch.StartRectSearch(horizontal_box);
ColPartition* text =
NULL;
while ((text = gsearch.NextRectSearch()) !=
NULL) {
if (!text->IsTextType())
continue;
const TBOX& box = text->bounding_box();
++count;
}
}
int tesseract::StructuredTable::CountPartitions |
( |
const TBOX & |
box | ) |
|
|
protected |
Definition at line 681 of file tablerecog.cpp.
{
gsearch.SetUniqueMode(true);
gsearch.StartRectSearch(box);
ColPartition* text =
NULL;
while ((text = gsearch.NextRectSearch()) !=
NULL) {
if (text->IsTextType())
++count;
}
}
int tesseract::StructuredTable::CountVerticalIntersections |
( |
int |
x | ) |
|
|
protected |
Definition at line 631 of file tablerecog.cpp.
{
gsearch.SetUniqueMode(true);
gsearch.StartRectSearch(vertical_box);
ColPartition* text =
NULL;
while ((text = gsearch.NextRectSearch()) !=
NULL) {
if (!text->IsTextType())
continue;
const TBOX& box = text->bounding_box();
++count;
}
}
Definition at line 282 of file tablerecog.cpp.
{
#ifndef GRAPHICS_DISABLED
}
}
#endif
}
bool tesseract::StructuredTable::DoesPartitionFit |
( |
const ColPartition & |
part | ) |
const |
Definition at line 208 of file tablerecog.cpp.
{
const TBOX& box = part.bounding_box();
return false;
return false;
return true;
}
Definition at line 585 of file tablerecog.cpp.
{
return;
int min_index = 0;
int max_index = 0;
int stacked_partitions = 0;
while (min_index < min_list.
length()) {
if (min_list[min_index] < max_list[max_index]) {
++stacked_partitions;
stacked_partitions > max_merged) {
int mid = (last_cross_position + min_list[min_index]) / 2;
}
++min_index;
} else {
--stacked_partitions;
stacked_partitions <= max_merged) {
last_cross_position = max_list[max_index];
}
++max_index;
}
}
}
int tesseract::StructuredTable::FindHorizontalMargin |
( |
ColPartitionGrid * |
grid, |
|
|
int |
start_y, |
|
|
bool |
decrease |
|
) |
| const |
|
protected |
Definition at line 494 of file tablerecog.cpp.
{
gsearch.SetUniqueMode(true);
ColPartition* part =
NULL;
while ((part = gsearch.NextSideSearch(decrease)) !=
NULL) {
if (!part->IsTextType() && !part->IsVerticalLine())
continue;
int distance = decrease ? border - part->bounding_box().right()
: part->bounding_box().left() - border;
if (distance >= 0)
return distance;
}
}
bool tesseract::StructuredTable::FindLinedStructure |
( |
| ) |
|
Definition at line 137 of file tablerecog.cpp.
{
box_search.SetUniqueMode(true);
ColPartition* line =
NULL;
while ((line = box_search.NextRectSearch()) !=
NULL) {
if (line->IsHorizontalLine())
if (line->IsVerticalLine())
}
return false;
}
int tesseract::StructuredTable::FindVerticalMargin |
( |
ColPartitionGrid * |
grid, |
|
|
int |
start_x, |
|
|
bool |
decrease |
|
) |
| const |
|
protected |
Definition at line 477 of file tablerecog.cpp.
{
gsearch.SetUniqueMode(true);
border);
ColPartition* part =
NULL;
while ((part = gsearch.NextVerticalSearch(decrease)) !=
NULL) {
if (!part->IsTextType() && !part->IsHorizontalLine())
continue;
int distance = decrease ? border - part->bounding_box().top()
: part->bounding_box().bottom() - border;
if (distance >= 0)
return distance;
}
}
void tesseract::StructuredTable::FindWhitespacedColumns |
( |
| ) |
|
|
protected |
Definition at line 347 of file tablerecog.cpp.
{
gsearch.SetUniqueMode(true);
ColPartition* text =
NULL;
while ((text = gsearch.NextRectSearch()) !=
NULL) {
if (!text->IsTextType())
continue;
ASSERT_HOST(text->bounding_box().left() < text->bounding_box().right());
int spacing = static_cast<int>(text->median_width() *
left_sides.
push_back(text->bounding_box().left() - spacing);
right_sides.
push_back(text->bounding_box().right() + spacing);
}
return;
}
void tesseract::StructuredTable::FindWhitespacedRows |
( |
| ) |
|
|
protected |
Definition at line 392 of file tablerecog.cpp.
{
gsearch.SetUniqueMode(true);
ColPartition* text =
NULL;
while ((text = gsearch.NextRectSearch()) !=
NULL) {
if (!text->IsTextType())
continue;
ASSERT_HOST(text->bounding_box().bottom() < text->bounding_box().top());
min_bottom =
MIN(min_bottom, text->bounding_box().bottom());
max_top =
MAX(max_top, text->bounding_box().top());
continue;
int spacing = static_cast<int>(text->bounding_box().height() *
int bottom = text->bounding_box().bottom() - spacing;
int top = text->bounding_box().top() + spacing;
if (bottom >= top)
continue;
}
return;
}
bool tesseract::StructuredTable::FindWhitespacedStructure |
( |
| ) |
|
Definition at line 184 of file tablerecog.cpp.
{
return false;
} else {
return true;
}
}
void tesseract::StructuredTable::Init |
( |
| ) |
|
bool tesseract::StructuredTable::is_lined |
( |
| ) |
const |
int tesseract::StructuredTable::median_cell_height |
( |
| ) |
|
int tesseract::StructuredTable::median_cell_width |
( |
| ) |
|
int tesseract::StructuredTable::row_count |
( |
| ) |
const |
int tesseract::StructuredTable::row_height |
( |
int |
row | ) |
const |
void tesseract::StructuredTable::set_bounding_box |
( |
const TBOX & |
box | ) |
|
void tesseract::StructuredTable::set_max_text_height |
( |
int |
height | ) |
|
int tesseract::StructuredTable::space_above |
( |
| ) |
const |
int tesseract::StructuredTable::space_below |
( |
| ) |
const |
bool tesseract::StructuredTable::VerifyLinedTableCells |
( |
| ) |
|
|
protected |
Definition at line 315 of file tablerecog.cpp.
{
return false;
}
return false;
}
return true;
}
bool tesseract::StructuredTable::VerifyRowFilled |
( |
int |
row | ) |
|
bool tesseract::StructuredTable::VerifyWhitespacedTable |
( |
| ) |
|
|
protected |
Member Data Documentation
TBOX tesseract::StructuredTable::bounding_box_ |
|
protected |
bool tesseract::StructuredTable::is_lined_ |
|
protected |
int tesseract::StructuredTable::max_text_height_ |
|
protected |
int tesseract::StructuredTable::median_cell_height_ |
|
protected |
int tesseract::StructuredTable::median_cell_width_ |
|
protected |
int tesseract::StructuredTable::space_above_ |
|
protected |
int tesseract::StructuredTable::space_below_ |
|
protected |
int tesseract::StructuredTable::space_left_ |
|
protected |
int tesseract::StructuredTable::space_right_ |
|
protected |
The documentation for this class was generated from the following files: