Skip to content

Commit

Permalink
Partially revert "Merge pull request tesseract-ocr#3330 from Sintun/m…
Browse files Browse the repository at this point in the history
…aster"

This partially reverts commit 122daf1,
reversing changes made to 4cd56dc.

This fixes a fatal assertion for certain images:

    cell_y_.size() >= 2 && cell_x_.size() >= 2:Error:Assert failed:in file ../../../src/textord/tablerecog.cpp, line 363

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Jul 15, 2021
1 parent a71edc9 commit ffea0f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/textord/colfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
#include "scrollview.h"
#include "strokewidth.h"
#include "tablefind.h"
#include "workingpartset.h"
#include "tabletransfer.h"
#include "workingpartset.h"

#include <algorithm>

Expand Down
10 changes: 6 additions & 4 deletions src/textord/tablefind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,7 @@ void TableFinder::MakeTableBlocks(ColPartitionGrid *grid, ColPartitionSet **all_
ScrollView::BLUE, ScrollView::LIGHT_BLUE);
}
#endif // GRAPHICS_DISABLED

// initializing recognizer in order to extract table row and columnd info
TableRecognizer recognizer;
{
Expand All @@ -2013,7 +2013,7 @@ void TableFinder::MakeTableBlocks(ColPartitionGrid *grid, ColPartitionSet **all_
recognizer.set_max_text_height(global_median_xheight_ * 2.0);
recognizer.set_min_height(1.5 * gridheight());
}

// Since we have table blocks already, remove table tags from all
// colpartitions
GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(grid);
Expand Down Expand Up @@ -2068,7 +2068,8 @@ void TableFinder::MakeTableBlocks(ColPartitionGrid *grid, ColPartitionSet **all_
table_partition->set_flow(BTFT_CHAIN);
table_partition->SetBlobTypes();
grid->InsertBBox(true, true, table_partition);


#if 0 // This code triggers an assertion.
// Insert table columns and rows into an api accessible object
StructuredTable* table_structure = recognizer.RecognizeTable(table_box);
if (table_structure != nullptr) {
Expand All @@ -2084,9 +2085,10 @@ void TableFinder::MakeTableBlocks(ColPartitionGrid *grid, ColPartitionSet **all_

delete table_structure;
}
#endif
}
}

#ifndef GRAPHICS_DISABLED
if (textord_show_tables) {
table_grid_.DisplayBoxes(table_win);
Expand Down

0 comments on commit ffea0f2

Please sign in to comment.