21 #pragma warning(disable:4244) // Conversion warnings
59 static int SortCPByTopReverse(
const void* p1,
const void* p2) {
60 const ColPartition* cp1 = *
reinterpret_cast<ColPartition* const*
>(p1);
61 const ColPartition* cp2 = *
reinterpret_cast<ColPartition* const*
>(p2);
63 const TBOX &box1(cp1->bounding_box()), &box2(cp2->bounding_box());
64 return box2.
top() - box1.top();
67 static int SortCPByBottom(
const void* p1,
const void* p2) {
68 const ColPartition* cp1 = *
reinterpret_cast<ColPartition* const*
>(p1);
69 const ColPartition* cp2 = *
reinterpret_cast<ColPartition* const*
>(p2);
71 const TBOX &box1(cp1->bounding_box()), &box2(cp2->bounding_box());
72 return box1.
bottom() - box2.bottom();
75 static int SortCPByHeight(
const void* p1,
const void* p2) {
76 const ColPartition* cp1 = *
reinterpret_cast<ColPartition* const*
>(p1);
77 const ColPartition* cp2 = *
reinterpret_cast<ColPartition* const*
>(p2);
79 const TBOX &box1(cp1->bounding_box()), &box2(cp2->bounding_box());
80 return box1.
height() - box2.height();
107 const char* equ_name) {
108 const char* default_name =
"equ";
109 if (equ_name == NULL) {
110 equ_name = default_name;
120 tprintf(
"Warning: equation region detection requested,"
121 " but %s failed to load from %s\n", equ_name, equ_datapath);
147 if (to_block == NULL) {
148 tprintf(
"Warning: input to_block is NULL!\n");
155 for (
int i = 0; i < blob_lists.
size(); ++i) {
156 BLOBNBOX_IT bbox_it(blob_lists[i]);
157 for (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list();
159 bbox_it.data()->set_special_text_type(
BSTT_NONE);
167 BLOBNBOX *blobnbox,
const int height_th) {
175 BLOB_CHOICE_LIST ratings_equ, ratings_lang;
185 float x_orig = (box.
left() + box.
right()) / 2.0f, y_orig = box.
bottom();
187 normed_blob->
Normalize(NULL, NULL, NULL, x_orig, y_orig, scaling, scaling,
198 BLOB_CHOICE *lang_choice = NULL, *equ_choice = NULL;
199 if (ratings_lang.length() > 0) {
200 BLOB_CHOICE_IT choice_it(&ratings_lang);
201 lang_choice = choice_it.data();
203 if (ratings_equ.length() > 0) {
204 BLOB_CHOICE_IT choice_it(&ratings_equ);
205 equ_choice = choice_it.data();
208 float lang_score = lang_choice ? lang_choice->
certainty() : -FLT_MAX;
209 float equ_score = equ_choice ? equ_choice->certainty() : -FLT_MAX;
211 const float kConfScoreTh = -5.0f, kConfDiffTh = 1.8;
214 float diff = fabs(lang_score - equ_score);
218 if (fmax(lang_score, equ_score) < kConfScoreTh) {
221 }
else if (diff > kConfDiffTh && equ_score > lang_score) {
225 }
else if (lang_choice) {
250 if (ids_to_exclude.
empty()) {
251 static const STRING kCharsToEx[] = {
"'",
"`",
"\"",
"\\",
",",
".",
252 "〈",
"〉",
"《",
"》",
"」",
"「",
""};
254 while (kCharsToEx[i] !=
"") {
258 ids_to_exclude.
sort();
265 static const STRING kDigitsChars =
"|";
281 int classify_integer_matcher =
294 BLOBNBOX_C_IT bbox_it(part->
boxes());
297 for (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list();
299 if (bbox_it.data()->special_text_type() !=
BSTT_SKIP) {
300 blob_heights.
push_back(bbox_it.data()->bounding_box().height());
304 int height_th = blob_heights[blob_heights.size() / 2] / 3 * 2;
305 for (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list();
307 if (bbox_it.data()->special_text_type() !=
BSTT_SKIP) {
315 classify_class_pruner);
317 classify_integer_matcher);
328 BLOBNBOX_C_IT blob_it(part->
boxes());
330 for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
334 for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
343 BLOBNBOX_C_IT blob_it2 = blob_it;
345 while (!blob_it2.at_last()) {
346 BLOBNBOX* nextblob = blob_it2.forward();
348 if (nextblob_box.
left() >= blob_box.
right()) {
351 const float kWidthR = 0.4, kHeightR = 0.3;
353 yoverlap = blob_box.
y_overlap(nextblob_box);
354 float widthR =
static_cast<float>(
357 float heightR =
static_cast<float>(
361 if (xoverlap && yoverlap && widthR > kWidthR && heightR > kHeightR) {
365 blob_box += nextblob_box;
377 tprintf(
"Warning: equ_tesseract_/lang_tesseract_ is NULL!\n");
380 if (!part_grid || !best_columns) {
381 tprintf(
"part_grid/best_columns is NULL!!\n");
415 for (
int i = 0; i <
cp_seeds_.size(); ++i) {
423 for (
int i = 0; i < seeds_expanded.
size(); ++i) {
453 if (parts_to_merge.
empty()) {
459 for (
int i = 0; i < parts_to_merge.
size(); ++i) {
460 ASSERT_HOST(parts_to_merge[i] != NULL && parts_to_merge[i] != part);
461 part->
Absorb(parts_to_merge[i], NULL);
468 if (parts_updated.
empty()) {
473 for (
int i = 0; i < parts_updated.
size(); ++i) {
482 ASSERT_HOST(seed != NULL && parts_overlap != NULL);
488 const int kRadNeighborCells = 30;
490 (seed_box.top() + seed_box.bottom()) / 2,
497 const float kLargeOverlapTh = 0.95;
498 const float kEquXOverlap = 0.4, kEquYOverlap = 0.5;
507 y_overlap_fraction = part_box.y_overlap_fraction(seed_box);
510 if (x_overlap_fraction >= kLargeOverlapTh &&
511 y_overlap_fraction >= kLargeOverlapTh) {
515 if ((x_overlap_fraction > kEquXOverlap && y_overlap_fraction > 0.0) ||
516 (x_overlap_fraction > 0.0 && y_overlap_fraction > kEquYOverlap)) {
542 part_box.left(), part_box.bottom(), &grid_x, &grid_y);
571 const int kTextBlobsTh = 20;
596 indented_texts_left.
sort();
597 texts_foreground_density.
sort();
598 float foreground_density_th = 0.15;
599 if (!texts_foreground_density.
empty()) {
601 foreground_density_th = 0.8 * texts_foreground_density[
602 texts_foreground_density.
size() / 2];
605 for (
int i = 0; i < seeds1.
size(); ++i) {
606 const TBOX& box = seeds1[i]->bounding_box();
619 for (
int i = 0; i < seeds2.
size(); ++i) {
620 if (
CheckForSeed2(indented_texts_left, foreground_density_th, seeds2[i])) {
628 #if LIBLEPT_MINOR_VERSION < 69 && LIBLEPT_MAJOR_VERSION <= 1
633 int pix_height = pixGetHeight(pix_bi);
634 Box* box = boxCreate(tbox.
left(), pix_height - tbox.
top(),
636 Pix *pix_sub = pixClipRectangle(pix_bi, box, NULL);
638 pixForegroundFraction(pix_sub, &fract);
639 pixDestroy(&pix_sub);
653 float parts_passed = 0.0;
654 for (
int i = 0; i < sub_boxes.
size(); ++i) {
656 if (density < density_th) {
662 const float kSeedPartRatioTh = 0.3;
663 bool retval = (parts_passed / sub_boxes.
size() >= kSeedPartRatioTh);
678 parts_splitted->
clear();
681 bool found_split =
true;
682 while (found_split) {
684 BLOBNBOX_C_IT box_it(right_part->
boxes());
692 for (box_it.mark_cycle_pt(); !box_it.cycled_list(); box_it.forward()) {
693 const TBOX& box = box_it.data()->bounding_box();
695 box.
left() - previous_right > kThreshold) {
698 int mid_x = (box.
left() + previous_right) / 2;
700 right_part = left_part->
SplitAt(mid_x);
709 previous_right =
MAX(previous_right, box.
right());
721 splitted_boxes->
clear();
734 BLOBNBOX_C_IT box_it(part->
boxes());
735 for (box_it.mark_cycle_pt(); !box_it.cycled_list(); box_it.forward()) {
736 const TBOX& box = box_it.data()->bounding_box();
738 box.
left() - previous_right > kThreshold) {
749 previous_right =
MAX(previous_right, box.
right());
760 const float foreground_density_th,
766 if (!indented_texts_left.
empty() &&
782 if (sorted_vec.
empty()) {
785 const int kDistTh =
static_cast<int>(roundf(0.03 *
resolution_));
790 while (index >= 0 && abs(val - sorted_vec[index--]) < kDistTh) {
796 while (index < sorted_vec.
size() && sorted_vec[index++] - val < kDistTh) {
829 const int kGapTh =
static_cast<int>(roundf(
835 for (
int i = 0; i <
cp_seeds_.size(); ++i) {
841 if (left_margin + kMarginDiffTh < right_margin &&
842 left_margin < kMarginDiffTh) {
845 part_box.right(), part_box.top(), part_box.bottom());
846 right_to_left =
false;
847 }
else if (left_margin > cps_cx) {
851 part_box.left(), part_box.top(), part_box.bottom());
852 right_to_left =
true;
858 bool side_neighbor_found =
false;
859 while ((neighbor = search.
NextSideSearch(right_to_left)) != NULL) {
862 part_box.x_gap(neighbor_box) > kGapTh ||
863 !part_box.major_y_overlap(neighbor_box) ||
864 part_box.major_x_overlap(neighbor_box)) {
868 side_neighbor_found =
true;
871 if (!side_neighbor_found) {
876 if (neighbor_box.width() > part_box.width() &&
902 const TBOX &prev_box = prev->bounding_box();
906 int gap = current_box.
y_gap(prev_box);
916 if (ygaps.
size() < 8) {
922 int spacing = 0,
count;
924 spacing += ygaps[
count];
926 return spacing /
count;
930 const bool top_to_bottom,
const int textparts_linespacing) {
943 for (
int i = 0; i <
cp_seeds_.size(); ++i) {
949 if (
IsInline(!top_to_bottom, textparts_linespacing, part)) {
959 const int textparts_linespacing,
967 const float kYGapRatioTh = 1.0;
979 if (part_box.y_gap(neighbor_box) > kYGapRatioTh *
980 MIN(part_box.height(), neighbor_box.height())) {
989 const float kHeightRatioTh = 0.5;
990 const int kYGapTh = textparts_linespacing > 0 ?
991 textparts_linespacing +
static_cast<int>(roundf(0.02 *
resolution_)):
993 if (part_box.x_overlap(neighbor_box) &&
994 part_box.y_gap(neighbor_box) <= kYGapTh &&
996 static_cast<float>(
MIN(part_box.height(), neighbor_box.height())) /
997 MAX(part_box.height(), neighbor_box.height()) > kHeightRatioTh) {
1009 const int kSeedMathBlobsCount = 2;
1010 const int kSeedMathDigitBlobsCount = 5;
1016 math_blobs + digit_blobs <= kSeedMathDigitBlobsCount) {
1024 const float math_density_high,
1025 const float math_density_low,
1031 if (math_digit_density > math_density_high) {
1035 math_digit_density > math_density_low) {
1048 const int kXGapTh =
static_cast<int>(roundf(0.5 *
resolution_));
1049 const int kRadiusTh =
static_cast<int>(roundf(3.0 *
resolution_));
1050 const int kYGapTh =
static_cast<int>(roundf(0.5 *
resolution_));
1056 (part_box.top() + part_box.bottom()) / 2, kRadiusTh);
1058 bool left_indented =
false, right_indented =
false;
1060 (!left_indented || !right_indented)) {
1061 if (neighbor == part) {
1066 if (part_box.major_y_overlap(neighbor_box) &&
1067 part_box.x_gap(neighbor_box) < kXGapTh) {
1078 if (!part_box.x_overlap(neighbor_box) || part_box.y_overlap(neighbor_box)) {
1082 if (part_box.y_gap(neighbor_box) < kYGapTh) {
1083 int left_gap = part_box.left() - neighbor_box.left();
1084 int right_gap = neighbor_box.right() - part_box.right();
1085 if (left_gap > kXGapTh) {
1086 left_indented =
true;
1088 if (right_gap > kXGapTh) {
1089 right_indented =
true;
1094 if (left_indented && right_indented) {
1097 if (left_indented) {
1100 if (right_indented) {
1120 if (parts_to_merge.
empty()) {
1128 for (
int i = 0; i < parts_to_merge.
size(); ++i) {
1133 for (
int j = 0; j <
cp_seeds_.size(); ++j) {
1143 seed->
Absorb(part, NULL);
1150 const bool search_left,
1153 ASSERT_HOST(seed != NULL && parts_to_merge != NULL);
1154 const float kYOverlapTh = 0.6;
1155 const int kXGapTh =
static_cast<int>(roundf(0.2 *
resolution_));
1159 int x = search_left ? seed_box.
left() : seed_box.right();
1170 if (part_box.x_gap(seed_box) > kXGapTh) {
1175 if ((part_box.left() >= seed_box.left() && search_left) ||
1176 (part_box.right() <= seed_box.right() && !search_left)) {
1193 if (part_box.y_overlap_fraction(seed_box) < kYOverlapTh &&
1194 seed_box.y_overlap_fraction(part_box) < kYOverlapTh) {
1206 const bool search_bottom,
1209 ASSERT_HOST(seed != NULL && parts_to_merge != NULL &&
1211 const float kXOverlapTh = 0.4;
1212 const int kYGapTh =
static_cast<int>(roundf(0.2 *
resolution_));
1216 int y = search_bottom ? seed_box.
bottom() : seed_box.top();
1224 int skipped_min_top = INT_MAX, skipped_max_bottom = -1;
1231 if (part_box.y_gap(seed_box) > kYGapTh) {
1236 if ((part_box.bottom() >= seed_box.bottom() && search_bottom) ||
1237 (part_box.top() <= seed_box.top() && !search_bottom)) {
1241 bool skip_part =
false;
1254 if (part_box.x_overlap_fraction(seed_box) < kXOverlapTh &&
1255 seed_box.x_overlap_fraction(part_box) < kXOverlapTh) {
1261 if (skipped_min_top > part_box.top()) {
1262 skipped_min_top = part_box.
top();
1264 if (skipped_max_bottom < part_box.bottom()) {
1265 skipped_max_bottom = part_box.bottom();
1280 for (
int i = 0; i < parts.
size(); i++) {
1281 const TBOX& part_box(parts[i]->bounding_box());
1282 if ((search_bottom && part_box.
top() <= skipped_max_bottom) ||
1283 (!search_bottom && part_box.
bottom() >= skipped_min_top)) {
1293 const TBOX& part_box)
const {
1294 const int kXGapTh =
static_cast<int>(roundf(0.25 *
resolution_));
1295 const int kYGapTh =
static_cast<int>(roundf(0.05 *
resolution_));
1305 part_box.
y_gap(seed_box) > kYGapTh) &&
1307 part_box.
x_gap(seed_box) > kXGapTh)) {
1343 if (text_parts.
empty()) {
1348 text_parts.
sort(&SortCPByHeight);
1349 const TBOX& text_box = text_parts[text_parts.
size() / 2]->bounding_box();
1350 int med_height = text_box.
height();
1351 if (text_parts.
size() % 2 == 0 && text_parts.
size() > 1) {
1352 const TBOX& text_box =
1353 text_parts[text_parts.
size() / 2 - 1]->bounding_box();
1354 med_height =
static_cast<int>(roundf(
1355 0.5 * (text_box.
height() + med_height)));
1359 for (
int i = 0; i < text_parts.
size(); ++i) {
1360 const TBOX& text_box(text_parts[i]->bounding_box());
1361 if (text_box.
height() > med_height) {
1372 for (
int j = 0; j < math_blocks.
size(); ++j) {
1374 text_parts[i]->Absorb(math_blocks[j], NULL);
1383 math_blocks->
clear();
1387 int y_gaps[2] = {INT_MAX, INT_MAX};
1389 int neighbors_left = INT_MAX, neighbors_right = 0;
1390 for (
int i = 0; i < 2; ++i) {
1393 const TBOX& neighbor_box = neighbors[i]->bounding_box();
1394 y_gaps[i] = neighbor_box.
y_gap(part_box);
1395 if (neighbor_box.
left() < neighbors_left) {
1396 neighbors_left = neighbor_box.
left();
1398 if (neighbor_box.
right() > neighbors_right) {
1399 neighbors_right = neighbor_box.
right();
1403 if (neighbors[0] == neighbors[1]) {
1405 neighbors[1] = NULL;
1406 y_gaps[1] = INT_MAX;
1410 if (part_box.left() < neighbors_left || part_box.right() > neighbors_right) {
1415 int index = y_gaps[0] < y_gaps[1] ? 0 : 1;
1419 math_blocks->
push_back(neighbors[index]);
1428 math_blocks->
push_back(neighbors[index]);
1437 ColPartition *nearest_neighbor = NULL, *neighbor = NULL;
1438 const int kYGapTh =
static_cast<int>(roundf(
resolution_ * 0.5));
1443 int y = search_bottom ? part_box.
bottom() : part_box.top();
1445 int min_y_gap = INT_MAX;
1450 const TBOX& neighbor_box(neighbor->bounding_box());
1451 int y_gap = neighbor_box.
y_gap(part_box);
1452 if (y_gap > kYGapTh) {
1455 if (!neighbor_box.major_x_overlap(part_box) ||
1456 (search_bottom && neighbor_box.bottom() > part_box.bottom()) ||
1457 (!search_bottom && neighbor_box.top() < part_box.top())) {
1460 if (y_gap < min_y_gap) {
1462 nearest_neighbor = neighbor;
1466 return nearest_neighbor;
1474 const int kYGapTh =
static_cast<int>(roundf(
resolution_ * 0.1));
1479 STRING* image_name)
const {
1482 snprintf(page,
sizeof(page),
"%04d",
page_count_);
1488 pix = pixConvertTo32(pixBi);
1493 BLOBNBOX_C_IT blob_it(part->
boxes());
1494 for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
1499 pixWrite(outfile.
string(), pix, IFF_TIFF_LZW);
1506 gsearch.StartFullSearch();
1508 while ((part = gsearch.NextFullSearch()) != NULL) {
1510 Box *box = boxCreate(tbox.
left(), pixGetHeight(pix) - tbox.
top(),
1513 pixRenderBoxArb(pix, box, 5, 255, 0, 0);
1515 pixRenderBoxArb(pix, box, 5, 0, 255, 0);
1517 pixRenderBoxArb(pix, box, 5, 0, 0, 255);
1522 pixWrite(outfile.
string(), pix, IFF_TIFF_LZW);
1530 tprintf(
"Printing special blobs density values for ColParition (t=%d,b=%d) ",
1531 h - box.top(), h - box.bottom());
void set_type(PolyBlockType t)
bool IsNearMathNeighbor(const int y_gap, const ColPartition *neighbor) const
bool joined_to_prev() const
void IdentifyBlobsToSkip(ColPartition *part)
bool CheckSeedBlobsCount(ColPartition *part)
bool equationdetect_save_seed_image
void SplitCPHorLite(ColPartition *part, GenericVector< TBOX > *splitted_boxes)
BOOL8 contains(const char c) const
const int kSeedBlobsCountTh
bool IsVerticalType() const
BlobRegionType blob_type() const
int y_gap(const TBOX &box) const
const float kMathItalicDensityTh
int init_tesseract(const char *arg0, const char *textbase, const char *language, OcrEngineMode oem, char **configs, int configs_size, const GenericVector< STRING > *vars_vec, const GenericVector< STRING > *vars_values, bool set_only_init_params)
float ComputeForegroundDensity(const TBOX &tbox)
void ComputeCPsSuperBBox()
void SetLangTesseract(Tesseract *lang_tesseract)
int CountAlignment(const GenericVector< int > &sorted_vec, const int val) const
LIST search(LIST list, void *key, int_compare is_equal)
GenericVector< ColPartition * > cp_seeds_
void IdentifyInlineParts()
void ComputeSpecialBlobsDensity()
UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
void SplitCPHor(ColPartition *part, GenericVector< ColPartition * > *parts_splitted)
static TBLOB * PolygonalCopy(bool allow_detailed_fx, C_BLOB *src)
void IdentifySpecialText()
bool CheckSeedDensity(const float math_density_high, const float math_density_low, const ColPartition *part) const
BLOBNBOX_LIST large_blobs
void SearchByOverlap(ColPartition *seed, GenericVector< ColPartition * > *parts_overlap)
ColPartition * SplitAt(int split_x)
bool CheckSeedNeighborDensity(const ColPartition *part) const
TBOX bounding_box() const
bool ExpandSeed(ColPartition *seed)
void RepositionIterator()
int EstimateTextPartLineSpacing()
const float kMathDigitDensityTh1
void AdaptiveClassifier(TBLOB *Blob, BLOB_CHOICE_LIST *Choices)
bool equationdetect_save_spt_image
bool IsTextOrEquationType(PolyBlockType type)
BlobSpecialTextType special_text_type() const
bool get_isdigit(UNICHAR_ID unichar_id) const
bool PTIsTextType(PolyBlockType type)
double x_overlap_fraction(const TBOX &box) const
ColPartitionSet ** best_columns_
const TBOX & bounding_box() const
EquationDetect(const char *equ_datapath, const char *equ_language)
int FindEquationParts(ColPartitionGrid *part_grid, ColPartitionSet **best_columns)
ColPartition * SearchNNVertical(const bool search_bottom, const ColPartition *part)
void StartSideSearch(int x, int ymin, int ymax)
bool get_isalpha(UNICHAR_ID unichar_id) const
void GridCoords(int x, int y, int *grid_x, int *grid_y) const
void Absorb(ColPartition *other, WidthCallback *cb)
inT16 fontinfo_id() const
bool equationdetect_save_merged_image
BlobTextFlowType flow() const
void set_special_text_type(BlobSpecialTextType new_type)
const char * id_to_unichar(UNICHAR_ID id) const
ColPartition * CopyButDontOwnBlobs()
bool major_y_overlap(const TBOX &box) const
Tesseract * equ_tesseract_
void PaintSpecialTexts(const STRING &outfile) const
int classify_class_pruner_multiplier
bool IsLeftIndented(const EquationDetect::IndentType type)
bool IsRightIndented(const EquationDetect::IndentType type)
bool IsInline(const bool search_bottom, const int textPartsLineSpacing, ColPartition *part)
void MergePartsByLocation()
void Normalize(const BLOCK *block, const FCOORD *rotation, const DENORM *predecessor, float x_origin, float y_origin, float x_scale, float y_scale, float final_xshift, float final_yshift, bool inverse, Pix *pix)
void InsertBBox(bool h_spread, bool v_spread, BBC *bbox)
UnicityTable< FontInfo > & get_fontinfo_table()
void delete_data_pointers()
const float kUnclearDensityTh
void IdentifyInlinePartsVertical(const bool top_to_bottom, const int textPartsLineSpacing)
void IdentifyInlinePartsHorizontal()
bool get_ispunctuation(UNICHAR_ID unichar_id) const
BBC * NextVerticalSearch(bool top_to_bottom)
bool IsNearSmallNeighbor(const TBOX &seed_box, const TBOX &part_box) const
void ProcessMathBlockSatelliteParts()
const TBOX & bounding_box() const
Tesseract * lang_tesseract_
BlobSpecialTextType EstimateTypeForUnichar(const UNICHARSET &unicharset, const UNICHAR_ID id) const
bool major_x_overlap(const TBOX &box) const
bool bool_binary_search(const T &target) const
ColPartitionGrid * part_grid_
void SetResolution(const int resolution)
PolyBlockType type() const
int source_resolution() const
IndentType IsIndented(ColPartition *part)
void ExpandSeedVertical(const bool search_bottom, ColPartition *seed, GenericVector< ColPartition * > *parts_to_merge)
void set_blob_type(BlobRegionType t)
int IntCastRounded(double x)
void set_flow(BlobTextFlowType f)
void StartRadSearch(int x, int y, int max_radius)
const int kBlnBaselineOffset
int x_gap(const TBOX &box) const
const char * string() const
int classify_integer_matcher_multiplier
float SpecialBlobsDensity(const BlobSpecialTextType type) const
void InsertPartAfterAbsorb(ColPartition *part)
bool IsMathBlockSatellite(ColPartition *part, GenericVector< ColPartition * > *math_blocks)
bool equationdetect_save_bi_image
void GetOutputTiffName(const char *name, STRING *image_name) const
void StartVerticalSearch(int xmin, int xmax, int y)
void PrintSpecialBlobsDensity(const ColPartition *part) const
void RemoveBBox(BBC *bbox)
void ExpandSeedHorizontal(const bool search_left, ColPartition *seed, GenericVector< ColPartition * > *parts_to_merge)
#define BOOL_VAR(name, val, comment)
int SpecialBlobsCount(const BlobSpecialTextType type)
bool CheckForSeed2(const GenericVector< int > &indented_texts_left, const float foreground_density_th, ColPartition *part)
const int kLeftIndentAlignmentCountTh
BBC * NextSideSearch(bool right_to_left)
bool CheckSeedFgDensity(const float density_th, ColPartition *part)
void SetPartitionType(int resolution, ColPartitionSet *columns)
static void RenderSpecialText(Pix *pix, BLOBNBOX *blob)
const float kMathDigitDensityTh2
void PaintColParts(const STRING &outfile) const
void SetUniqueMode(bool mode)
int LabelSpecialText(TO_BLOCK *to_block)
UNICHAR_ID unichar_id() const
int binary_search(const T &target) const
bool y_overlap(const TBOX &box) const