tesseract
5.0.0-alpha-619-ge9db
|
#include <tablefind.h>
|
int | gridsize () const |
|
int | gridwidth () const |
|
int | gridheight () const |
|
const ICOORD & | bleft () const |
|
const ICOORD & | tright () const |
|
ScrollView * | MakeWindow (int x, int y, const char *window_name) |
|
void | InsertTextPartition (ColPartition *part) |
|
void | InsertFragmentedTextPartition (ColPartition *part) |
|
void | InsertLeaderPartition (ColPartition *part) |
|
void | InsertRulingPartition (ColPartition *part) |
|
void | InsertImagePartition (ColPartition *part) |
|
void | SplitAndInsertFragmentedTextPartition (ColPartition *part) |
|
bool | AllowTextPartition (const ColPartition &part) const |
|
bool | AllowBlob (const BLOBNBOX &blob) const |
|
void | MoveColSegmentsToGrid (ColSegment_LIST *segments, ColSegmentGrid *col_seg_grid) |
|
void | InitializePartitions (ColPartitionSet **all_columns) |
|
void | SetVerticalSpacing (ColPartition *part) |
|
void | SetGlobalSpacings (ColPartitionGrid *grid) |
|
void | set_global_median_xheight (int xheight) |
|
void | set_global_median_blob_width (int width) |
|
void | set_global_median_ledding (int ledding) |
|
void | FindNeighbors () |
|
void | MarkTablePartitions () |
|
void | MarkPartitionsUsingLocalInformation () |
|
bool | HasWideOrNoInterWordGap (ColPartition *part) const |
|
bool | HasLeaderAdjacent (const ColPartition &part) |
|
void | FilterFalseAlarms () |
|
void | FilterParagraphEndings () |
|
void | FilterHeaderAndFooter () |
|
void | SmoothTablePartitionRuns () |
|
void | GetColumnBlocks (ColPartitionSet **columns, ColSegment_LIST *col_segments) |
|
void | GroupColumnBlocks (ColSegment_LIST *current_segments, ColSegment_LIST *col_segments) |
|
bool | ConsecutiveBoxes (const TBOX &b1, const TBOX &b2) |
|
void | SetColumnsType (ColSegment_LIST *col_segments) |
|
void | GridMergeColumnBlocks () |
|
void | GetTableColumns (ColSegment_LIST *table_columns) |
|
void | GetTableRegions (ColSegment_LIST *table_columns, ColSegment_LIST *table_regions) |
|
void | GridMergeTableRegions () |
|
bool | BelongToOneTable (const TBOX &box1, const TBOX &box2) |
|
void | AdjustTableBoundaries () |
|
void | GrowTableBox (const TBOX &table_box, TBOX *result_box) |
|
void | GrowTableToIncludePartials (const TBOX &table_box, const TBOX &search_range, TBOX *result_box) |
|
void | GrowTableToIncludeLines (const TBOX &table_box, const TBOX &search_range, TBOX *result_box) |
|
bool | HLineBelongsToTable (const ColPartition &part, const TBOX &table_box) |
|
void | IncludeLeftOutColumnHeaders (TBOX *table_box) |
|
void | DeleteSingleColumnTables () |
|
bool | GapInXProjection (int *xprojection, int length) |
|
void | RecognizeTables () |
|
void | DisplayColSegments (ScrollView *win, ColSegment_LIST *cols, ScrollView::Color color) |
|
void | DisplayColPartitions (ScrollView *win, ColPartitionGrid *grid, ScrollView::Color text_color, ScrollView::Color table_color) |
|
void | DisplayColPartitions (ScrollView *win, ColPartitionGrid *grid, ScrollView::Color default_color) |
|
void | DisplayColPartitionConnections (ScrollView *win, ColPartitionGrid *grid, ScrollView::Color default_color) |
|
void | DisplayColSegmentGrid (ScrollView *win, ColSegmentGrid *grid, ScrollView::Color color) |
|
void | MakeTableBlocks (ColPartitionGrid *grid, ColPartitionSet **columns, WidthCallback width_cb) |
|
Definition at line 130 of file tablefind.h.
◆ TableFinder()
tesseract::TableFinder::TableFinder |
( |
| ) |
|
◆ ~TableFinder()
tesseract::TableFinder::~TableFinder |
( |
| ) |
|
◆ AdjustTableBoundaries()
void tesseract::TableFinder::AdjustTableBoundaries |
( |
| ) |
|
|
protected |
Definition at line 1486 of file tablefind.cpp.
1488 ColSegment_CLIST adjusted_tables;
1489 ColSegment_C_IT it(&adjusted_tables);
1491 gsearch.StartFullSearch();
1492 ColSegment* table =
nullptr;
1493 while ((table = gsearch.NextFullSearch()) !=
nullptr) {
1494 const TBOX& table_box = table->bounding_box();
1495 TBOX grown_box = table_box;
1501 auto* col =
new ColSegment();
1502 col->InsertBox(grown_box);
1503 it.add_after_then_move(col);
1505 gsearch.RemoveBBox();
1514 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
1515 ColSegment* seg = it.extract();
◆ AllowBlob()
bool tesseract::TableFinder::AllowBlob |
( |
const BLOBNBOX & |
blob | ) |
const |
|
protected |
Definition at line 502 of file tablefind.cpp.
509 return box.
height() > kHeightRequired &&
510 box.
width() > kWidthRequired &&
511 box.
area() > kAreaRequired;
◆ AllowTextPartition()
bool tesseract::TableFinder::AllowTextPartition |
( |
const ColPartition & |
part | ) |
const |
|
protected |
Definition at line 489 of file tablefind.cpp.
495 return part.median_height() > kHeightRequired &&
496 part.median_width() > kWidthRequired &&
497 part.bounding_box().area() > kAreaPerBlobRequired * part.boxes_count();
◆ BelongToOneTable()
bool tesseract::TableFinder::BelongToOneTable |
( |
const TBOX & |
box1, |
|
|
const TBOX & |
box2 |
|
) |
| |
|
protected |
Definition at line 1444 of file tablefind.cpp.
1453 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
1455 rectsearch.StartRectSearch(bbox);
1456 ColPartition* part =
nullptr;
1457 while ((part = rectsearch.NextRectSearch()) !=
nullptr) {
1458 const TBOX& part_box = part->bounding_box();
1461 !part->IsImageType())
◆ bleft()
const ICOORD & tesseract::TableFinder::bleft |
( |
| ) |
const |
|
protected |
◆ ConsecutiveBoxes()
bool tesseract::TableFinder::ConsecutiveBoxes |
( |
const TBOX & |
b1, |
|
|
const TBOX & |
b2 |
|
) |
| |
|
protected |
◆ DeleteSingleColumnTables()
void tesseract::TableFinder::DeleteSingleColumnTables |
( |
| ) |
|
|
protected |
Definition at line 1703 of file tablefind.cpp.
1707 int* table_xprojection =
new int[page_width];
1709 GridSearch<ColSegment, ColSegment_CLIST, ColSegment_C_IT>
1711 table_search.StartFullSearch();
1713 while ((table = table_search.NextFullSearch()) !=
nullptr) {
1714 TBOX table_box = table->bounding_box();
1716 for (
int i = 0; i < page_width; i++) {
1717 table_xprojection[i] = 0;
1720 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
1722 rectsearch.SetUniqueMode(
true);
1723 rectsearch.StartRectSearch(table_box);
1725 while ((part = rectsearch.NextRectSearch()) !=
nullptr) {
1726 if (!part->IsTextType())
1730 TBOX part_box = part->bounding_box();
1734 BLOBNBOX_CLIST* part_boxes = part->boxes();
1735 BLOBNBOX_C_IT pit(part_boxes);
1742 int next_position_to_write = 0;
1744 for (pit.mark_cycle_pt(); !pit.cycled_list(); pit.forward()) {
1751 xstart = std::max(xstart, next_position_to_write);
1752 for (
int i = xstart; i < xend; i++)
1753 table_xprojection[i -
bleft().
x()]++;
1754 next_position_to_write = xend;
1759 table_search.RemoveBBox();
1763 delete[] table_xprojection;
◆ DisplayColPartitionConnections()
Definition at line 1950 of file tablefind.cpp.
1954 #ifndef GRAPHICS_DISABLED
1956 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
1958 gsearch.StartFullSearch();
1959 ColPartition* part =
nullptr;
1960 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
1961 const TBOX& box = part->bounding_box();
1962 int left_x = box.
left();
1963 int right_x = box.
right();
1964 int top_y = box.
top();
1965 int bottom_y = box.
bottom();
1967 ColPartition* upper_part = part->nearest_neighbor_above();
1969 const TBOX& upper_box = upper_part->bounding_box();
1970 int mid_x = (left_x + right_x) / 2;
1971 int mid_y = (top_y + bottom_y) / 2;
1972 int other_x = (upper_box.
left() + upper_box.
right()) / 2;
1973 int other_y = (upper_box.
top() + upper_box.
bottom()) / 2;
1976 win->
Line(mid_x, mid_y, other_x, other_y);
1978 ColPartition* lower_part = part->nearest_neighbor_below();
1980 const TBOX& lower_box = lower_part->bounding_box();
1981 int mid_x = (left_x + right_x) / 2;
1982 int mid_y = (top_y + bottom_y) / 2;
1983 int other_x = (lower_box.
left() + lower_box.
right()) / 2;
1984 int other_y = (lower_box.
top() + lower_box.
bottom()) / 2;
1987 win->
Line(mid_x, mid_y, other_x, other_y);
◆ DisplayColPartitions() [1/2]
◆ DisplayColPartitions() [2/2]
Definition at line 1916 of file tablefind.cpp.
1920 #ifndef GRAPHICS_DISABLED
1923 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
1925 gsearch.StartFullSearch();
1926 ColPartition* part =
nullptr;
1927 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
1928 color = default_color;
1930 color = table_color;
1932 const TBOX& box = part->bounding_box();
1933 int left_x = box.
left();
1934 int right_x = box.
right();
1935 int top_y = box.
top();
1936 int bottom_y = box.
bottom();
1939 win->
Rectangle(left_x, bottom_y, right_x, top_y);
◆ DisplayColSegmentGrid()
Definition at line 1891 of file tablefind.cpp.
1893 #ifndef GRAPHICS_DISABLED
1895 GridSearch<ColSegment, ColSegment_CLIST, ColSegment_C_IT>
1897 gsearch.StartFullSearch();
1898 ColSegment* seg =
nullptr;
1899 while ((seg = gsearch.NextFullSearch()) !=
nullptr) {
1900 const TBOX& box = seg->bounding_box();
1901 int left_x = box.
left();
1902 int right_x = box.
right();
1903 int top_y = box.
top();
1904 int bottom_y = box.
bottom();
1907 win->
Rectangle(left_x, bottom_y, right_x, top_y);
◆ DisplayColSegments()
Definition at line 1871 of file tablefind.cpp.
1874 #ifndef GRAPHICS_DISABLED
1877 ColSegment_IT it(segments);
1878 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
1879 ColSegment* col = it.data();
1880 const TBOX& box = col->bounding_box();
1881 int left_x = box.
left();
1882 int right_x = box.
right();
1883 int top_y = box.
top();
1884 int bottom_y = box.
bottom();
1885 win->
Rectangle(left_x, bottom_y, right_x, top_y);
◆ FilterFalseAlarms()
void tesseract::TableFinder::FilterFalseAlarms |
( |
| ) |
|
|
protected |
◆ FilterHeaderAndFooter()
void tesseract::TableFinder::FilterHeaderAndFooter |
( |
| ) |
|
|
protected |
Definition at line 1074 of file tablefind.cpp.
1076 ColPartition* header =
nullptr;
1077 ColPartition* footer =
nullptr;
1078 int max_top = INT32_MIN;
1079 int min_bottom = INT32_MAX;
1081 gsearch.StartFullSearch();
1082 ColPartition* part =
nullptr;
1083 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
1084 if (!part->IsTextType())
1086 int top = part->bounding_box().top();
1087 int bottom = part->bounding_box().bottom();
1088 if (top > max_top) {
1092 if (bottom < min_bottom) {
1093 min_bottom = bottom;
1098 header->clear_table_type();
1100 footer->clear_table_type();
◆ FilterParagraphEndings()
void tesseract::TableFinder::FilterParagraphEndings |
( |
| ) |
|
|
protected |
Definition at line 994 of file tablefind.cpp.
998 gsearch.StartFullSearch();
999 ColPartition* part =
nullptr;
1000 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
1005 ColPartition* upper_part = part->nearest_neighbor_above();
1010 if (upper_part->bounding_box().width() <
1011 2 * part->bounding_box().width())
1019 int mid = (part->bounding_box().left() + part->bounding_box().right()) / 2;
1020 int upper_mid = (upper_part->bounding_box().left() +
1021 upper_part->bounding_box().right()) / 2;
1022 int current_spacing = 0;
1023 int upper_spacing = 0;
1027 int left = std::min(part->bounding_box().left(),
1028 upper_part->bounding_box().left());
1029 current_spacing = mid - left;
1030 upper_spacing = upper_mid - left;
1034 int right = std::max(part->bounding_box().right(),
1035 upper_part->bounding_box().right());
1036 current_spacing = right - mid;
1037 upper_spacing = right - upper_mid;
1043 if (!part->MatchingSizes(*upper_part) ||
1052 if (part->space_to_left() >
1060 if (upper_part->bounding_box().width() <
1065 if (part->space_above() >= part->space_below() ||
1070 part->clear_table_type();
◆ FindNeighbors()
void tesseract::TableFinder::FindNeighbors |
( |
| ) |
|
|
protected |
Definition at line 766 of file tablefind.cpp.
768 gsearch.StartFullSearch();
769 ColPartition* part =
nullptr;
770 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
775 ColPartition* upper = part->SingletonPartner(
true);
777 part->set_nearest_neighbor_above(upper);
779 ColPartition* lower = part->SingletonPartner(
false);
781 part->set_nearest_neighbor_below(lower);
◆ GapInXProjection()
bool tesseract::TableFinder::GapInXProjection |
( |
int * |
xprojection, |
|
|
int |
length |
|
) |
| |
|
protected |
Definition at line 1768 of file tablefind.cpp.
1771 for (
int i = 0; i < length; i++) {
1772 if (xprojection[i] > peak_value) {
1773 peak_value = xprojection[i];
1785 for (
int i = 0; i < length; i++) {
1786 xprojection[i] = (xprojection[i] >= projection_threshold) ? 1 : 0;
1789 int largest_gap = 0;
1791 for (
int i = 1; i < length; i++) {
1793 if (xprojection[i - 1] && !xprojection[i]) {
1797 if (run_start != -1 && !xprojection[i - 1] && xprojection[i]) {
1798 int gap = i - run_start;
1799 if (gap > largest_gap)
◆ GetColumnBlocks()
void tesseract::TableFinder::GetColumnBlocks |
( |
ColPartitionSet ** |
columns, |
|
|
ColSegment_LIST * |
col_segments |
|
) |
| |
|
protected |
Definition at line 523 of file tablefind.cpp.
526 ColPartitionSet* columns = all_columns[i];
527 if (columns !=
nullptr) {
528 ColSegment_LIST new_blocks;
◆ GetTableColumns()
void tesseract::TableFinder::GetTableColumns |
( |
ColSegment_LIST * |
table_columns | ) |
|
|
protected |
Definition at line 1273 of file tablefind.cpp.
1274 ColSegment_IT it(table_columns);
1276 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
1278 gsearch.StartFullSearch();
1280 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
1281 if (part->inside_table_column() || part->type() !=
PT_TABLE)
1283 const TBOX& box = part->bounding_box();
1284 auto* col =
new ColSegment();
1285 col->InsertBox(box);
1286 part->set_inside_table_column(
true);
1290 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
1293 ColPartition* neighbor =
nullptr;
1294 bool found_neighbours =
false;
1295 while ((neighbor = vsearch.NextVerticalSearch(
true)) !=
nullptr) {
1297 if (neighbor->inside_table_column())
1300 if (neighbor->IsHorizontalLine())
1307 const TBOX& neighbor_box = neighbor->bounding_box();
1308 col->InsertBox(neighbor_box);
1309 neighbor->set_inside_table_column(
true);
1310 found_neighbours =
true;
1312 if (found_neighbours) {
1313 it.add_after_then_move(col);
1315 part->set_inside_table_column(
false);
◆ GetTableRegions()
void tesseract::TableFinder::GetTableRegions |
( |
ColSegment_LIST * |
table_columns, |
|
|
ColSegment_LIST * |
table_regions |
|
) |
| |
|
protected |
Definition at line 1323 of file tablefind.cpp.
1325 ColSegment_IT cit(table_columns);
1326 ColSegment_IT rit(table_regions);
1328 GridSearch<ColSegment, ColSegment_CLIST, ColSegment_C_IT>
1330 gsearch.StartFullSearch();
1335 bool* table_region =
new bool[page_height];
1336 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
1337 const TBOX& part_box = part->bounding_box();
1339 for (
int i = 0; i < page_height; i++) {
1340 table_region[i] =
false;
1344 cit.move_to_first();
1345 for (cit.mark_cycle_pt(); !cit.cycled_list(); cit.forward()) {
1346 TBOX col_box = cit.data()->bounding_box();
1350 for (
int i = intersection_box.
bottom(); i < intersection_box.
top(); i++) {
1351 table_region[i -
bleft().
y()] =
true;
1355 TBOX current_table_box;
1360 for (
int i = 1; i < page_height; i++) {
1362 if (!table_region[i - 1] && table_region[i]) {
1367 if (table_region[i - 1] && !table_region[i]) {
1369 if (!current_table_box.
null_box()) {
1370 auto* seg =
new ColSegment();
1371 seg->InsertBox(current_table_box);
1372 rit.add_after_then_move(seg);
1377 delete[] table_region;
◆ gridheight()
int tesseract::TableFinder::gridheight |
( |
| ) |
const |
|
protected |
◆ GridMergeColumnBlocks()
void tesseract::TableFinder::GridMergeColumnBlocks |
( |
| ) |
|
|
protected |
Definition at line 1195 of file tablefind.cpp.
1199 GridSearch<ColSegment, ColSegment_CLIST, ColSegment_C_IT>
1201 gsearch.StartFullSearch();
1203 while ((seg = gsearch.NextFullSearch()) !=
nullptr) {
1206 bool neighbor_found =
false;
1207 bool modified =
false;
1211 TBOX box = seg->bounding_box();
1213 int top_range = std::min(box.
top() + margin, static_cast<int>(
tright().y()));
1214 int bottom_range = std::max(box.
bottom() - margin, static_cast<int>(
bleft().y()));
1217 neighbor_found =
false;
1218 GridSearch<ColSegment, ColSegment_CLIST, ColSegment_C_IT>
1220 rectsearch.StartRectSearch(box);
1221 ColSegment* neighbor =
nullptr;
1222 while ((neighbor = rectsearch.NextRectSearch()) !=
nullptr) {
1223 if (neighbor == seg)
1225 const TBOX& neighbor_box = neighbor->bounding_box();
1231 seg->InsertBox(neighbor_box);
1233 rectsearch.RemoveBBox();
1234 gsearch.RepositionIterator();
1244 seg->InsertBox(neighbor_box);
1245 neighbor_found =
true;
1247 rectsearch.RemoveBBox();
1248 gsearch.RepositionIterator();
1252 }
while (neighbor_found);
1255 gsearch.RemoveBBox();
1257 gsearch.RepositionIterator();
◆ GridMergeTableRegions()
void tesseract::TableFinder::GridMergeTableRegions |
( |
| ) |
|
|
protected |
Definition at line 1386 of file tablefind.cpp.
1388 GridSearch<ColSegment, ColSegment_CLIST, ColSegment_C_IT>
1390 gsearch.StartFullSearch();
1391 ColSegment* seg =
nullptr;
1392 while ((seg = gsearch.NextFullSearch()) !=
nullptr) {
1393 bool neighbor_found =
false;
1394 bool modified =
false;
1397 const TBOX& box = seg->bounding_box();
1398 TBOX search_region(box);
1399 search_region.set_left(
bleft().x());
1400 search_region.set_right(
tright().x());
1401 neighbor_found =
false;
1402 GridSearch<ColSegment, ColSegment_CLIST, ColSegment_C_IT>
1404 rectsearch.StartRectSearch(search_region);
1405 ColSegment* neighbor =
nullptr;
1406 while ((neighbor = rectsearch.NextRectSearch()) !=
nullptr) {
1407 if (neighbor == seg)
1409 const TBOX& neighbor_box = neighbor->bounding_box();
1414 seg->InsertBox(neighbor_box);
1415 rectsearch.RemoveBBox();
1416 gsearch.RepositionIterator();
1424 seg->InsertBox(neighbor_box);
1425 neighbor_found =
true;
1427 rectsearch.RemoveBBox();
1428 gsearch.RepositionIterator();
1432 }
while (neighbor_found);
1435 gsearch.RemoveBBox();
1437 gsearch.RepositionIterator();
◆ gridsize()
int tesseract::TableFinder::gridsize |
( |
| ) |
const |
|
protected |
◆ gridwidth()
int tesseract::TableFinder::gridwidth |
( |
| ) |
const |
|
protected |
◆ GroupColumnBlocks()
void tesseract::TableFinder::GroupColumnBlocks |
( |
ColSegment_LIST * |
current_segments, |
|
|
ColSegment_LIST * |
col_segments |
|
) |
| |
|
protected |
Definition at line 538 of file tablefind.cpp.
540 ColSegment_IT src_it(new_blocks);
541 ColSegment_IT dest_it(column_blocks);
543 for (src_it.mark_cycle_pt(); !src_it.cycled_list(); src_it.forward()) {
544 ColSegment* src_seg = src_it.data();
545 const TBOX& src_box = src_seg->bounding_box();
546 bool match_found =
false;
548 for (dest_it.mark_cycle_pt(); !dest_it.cycled_list(); dest_it.forward()) {
549 ColSegment* dest_seg = dest_it.data();
550 TBOX dest_box = dest_seg->bounding_box();
554 dest_seg->InsertBox(src_box);
556 delete src_it.extract();
562 dest_it.add_after_then_move(src_it.extract());
◆ GrowTableBox()
void tesseract::TableFinder::GrowTableBox |
( |
const TBOX & |
table_box, |
|
|
TBOX * |
result_box |
|
) |
| |
|
protected |
◆ GrowTableToIncludeLines()
void tesseract::TableFinder::GrowTableToIncludeLines |
( |
const TBOX & |
table_box, |
|
|
const TBOX & |
search_range, |
|
|
TBOX * |
result_box |
|
) |
| |
|
protected |
Definition at line 1570 of file tablefind.cpp.
1574 rsearch.SetUniqueMode(
true);
1575 rsearch.StartRectSearch(search_range);
1576 ColPartition* part =
nullptr;
1577 while ((part = rsearch.NextRectSearch()) !=
nullptr) {
1581 if (!part->IsLineType())
1585 const TBOX& part_box = part->bounding_box();
1586 if (result_box->
contains(part_box))
◆ GrowTableToIncludePartials()
void tesseract::TableFinder::GrowTableToIncludePartials |
( |
const TBOX & |
table_box, |
|
|
const TBOX & |
search_range, |
|
|
TBOX * |
result_box |
|
) |
| |
|
protected |
Definition at line 1542 of file tablefind.cpp.
1547 for (
int i = 0; i < 2; ++i) {
1551 rectsearch.StartRectSearch(search_range);
1552 ColPartition* part =
nullptr;
1553 while ((part = rectsearch.NextRectSearch()) !=
nullptr) {
1555 if (part->IsImageType())
1557 const TBOX& part_box = part->bounding_box();
◆ HasLeaderAdjacent()
bool tesseract::TableFinder::HasLeaderAdjacent |
( |
const ColPartition & |
part | ) |
|
|
protected |
Definition at line 946 of file tablefind.cpp.
953 const TBOX& box = part.bounding_box();
955 const int top = box.
top() + search_size;
956 const int bottom = box.
bottom() - search_size;
958 for (
int direction = 0; direction < 2; ++direction) {
959 bool right_to_left = (direction == 0);
960 int x = right_to_left ? box.
right() : box.
left();
961 hsearch.StartSideSearch(x, bottom, top);
962 ColPartition* leader =
nullptr;
963 while ((leader = hsearch.NextSideSearch(right_to_left)) !=
nullptr) {
972 if (!part.IsInSameColumnAs(*leader))
975 if (!leader->VSignificantCoreOverlap(part))
◆ HasWideOrNoInterWordGap()
bool tesseract::TableFinder::HasWideOrNoInterWordGap |
( |
ColPartition * |
part | ) |
const |
|
protected |
Definition at line 857 of file tablefind.cpp.
861 BLOBNBOX_CLIST* part_boxes = part->boxes();
862 BLOBNBOX_C_IT it(part_boxes);
864 if (part->bounding_box().width() <
872 int previous_x1 = -1;
874 int largest_partition_gap_found = -1;
881 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
885 if (previous_x1 != -1) {
886 int gap = current_x0 - previous_x1;
898 previous_x1 = std::max(previous_x1, current_x1);
912 if (gap > largest_partition_gap_found)
913 largest_partition_gap_found = gap;
915 previous_x1 = current_x1;
919 if (part->bounding_box().width() >
929 if (largest_partition_gap_found == -1)
935 return largest_partition_gap_found < min_gap;
◆ HLineBelongsToTable()
bool tesseract::TableFinder::HLineBelongsToTable |
( |
const ColPartition & |
part, |
|
|
const TBOX & |
table_box |
|
) |
| |
|
protected |
Definition at line 1600 of file tablefind.cpp.
1602 if (!part.IsHorizontalLine())
1604 const TBOX& part_box = part.bounding_box();
1619 int num_extra_partitions = 0;
1620 int extra_space_to_right = 0;
1621 int extra_space_to_left = 0;
1624 for (
int i = 0; i < 2; ++i) {
1629 rectsearch.SetUniqueMode(
true);
1630 rectsearch.StartRectSearch(bbox);
1631 ColPartition* extra_part =
nullptr;
1632 while ((extra_part = rectsearch.NextRectSearch()) !=
nullptr) {
1634 const TBOX& extra_part_box = extra_part->bounding_box();
1638 if (extra_part->IsImageType())
1641 num_extra_partitions++;
1644 if (extra_part->type() ==
PT_TABLE || extra_part->IsLineType()) {
1645 extra_space_to_right++;
1646 extra_space_to_left++;
1650 if (extra_part->space_to_right() > space_threshold)
1651 extra_space_to_right++;
1652 if (extra_part->space_to_left() > space_threshold)
1653 extra_space_to_left++;
1658 return (extra_space_to_right > num_extra_partitions / 2) ||
1659 (extra_space_to_left > num_extra_partitions / 2);
◆ IncludeLeftOutColumnHeaders()
void tesseract::TableFinder::IncludeLeftOutColumnHeaders |
( |
TBOX * |
table_box | ) |
|
|
protected |
Definition at line 1664 of file tablefind.cpp.
1667 vsearch.StartVerticalSearch(table_box->
left(), table_box->
right(),
1669 ColPartition* neighbor =
nullptr;
1670 ColPartition* previous_neighbor =
nullptr;
1671 while ((neighbor = vsearch.NextVerticalSearch(
false)) !=
nullptr) {
1674 neighbor->median_height();
1675 int table_top = table_box->
top();
1676 const TBOX& box = neighbor->bounding_box();
1678 if (box.
bottom() - table_top > max_distance)
1682 if (neighbor->type() ==
PT_TABLE || neighbor->IsLineType()) {
1684 previous_neighbor =
nullptr;
1689 if (previous_neighbor ==
nullptr) {
1690 previous_neighbor = neighbor;
1692 const TBOX& previous_box = previous_neighbor->bounding_box();
◆ Init()
void tesseract::TableFinder::Init |
( |
int |
grid_size, |
|
|
const ICOORD & |
bottom_left, |
|
|
const ICOORD & |
top_right |
|
) |
| |
◆ InitializePartitions()
void tesseract::TableFinder::InitializePartitions |
( |
ColPartitionSet ** |
all_columns | ) |
|
|
protected |
◆ InsertCleanPartitions()
Definition at line 193 of file tablefind.cpp.
201 gsearch.SetUniqueMode(
true);
202 gsearch.StartFullSearch();
203 ColPartition* part =
nullptr;
204 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
206 if (part->blob_type() ==
BRT_NOISE || part->bounding_box().area() <= 0)
208 ColPartition* clean_part = part->ShallowCopy();
209 ColPartition* leader_part =
nullptr;
210 if (part->IsLineType()) {
215 if (!part->IsTextType()) {
221 BLOBNBOX_CLIST* part_boxes = part->boxes();
222 BLOBNBOX_C_IT pit(part_boxes);
223 for (pit.mark_cycle_pt(); !pit.cycled_list(); pit.forward()) {
230 if (leader_part ==
nullptr) {
231 leader_part = part->ShallowCopy();
234 leader_part->AddBox(pblob);
236 clean_part->AddBox(pblob);
239 clean_part->ComputeLimits();
240 ColPartition* fragmented = clean_part->CopyButDontOwnBlobs();
243 if (leader_part !=
nullptr) {
248 leader_part->ComputeLimits();
◆ InsertFragmentedTextPartition()
void tesseract::TableFinder::InsertFragmentedTextPartition |
( |
ColPartition * |
part | ) |
|
|
protected |
◆ InsertImagePartition()
void tesseract::TableFinder::InsertImagePartition |
( |
ColPartition * |
part | ) |
|
|
protected |
◆ InsertLeaderPartition()
void tesseract::TableFinder::InsertLeaderPartition |
( |
ColPartition * |
part | ) |
|
|
protected |
Definition at line 410 of file tablefind.cpp.
412 if (!part->IsEmpty() && part->bounding_box().area() > 0) {
◆ InsertRulingPartition()
void tesseract::TableFinder::InsertRulingPartition |
( |
ColPartition * |
part | ) |
|
|
protected |
◆ InsertTextPartition()
void tesseract::TableFinder::InsertTextPartition |
( |
ColPartition * |
part | ) |
|
|
protected |
◆ LocateTables()
Definition at line 259 of file tablefind.cpp.
266 #ifndef GRAPHICS_DISABLED
267 if (textord_show_tables) {
275 table_win =
MakeWindow(100, 300,
"Fragmented Text");
278 #endif // GRAPHICS_DISABLED
285 ColSegment_LIST column_blocks;
299 ColSegment_LIST table_columns;
305 ColSegment_LIST table_regions;
308 #ifndef GRAPHICS_DISABLED
309 if (textord_tablefind_show_mark) {
314 #endif // GRAPHICS_DISABLED
326 if (textord_tablefind_recognize_tables) {
330 #ifndef GRAPHICS_DISABLED
331 if (textord_show_tables) {
337 #endif // GRAPHICS_DISABLED
344 #ifndef GRAPHICS_DISABLED
345 if (textord_show_tables) {
351 #endif // GRAPHICS_DISABLED
359 #ifndef GRAPHICS_DISABLED
360 if (textord_show_tables) {
366 #endif // GRAPHICS_DISABLED
◆ MakeTableBlocks()
Definition at line 1997 of file tablefind.cpp.
2002 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
2004 gsearch.StartFullSearch();
2005 ColPartition* part =
nullptr;
2007 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
2009 part->clear_table_type();
2014 GridSearch<ColSegment, ColSegment_CLIST, ColSegment_C_IT>
2016 table_search.StartFullSearch();
2018 while ((table = table_search.NextFullSearch()) !=
nullptr) {
2019 const TBOX& table_box = table->bounding_box();
2021 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
2023 rectsearch.StartRectSearch(table_box);
2025 ColPartition* table_partition =
nullptr;
2026 while ((part = rectsearch.NextRectSearch()) !=
nullptr) {
2028 if (!part->IsTextType())
2030 TBOX part_box = part->bounding_box();
2034 rectsearch.RemoveBBox();
2035 if (table_partition) {
2036 table_partition->Absorb(part, width_cb);
2038 table_partition = part;
2043 if (table_partition) {
2047 const TBOX& table_box = table_partition->bounding_box();
2049 grid->GridCoords(table_box.
left(), table_box.
bottom(), &grid_x, &grid_y);
2050 table_partition->SetPartitionType(
resolution_, all_columns[grid_y]);
2051 table_partition->set_table_type();
2052 table_partition->set_blob_type(
BRT_TEXT);
2054 table_partition->SetBlobTypes();
2055 grid->InsertBBox(
true,
true, table_partition);
◆ MakeWindow()
ScrollView * tesseract::TableFinder::MakeWindow |
( |
int |
x, |
|
|
int |
y, |
|
|
const char * |
window_name |
|
) |
| |
|
protected |
◆ MarkPartitionsUsingLocalInformation()
void tesseract::TableFinder::MarkPartitionsUsingLocalInformation |
( |
| ) |
|
|
protected |
Definition at line 827 of file tablefind.cpp.
829 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
831 gsearch.StartFullSearch();
832 ColPartition* part =
nullptr;
833 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
834 if (!part->IsTextType())
850 part->set_table_type();
◆ MarkTablePartitions()
void tesseract::TableFinder::MarkTablePartitions |
( |
| ) |
|
|
protected |
Definition at line 789 of file tablefind.cpp.
791 if (textord_tablefind_show_mark) {
798 if (textord_tablefind_show_mark) {
805 if (textord_tablefind_show_mark) {
812 if (textord_tablefind_show_mark || textord_show_tables) {
◆ MoveColSegmentsToGrid()
void tesseract::TableFinder::MoveColSegmentsToGrid |
( |
ColSegment_LIST * |
segments, |
|
|
ColSegmentGrid * |
col_seg_grid |
|
) |
| |
|
protected |
Definition at line 1176 of file tablefind.cpp.
1178 ColSegment_IT it(segments);
1179 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
1180 ColSegment* seg = it.extract();
1181 col_seg_grid->InsertBBox(
true,
true, seg);
◆ RecognizeTables()
void tesseract::TableFinder::RecognizeTables |
( |
| ) |
|
|
protected |
Definition at line 1817 of file tablefind.cpp.
1819 if (textord_show_tables) {
1820 table_win =
MakeWindow(0, 0,
"Table Structure");
1827 TableRecognizer recognizer;
1832 recognizer.set_min_height(1.5 *
gridheight());
1835 ColSegment_CLIST good_tables;
1836 ColSegment_C_IT good_it(&good_tables);
1839 gsearch.StartFullSearch();
1840 ColSegment* found_table =
nullptr;
1841 while ((found_table = gsearch.NextFullSearch()) !=
nullptr) {
1842 gsearch.RemoveBBox();
1846 const TBOX& found_box = found_table->bounding_box();
1847 StructuredTable* table_structure = recognizer.RecognizeTable(found_box);
1851 if (table_structure !=
nullptr) {
1852 if (textord_show_tables) {
1855 found_table->set_bounding_box(table_structure->bounding_box());
1856 delete table_structure;
1857 good_it.add_after_then_move(found_table);
1866 for (good_it.mark_cycle_pt(); !good_it.cycled_list(); good_it.forward())
◆ set_global_median_blob_width()
void tesseract::TableFinder::set_global_median_blob_width |
( |
int |
width | ) |
|
|
protected |
◆ set_global_median_ledding()
void tesseract::TableFinder::set_global_median_ledding |
( |
int |
ledding | ) |
|
|
protected |
◆ set_global_median_xheight()
void tesseract::TableFinder::set_global_median_xheight |
( |
int |
xheight | ) |
|
|
protected |
◆ set_left_to_right_language()
void tesseract::TableFinder::set_left_to_right_language |
( |
bool |
order | ) |
|
◆ set_resolution()
void tesseract::TableFinder::set_resolution |
( |
int |
resolution | ) |
|
|
inline |
◆ SetColumnsType()
void tesseract::TableFinder::SetColumnsType |
( |
ColSegment_LIST * |
col_segments | ) |
|
|
protected |
Definition at line 1143 of file tablefind.cpp.
1144 ColSegment_IT it(column_blocks);
1145 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
1146 ColSegment* seg = it.data();
1147 TBOX box = seg->bounding_box();
1148 int num_table_cells = 0;
1149 int num_text_cells = 0;
1150 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
1152 rsearch.SetUniqueMode(
true);
1153 rsearch.StartRectSearch(box);
1154 ColPartition* part =
nullptr;
1155 while ((part = rsearch.NextRectSearch()) !=
nullptr) {
1164 if (!num_table_cells && !num_text_cells) {
1165 delete it.extract();
1167 seg->set_num_table_cells(num_table_cells);
1168 seg->set_num_text_cells(num_text_cells);
◆ SetGlobalSpacings()
Definition at line 709 of file tablefind.cpp.
715 gsearch.SetUniqueMode(
true);
716 gsearch.StartFullSearch();
717 ColPartition* part =
nullptr;
718 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
725 if (part->IsTextType()) {
731 BLOBNBOX_C_IT it(part->boxes());
732 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
733 xheight_stats.add(it.data()->bounding_box().height(), 1);
734 width_stats.add(it.data()->bounding_box().width(), 1);
737 ledding_stats.add(part->space_above(), 1);
738 ledding_stats.add(part->space_below(), 1);
745 #ifndef GRAPHICS_DISABLED
746 if (textord_tablefind_show_stats) {
747 const char* kWindowName =
"X-height (R), X-width (G), and ledding (B)";
753 #endif // GRAPHICS_DISABLED
◆ SetPartitionSpacings()
Definition at line 586 of file tablefind.cpp.
590 gsearch.StartFullSearch();
591 ColPartition* part =
nullptr;
592 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
593 ColPartitionSet* columns = all_columns[gsearch.GridY()];
594 TBOX box = part->bounding_box();
595 int y = part->MidY();
596 ColPartition* left_column = columns->ColumnContaining(box.
left(), y);
597 ColPartition* right_column = columns->ColumnContaining(box.
right(), y);
600 int left_space = std::max(0, box.
left() - left_column->LeftAtY(y));
601 part->set_space_to_left(left_space);
605 int right_space = std::max(0, right_column->RightAtY(y) - box.
right());
606 part->set_space_to_right(right_space);
612 hsearch.StartSideSearch(box.
left(), box.
bottom(), box.
top());
613 ColPartition* neighbor =
nullptr;
614 while ((neighbor = hsearch.NextSideSearch(
true)) !=
nullptr) {
618 int right = neighbor->bounding_box().right();
619 if (right < box.
left()) {
620 int space = std::min(box.
left() - right, part->space_to_left());
621 part->set_space_to_left(space);
625 hsearch.StartSideSearch(box.
left(), box.
bottom(), box.
top());
627 while ((neighbor = hsearch.NextSideSearch(
false)) !=
nullptr) {
631 int left = neighbor->bounding_box().left();
632 if (left > box.
right()) {
633 int space = std::min(left - box.
right(), part->space_to_right());
634 part->set_space_to_right(space);
639 ColPartition* upper_part = part->SingletonPartner(
true);
641 int space = std::max(0, static_cast<int>(upper_part->bounding_box().bottom() -
642 part->bounding_box().bottom()));
643 part->set_space_above(space);
648 part->set_space_above(INT32_MAX);
651 ColPartition* lower_part = part->SingletonPartner(
false);
653 int space = std::max(0, static_cast<int>(part->bounding_box().bottom() -
654 lower_part->bounding_box().bottom()));
655 part->set_space_below(space);
660 part->set_space_below(INT32_MAX);
◆ SetVerticalSpacing()
void tesseract::TableFinder::SetVerticalSpacing |
( |
ColPartition * |
part | ) |
|
|
protected |
Definition at line 666 of file tablefind.cpp.
667 TBOX box = part->bounding_box();
673 TBOX part_box = part->bounding_box();
675 GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT>
677 rectsearch.StartRectSearch(box);
678 ColPartition* neighbor;
681 ColPartition* above_neighbor =
nullptr;
682 ColPartition* below_neighbor =
nullptr;
683 while ((neighbor = rectsearch.NextRectSearch()) !=
nullptr) {
684 if (neighbor == part)
686 TBOX neighbor_box = neighbor->bounding_box();
688 int gap = abs(part->median_bottom() - neighbor->median_bottom());
690 if (neighbor_box.
top() < part_box.
bottom() &&
691 gap < min_space_below) {
692 min_space_below = gap;
693 below_neighbor = neighbor;
695 else if (part_box.
top() < neighbor_box.
bottom() &&
696 gap < min_space_above) {
697 min_space_above = gap;
698 above_neighbor = neighbor;
702 part->set_space_above(min_space_above);
703 part->set_space_below(min_space_below);
704 part->set_nearest_neighbor_above(above_neighbor);
705 part->set_nearest_neighbor_below(below_neighbor);
◆ SmoothTablePartitionRuns()
void tesseract::TableFinder::SmoothTablePartitionRuns |
( |
| ) |
|
|
protected |
Definition at line 1108 of file tablefind.cpp.
1111 gsearch.StartFullSearch();
1112 ColPartition* part =
nullptr;
1113 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
1116 ColPartition* upper_part = part->nearest_neighbor_above();
1117 ColPartition* lower_part = part->nearest_neighbor_below();
1118 if (!upper_part || !lower_part)
1121 part->set_table_type();
1126 gsearch.StartFullSearch();
1128 while ((part = gsearch.NextFullSearch()) !=
nullptr) {
1131 ColPartition* upper_part = part->nearest_neighbor_above();
1132 ColPartition* lower_part = part->nearest_neighbor_below();
1135 if ((upper_part && upper_part->type() !=
PT_TABLE) &&
1136 (lower_part && lower_part->type() !=
PT_TABLE)) {
1137 part->clear_table_type();
◆ SplitAndInsertFragmentedTextPartition()
void tesseract::TableFinder::SplitAndInsertFragmentedTextPartition |
( |
ColPartition * |
part | ) |
|
|
protected |
Definition at line 436 of file tablefind.cpp.
439 if (part->boxes()->empty()) {
448 ColPartition* right_part = part;
449 bool found_split =
true;
450 while (found_split) {
452 BLOBNBOX_C_IT box_it(right_part->boxes());
457 int previous_right = INT32_MIN;
460 for (box_it.mark_cycle_pt(); !box_it.cycled_list(); box_it.forward()) {
461 const TBOX& box = box_it.data()->bounding_box();
462 if (previous_right != INT32_MIN &&
463 box.
left() - previous_right > kThreshold) {
466 int mid_x = (box.
left() + previous_right) / 2;
467 ColPartition* left_part = right_part;
468 right_part = left_part->SplitAt(mid_x);
476 previous_right = std::max(previous_right, static_cast<int>(box.
right()));
◆ tright()
const ICOORD & tesseract::TableFinder::tright |
( |
| ) |
const |
|
protected |
◆ clean_part_grid_
◆ col_seg_grid_
◆ fragmented_text_grid_
◆ global_median_blob_width_
int tesseract::TableFinder::global_median_blob_width_ |
|
protected |
◆ global_median_ledding_
int tesseract::TableFinder::global_median_ledding_ |
|
protected |
◆ global_median_xheight_
int tesseract::TableFinder::global_median_xheight_ |
|
protected |
◆ leader_and_ruling_grid_
◆ left_to_right_language_
bool tesseract::TableFinder::left_to_right_language_ |
|
protected |
◆ resolution_
int tesseract::TableFinder::resolution_ |
|
protected |
◆ table_grid_
The documentation for this class was generated from the following files:
void InsertImagePartition(ColPartition *part)
GridSearch< ColSegment, ColSegment_CLIST, ColSegment_C_IT > ColSegmentGridSearch
void FilterHeaderAndFooter()
void GroupColumnBlocks(ColSegment_LIST *current_segments, ColSegment_LIST *col_segments)
const int kLargeTableRowCount
void set_global_median_xheight(int xheight)
const double kStrokeWidthFractionalTolerance
void InsertFragmentedTextPartition(ColPartition *part)
TBOX intersection(const TBOX &box) const
bool left_to_right_language_
ColSegmentGrid table_grid_
void GridMergeColumnBlocks()
void InsertBBox(bool h_spread, bool v_spread, BBC *bbox)
ScrollView * MakeWindow(int x, int y, const char *window_name)
const double kMaxXProjectionGapFactor
const int kMinRowsInTable
const int kMaxVerticalSpacing
void set_global_median_ledding(int ledding)
const double kLargeTableProjectionThreshold
bool AllowBlob(const BLOBNBOX &blob) const
bool overlap(const TBOX &box) const
void set_flow(BlobTextFlowType value)
void DisplayColPartitionConnections(ScrollView *win, ColPartitionGrid *grid, ScrollView::Color default_color)
bool contains(const FCOORD pt) const
const int kMinBoxesInTextPartition
TBOX bounding_union(const TBOX &box) const
void set_global_median_blob_width(int width)
void DisplayColSegments(ScrollView *win, ColSegment_LIST *cols, ScrollView::Color color)
bool HasLeaderAdjacent(const ColPartition &part)
void AdjustTableBoundaries()
bool ConsecutiveBoxes(const TBOX &b1, const TBOX &b2)
const int kMaxBoxesInDataPartition
bool major_y_overlap(const TBOX &box) const
void InsertLeaderPartition(ColPartition *part)
const double kMinParagraphEndingTextToWhitespaceRatio
const double kMaxGapInTextPartition
GridSearch< ColPartition, ColPartition_CLIST, ColPartition_C_IT > ColPartitionGridSearch
void SplitAndInsertFragmentedTextPartition(ColPartition *part)
int16_t x() const
access function
const ICOORD & bleft() const
void IncludeLeftOutColumnHeaders(TBOX *table_box)
const double kMaxBlobOverlapFactor
const ICOORD & tright() const
bool AllowTextPartition(const ColPartition &part) const
const double kAllowBlobArea
const ICOORD & tright() const
void FilterParagraphEndings()
void RefinePartitionPartners(bool get_desperate)
ColPartitionGrid leader_and_ruling_grid_
const double kMinMaxGapInTextPartition
void GrowTableToIncludePartials(const TBOX &table_box, const TBOX &search_range, TBOX *result_box)
bool major_x_overlap(const TBOX &box) const
void InsertRulingPartition(ColPartition *part)
const int kSideSpaceMargin
void MarkPartitionsUsingLocalInformation()
ColPartitionGrid clean_part_grid_
const double kAllowTextHeight
void GetTableColumns(ColSegment_LIST *table_columns)
void DeleteSingleColumnTables()
bool HasWideOrNoInterWordGap(ColPartition *part) const
const int kMaxColumnHeaderDistance
const double kMaxParagraphEndingLeftSpaceMultiple
const double kMinOverlapWithTable
void GridMergeTableRegions()
void GrowTableBox(const TBOX &table_box, TBOX *result_box)
void GrowTableToIncludeLines(const TBOX &table_box, const TBOX &search_range, TBOX *result_box)
ColSegmentGrid col_seg_grid_
double overlap_fraction(const TBOX &box) const
const TBOX & bounding_box() const
bool HLineBelongsToTable(const ColPartition &part, const TBOX &table_box)
void SetColumnsType(ColSegment_LIST *col_segments)
int global_median_blob_width_
const double kSplitPartitionSize
void ClearGridData(void(*free_method)(BBC *))
void MarkTablePartitions()
void DisplayBoxes(ScrollView *window)
void FindPartitionPartners()
void Init(int gridsize, const ICOORD &bleft, const ICOORD &tright)
void SmoothTablePartitionRuns()
void DisplayColPartitions(ScrollView *win, ColPartitionGrid *grid, ScrollView::Color text_color, ScrollView::Color table_color)
BlobTextFlowType flow() const
static void SetPartitionSpacings(ColPartitionGrid *grid, ColPartitionSet **all_columns)
const double kSmallTableProjectionThreshold
void SetGlobalSpacings(ColPartitionGrid *grid)
int global_median_ledding_
const double kAllowBlobWidth
const double kMaxTableCellXheight
int global_median_xheight_
const int kAdjacentLeaderSearchPadding
BlobRegionType region_type() const
const double kAllowBlobHeight
ColPartitionGrid fragmented_text_grid_
void InsertTextPartition(ColPartition *part)
void Line(int x1, int y1, int x2, int y2)
const double kStrokeWidthConstantTolerance
const double kAllowTextArea
void MoveColSegmentsToGrid(ColSegment_LIST *segments, ColSegmentGrid *col_seg_grid)
ScrollView * MakeWindow(int x, int y, const char *window_name)
bool BelongToOneTable(const TBOX &box1, const TBOX &box2)
bool GapInXProjection(int *xprojection, int length)
void MakeTableBlocks(ColPartitionGrid *grid, ColPartitionSet **columns, WidthCallback width_cb)
void Rectangle(int x1, int y1, int x2, int y2)
void InitializePartitions(ColPartitionSet **all_columns)
void GetTableRegions(ColSegment_LIST *table_columns, ColSegment_LIST *table_regions)
void GetColumnBlocks(ColPartitionSet **columns, ColSegment_LIST *col_segments)
const double kAllowTextWidth
const ICOORD & bleft() const
int16_t y() const
access_function
const double kParagraphEndingPreviousLineRatio