28 #include "config_auto.h" 53 static int SortCPByTopReverse(
const void* p1,
const void* p2) {
54 const ColPartition* cp1 = *
static_cast<ColPartition* const*
>(p1);
55 const ColPartition* cp2 = *
static_cast<ColPartition* const*
>(p2);
57 const TBOX &box1(cp1->bounding_box()), &box2(cp2->bounding_box());
58 return box2.
top() - box1.top();
61 static int SortCPByBottom(
const void* p1,
const void* p2) {
62 const ColPartition* cp1 = *
static_cast<ColPartition* const*
>(p1);
63 const ColPartition* cp2 = *
static_cast<ColPartition* const*
>(p2);
65 const TBOX &box1(cp1->bounding_box()), &box2(cp2->bounding_box());
66 return box1.
bottom() - box2.bottom();
69 static int SortCPByHeight(
const void* p1,
const void* p2) {
70 const ColPartition* cp1 = *
static_cast<ColPartition* const*
>(p1);
71 const ColPartition* cp2 = *
static_cast<ColPartition* const*
>(p2);
73 const TBOX &box1(cp1->bounding_box()), &box2(cp2->bounding_box());
74 return box1.
height() - box2.height();
101 const char* equ_name) {
102 const char* default_name =
"equ";
103 if (equ_name == NULL) {
104 equ_name = default_name;
112 tprintf(
"Warning: equation region detection requested," 113 " but %s failed to load from %s\n", equ_name, equ_datapath);
130 if (to_block == NULL) {
131 tprintf(
"Warning: input to_block is NULL!\n");
138 for (
int i = 0; i < blob_lists.
size(); ++i) {
139 BLOBNBOX_IT bbox_it(blob_lists[i]);
140 for (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list();
142 bbox_it.data()->set_special_text_type(
BSTT_NONE);
150 BLOBNBOX *blobnbox,
const int height_th) {
158 BLOB_CHOICE_LIST ratings_equ, ratings_lang;
168 float x_orig = (box.
left() + box.
right()) / 2.0f, y_orig = box.
bottom();
170 normed_blob->
Normalize(NULL, NULL, NULL, x_orig, y_orig, scaling, scaling,
181 BLOB_CHOICE *lang_choice = NULL, *equ_choice = NULL;
182 if (ratings_lang.length() > 0) {
183 BLOB_CHOICE_IT choice_it(&ratings_lang);
184 lang_choice = choice_it.data();
186 if (ratings_equ.length() > 0) {
187 BLOB_CHOICE_IT choice_it(&ratings_equ);
188 equ_choice = choice_it.data();
191 float lang_score = lang_choice ? lang_choice->
certainty() : -FLT_MAX;
192 float equ_score = equ_choice ? equ_choice->certainty() : -FLT_MAX;
194 const float kConfScoreTh = -5.0f, kConfDiffTh = 1.8;
197 float diff = fabs(lang_score - equ_score);
201 if (fmax(lang_score, equ_score) < kConfScoreTh) {
204 }
else if (diff > kConfDiffTh && equ_score > lang_score) {
208 }
else if (lang_choice) {
233 if (ids_to_exclude.
empty()) {
234 static const STRING kCharsToEx[] = {
"'",
"`",
"\"",
"\\",
",",
".",
235 "〈",
"〉",
"《",
"》",
"」",
"「",
""};
237 while (kCharsToEx[i] !=
"") {
241 ids_to_exclude.
sort();
248 static const STRING kDigitsChars =
"|";
264 int classify_integer_matcher =
277 BLOBNBOX_C_IT bbox_it(part->
boxes());
280 for (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list();
282 if (bbox_it.data()->special_text_type() !=
BSTT_SKIP) {
283 blob_heights.
push_back(bbox_it.data()->bounding_box().height());
287 int height_th = blob_heights[blob_heights.size() / 2] / 3 * 2;
288 for (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list();
290 if (bbox_it.data()->special_text_type() !=
BSTT_SKIP) {
298 classify_class_pruner);
300 classify_integer_matcher);
311 BLOBNBOX_C_IT blob_it(part->
boxes());
313 for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
317 for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
326 BLOBNBOX_C_IT blob_it2 = blob_it;
328 while (!blob_it2.at_last()) {
329 BLOBNBOX* nextblob = blob_it2.forward();
331 if (nextblob_box.
left() >= blob_box.
right()) {
334 const float kWidthR = 0.4, kHeightR = 0.3;
336 yoverlap = blob_box.
y_overlap(nextblob_box);
337 float widthR =
static_cast<float>(
340 float heightR =
static_cast<float>(
344 if (xoverlap && yoverlap && widthR > kWidthR && heightR > kHeightR) {
348 blob_box += nextblob_box;
360 tprintf(
"Warning: lang_tesseract_ is NULL!\n");
363 if (!part_grid || !best_columns) {
364 tprintf(
"part_grid/best_columns is NULL!!\n");
398 for (
int i = 0; i <
cp_seeds_.size(); ++i) {
406 for (
int i = 0; i < seeds_expanded.
size(); ++i) {
436 if (parts_to_merge.
empty()) {
442 for (
int i = 0; i < parts_to_merge.
size(); ++i) {
443 ASSERT_HOST(parts_to_merge[i] != NULL && parts_to_merge[i] != part);
444 part->
Absorb(parts_to_merge[i], NULL);
451 if (parts_updated.
empty()) {
456 for (
int i = 0; i < parts_updated.
size(); ++i) {
465 ASSERT_HOST(seed != NULL && parts_overlap != NULL);
471 const int kRadNeighborCells = 30;
473 (seed_box.top() + seed_box.bottom()) / 2,
480 const float kLargeOverlapTh = 0.95;
481 const float kEquXOverlap = 0.4, kEquYOverlap = 0.5;
490 y_overlap_fraction = part_box.y_overlap_fraction(seed_box);
493 if (x_overlap_fraction >= kLargeOverlapTh &&
494 y_overlap_fraction >= kLargeOverlapTh) {
498 if ((x_overlap_fraction > kEquXOverlap && y_overlap_fraction > 0.0) ||
499 (x_overlap_fraction > 0.0 && y_overlap_fraction > kEquYOverlap)) {
525 part_box.left(), part_box.bottom(), &grid_x, &grid_y);
554 const int kTextBlobsTh = 20;
579 indented_texts_left.
sort();
580 texts_foreground_density.
sort();
581 float foreground_density_th = 0.15;
582 if (!texts_foreground_density.
empty()) {
584 foreground_density_th = 0.8 * texts_foreground_density[
585 texts_foreground_density.
size() / 2];
588 for (
int i = 0; i < seeds1.
size(); ++i) {
589 const TBOX& box = seeds1[i]->bounding_box();
593 kLeftIndentAlignmentCountTh)) {
602 for (
int i = 0; i < seeds2.
size(); ++i) {
603 if (
CheckForSeed2(indented_texts_left, foreground_density_th, seeds2[i])) {
612 int pix_height = pixGetHeight(pix_bi);
613 Box* box = boxCreate(tbox.
left(), pix_height - tbox.
top(),
615 Pix *pix_sub = pixClipRectangle(pix_bi, box, NULL);
617 pixForegroundFraction(pix_sub, &fract);
618 pixDestroy(&pix_sub);
631 float parts_passed = 0.0;
632 for (
int i = 0; i < sub_boxes.
size(); ++i) {
634 if (density < density_th) {
640 const float kSeedPartRatioTh = 0.3;
641 bool retval = (parts_passed / sub_boxes.
size() >= kSeedPartRatioTh);
656 parts_splitted->
clear();
659 bool found_split =
true;
660 while (found_split) {
662 BLOBNBOX_C_IT box_it(right_part->
boxes());
670 for (box_it.mark_cycle_pt(); !box_it.cycled_list(); box_it.forward()) {
671 const TBOX& box = box_it.data()->bounding_box();
673 box.
left() - previous_right > kThreshold) {
676 int mid_x = (box.
left() + previous_right) / 2;
678 right_part = left_part->
SplitAt(mid_x);
687 previous_right =
MAX(previous_right, box.
right());
699 splitted_boxes->
clear();
712 BLOBNBOX_C_IT box_it(part->
boxes());
713 for (box_it.mark_cycle_pt(); !box_it.cycled_list(); box_it.forward()) {
714 const TBOX& box = box_it.data()->bounding_box();
716 box.
left() - previous_right > kThreshold) {
727 previous_right =
MAX(previous_right, box.
right());
738 const float foreground_density_th,
744 if (!indented_texts_left.
empty() &&
746 kLeftIndentAlignmentCountTh) {
760 if (sorted_vec.
empty()) {
763 const int kDistTh =
static_cast<int>(roundf(0.03 *
resolution_));
768 while (index >= 0 && abs(val - sorted_vec[index--]) < kDistTh) {
774 while (index < sorted_vec.
size() && sorted_vec[index++] - val < kDistTh) {
807 const int kGapTh =
static_cast<int>(roundf(
813 for (
int i = 0; i <
cp_seeds_.size(); ++i) {
819 if (left_margin + kMarginDiffTh < right_margin &&
820 left_margin < kMarginDiffTh) {
823 part_box.right(), part_box.top(), part_box.bottom());
824 right_to_left =
false;
825 }
else if (left_margin > cps_cx) {
829 part_box.left(), part_box.top(), part_box.bottom());
830 right_to_left =
true;
836 bool side_neighbor_found =
false;
837 while ((neighbor = search.
NextSideSearch(right_to_left)) != NULL) {
840 part_box.x_gap(neighbor_box) > kGapTh ||
841 !part_box.major_y_overlap(neighbor_box) ||
842 part_box.major_x_overlap(neighbor_box)) {
846 side_neighbor_found =
true;
849 if (!side_neighbor_found) {
854 if (neighbor_box.width() > part_box.width() &&
880 const TBOX &prev_box = prev->bounding_box();
884 int gap = current_box.
y_gap(prev_box);
894 if (ygaps.
size() < 8) {
900 int spacing = 0,
count;
902 spacing += ygaps[
count];
904 return spacing /
count;
908 const bool top_to_bottom,
const int textparts_linespacing) {
921 for (
int i = 0; i <
cp_seeds_.size(); ++i) {
927 if (
IsInline(!top_to_bottom, textparts_linespacing, part)) {
937 const int textparts_linespacing,
945 const float kYGapRatioTh = 1.0;
957 if (part_box.y_gap(neighbor_box) > kYGapRatioTh *
958 MIN(part_box.height(), neighbor_box.height())) {
967 const float kHeightRatioTh = 0.5;
968 const int kYGapTh = textparts_linespacing > 0 ?
969 textparts_linespacing +
static_cast<int>(roundf(0.02 *
resolution_)):
971 if (part_box.x_overlap(neighbor_box) &&
972 part_box.y_gap(neighbor_box) <= kYGapTh &&
974 static_cast<float>(
MIN(part_box.height(), neighbor_box.height())) /
975 MAX(part_box.height(), neighbor_box.height()) > kHeightRatioTh) {
987 const int kSeedMathBlobsCount = 2;
988 const int kSeedMathDigitBlobsCount = 5;
993 if (blobs < kSeedBlobsCountTh || math_blobs <= kSeedMathBlobsCount ||
994 math_blobs + digit_blobs <= kSeedMathDigitBlobsCount) {
1002 const float math_density_high,
1003 const float math_density_low,
1009 if (math_digit_density > math_density_high) {
1012 if (math_digit_density + italic_density > kMathItalicDensityTh &&
1013 math_digit_density > math_density_low) {
1026 const int kXGapTh =
static_cast<int>(roundf(0.5 *
resolution_));
1027 const int kRadiusTh =
static_cast<int>(roundf(3.0 *
resolution_));
1028 const int kYGapTh =
static_cast<int>(roundf(0.5 *
resolution_));
1034 (part_box.top() + part_box.bottom()) / 2, kRadiusTh);
1036 bool left_indented =
false, right_indented =
false;
1038 (!left_indented || !right_indented)) {
1039 if (neighbor == part) {
1044 if (part_box.major_y_overlap(neighbor_box) &&
1045 part_box.x_gap(neighbor_box) < kXGapTh) {
1056 if (!part_box.x_overlap(neighbor_box) || part_box.y_overlap(neighbor_box)) {
1060 if (part_box.y_gap(neighbor_box) < kYGapTh) {
1061 int left_gap = part_box.left() - neighbor_box.left();
1062 int right_gap = neighbor_box.right() - part_box.right();
1063 if (left_gap > kXGapTh) {
1064 left_indented =
true;
1066 if (right_gap > kXGapTh) {
1067 right_indented =
true;
1072 if (left_indented && right_indented) {
1075 if (left_indented) {
1078 if (right_indented) {
1098 if (parts_to_merge.
empty()) {
1106 for (
int i = 0; i < parts_to_merge.
size(); ++i) {
1111 for (
int j = 0; j <
cp_seeds_.size(); ++j) {
1121 seed->
Absorb(part, NULL);
1128 const bool search_left,
1131 ASSERT_HOST(seed != NULL && parts_to_merge != NULL);
1132 const float kYOverlapTh = 0.6;
1133 const int kXGapTh =
static_cast<int>(roundf(0.2 *
resolution_));
1137 int x = search_left ? seed_box.
left() : seed_box.right();
1148 if (part_box.x_gap(seed_box) > kXGapTh) {
1153 if ((part_box.left() >= seed_box.left() && search_left) ||
1154 (part_box.right() <= seed_box.right() && !search_left)) {
1171 if (part_box.y_overlap_fraction(seed_box) < kYOverlapTh &&
1172 seed_box.y_overlap_fraction(part_box) < kYOverlapTh) {
1184 const bool search_bottom,
1187 ASSERT_HOST(seed != NULL && parts_to_merge != NULL &&
1189 const float kXOverlapTh = 0.4;
1190 const int kYGapTh =
static_cast<int>(roundf(0.2 *
resolution_));
1194 int y = search_bottom ? seed_box.
bottom() : seed_box.top();
1202 int skipped_min_top = INT_MAX, skipped_max_bottom = -1;
1209 if (part_box.y_gap(seed_box) > kYGapTh) {
1214 if ((part_box.bottom() >= seed_box.bottom() && search_bottom) ||
1215 (part_box.top() <= seed_box.top() && !search_bottom)) {
1219 bool skip_part =
false;
1232 if (part_box.x_overlap_fraction(seed_box) < kXOverlapTh &&
1233 seed_box.x_overlap_fraction(part_box) < kXOverlapTh) {
1239 if (skipped_min_top > part_box.top()) {
1240 skipped_min_top = part_box.
top();
1242 if (skipped_max_bottom < part_box.bottom()) {
1243 skipped_max_bottom = part_box.bottom();
1258 for (
int i = 0; i < parts.
size(); i++) {
1259 const TBOX& part_box(parts[i]->bounding_box());
1260 if ((search_bottom && part_box.
top() <= skipped_max_bottom) ||
1261 (!search_bottom && part_box.
bottom() >= skipped_min_top)) {
1271 const TBOX& part_box)
const {
1272 const int kXGapTh =
static_cast<int>(roundf(0.25 *
resolution_));
1273 const int kYGapTh =
static_cast<int>(roundf(0.05 *
resolution_));
1283 part_box.
y_gap(seed_box) > kYGapTh) &&
1285 part_box.
x_gap(seed_box) > kXGapTh)) {
1321 if (text_parts.
empty()) {
1326 text_parts.
sort(&SortCPByHeight);
1327 const TBOX& text_box = text_parts[text_parts.
size() / 2]->bounding_box();
1328 int med_height = text_box.
height();
1329 if (text_parts.
size() % 2 == 0 && text_parts.
size() > 1) {
1330 const TBOX& text_box =
1331 text_parts[text_parts.
size() / 2 - 1]->bounding_box();
1332 med_height =
static_cast<int>(roundf(
1333 0.5 * (text_box.
height() + med_height)));
1337 for (
int i = 0; i < text_parts.
size(); ++i) {
1338 const TBOX& text_box(text_parts[i]->bounding_box());
1339 if (text_box.
height() > med_height) {
1350 for (
int j = 0; j < math_blocks.
size(); ++j) {
1352 text_parts[i]->Absorb(math_blocks[j], NULL);
1361 math_blocks->
clear();
1365 int y_gaps[2] = {INT_MAX, INT_MAX};
1367 int neighbors_left = INT_MAX, neighbors_right = 0;
1368 for (
int i = 0; i < 2; ++i) {
1371 const TBOX& neighbor_box = neighbors[i]->bounding_box();
1372 y_gaps[i] = neighbor_box.
y_gap(part_box);
1373 if (neighbor_box.
left() < neighbors_left) {
1374 neighbors_left = neighbor_box.
left();
1376 if (neighbor_box.
right() > neighbors_right) {
1377 neighbors_right = neighbor_box.
right();
1381 if (neighbors[0] == neighbors[1]) {
1383 neighbors[1] = NULL;
1384 y_gaps[1] = INT_MAX;
1388 if (part_box.left() < neighbors_left || part_box.right() > neighbors_right) {
1393 int index = y_gaps[0] < y_gaps[1] ? 0 : 1;
1397 math_blocks->
push_back(neighbors[index]);
1406 math_blocks->
push_back(neighbors[index]);
1415 ColPartition *nearest_neighbor = NULL, *neighbor = NULL;
1416 const int kYGapTh =
static_cast<int>(roundf(
resolution_ * 0.5));
1421 int y = search_bottom ? part_box.
bottom() : part_box.top();
1423 int min_y_gap = INT_MAX;
1428 const TBOX& neighbor_box(neighbor->bounding_box());
1429 int y_gap = neighbor_box.
y_gap(part_box);
1430 if (y_gap > kYGapTh) {
1433 if (!neighbor_box.major_x_overlap(part_box) ||
1434 (search_bottom && neighbor_box.bottom() > part_box.bottom()) ||
1435 (!search_bottom && neighbor_box.top() < part_box.top())) {
1438 if (y_gap < min_y_gap) {
1440 nearest_neighbor = neighbor;
1444 return nearest_neighbor;
1452 const int kYGapTh =
static_cast<int>(roundf(
resolution_ * 0.1));
1457 STRING* image_name)
const {
1460 snprintf(page,
sizeof(page),
"%04d",
page_count_);
1466 pix = pixConvertTo32(pixBi);
1471 BLOBNBOX_C_IT blob_it(part->
boxes());
1472 for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
1477 pixWrite(outfile.
string(), pix, IFF_TIFF_LZW);
1484 gsearch.StartFullSearch();
1486 while ((part = gsearch.NextFullSearch()) != NULL) {
1488 Box *box = boxCreate(tbox.
left(), pixGetHeight(pix) - tbox.
top(),
1491 pixRenderBoxArb(pix, box, 5, 255, 0, 0);
1493 pixRenderBoxArb(pix, box, 5, 0, 255, 0);
1495 pixRenderBoxArb(pix, box, 5, 0, 0, 255);
1500 pixWrite(outfile.
string(), pix, IFF_TIFF_LZW);
1508 tprintf(
"Printing special blobs density values for ColParition (t=%d,b=%d) ",
1509 h - box.top(), h - box.bottom());
const float kMathDigitDensityTh1
void SetUniqueMode(bool mode)
bool IsNearSmallNeighbor(const TBOX &seed_box, const TBOX &part_box) const
const TBOX & bounding_box() const
void set_blob_type(BlobRegionType t)
const float kMathItalicDensityTh
bool PTIsTextType(PolyBlockType type)
bool IsLeftIndented(const EquationDetect::IndentType type)
bool CheckSeedBlobsCount(ColPartition *part)
float ComputeForegroundDensity(const TBOX &tbox)
void ExpandSeedVertical(const bool search_bottom, ColPartition *seed, GenericVector< ColPartition *> *parts_to_merge)
void RemoveBBox(BBC *bbox)
bool y_overlap(const TBOX &box) const
void StartSideSearch(int x, int ymin, int ymax)
void SplitCPHorLite(ColPartition *part, GenericVector< TBOX > *splitted_boxes)
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)
const float kMathDigitDensityTh2
void set_special_text_type(BlobSpecialTextType new_type)
bool get_ispunctuation(UNICHAR_ID unichar_id) const
Tesseract * lang_tesseract_
BlobSpecialTextType EstimateTypeForUnichar(const UNICHARSET &unicharset, const UNICHAR_ID id) const
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, TessdataManager *mgr)
bool get_isdigit(UNICHAR_ID unichar_id) const
void IdentifyInlinePartsVertical(const bool top_to_bottom, const int textPartsLineSpacing)
BlobTextFlowType flow() const
bool get_isalpha(UNICHAR_ID unichar_id) const
bool equationdetect_save_bi_image
bool major_x_overlap(const TBOX &box) const
bool equationdetect_save_merged_image
void PaintColParts(const STRING &outfile) const
void ExpandSeedHorizontal(const bool search_left, ColPartition *seed, GenericVector< ColPartition *> *parts_to_merge)
void AdaptiveClassifier(TBLOB *Blob, BLOB_CHOICE_LIST *Choices)
void SearchByOverlap(ColPartition *seed, GenericVector< ColPartition *> *parts_overlap)
int EstimateTextPartLineSpacing()
void ComputeCPsSuperBBox()
bool IsTextOrEquationType(PolyBlockType type)
IndentType IsIndented(ColPartition *part)
double x_overlap_fraction(const TBOX &box) const
int CountAlignment(const GenericVector< int > &sorted_vec, const int val) const
float SpecialBlobsDensity(const BlobSpecialTextType type) const
void SplitCPHor(ColPartition *part, GenericVector< ColPartition *> *parts_splitted)
int FindEquationParts(ColPartitionGrid *part_grid, ColPartitionSet **best_columns)
void RepositionIterator()
PolyBlockType type() const
void delete_data_pointers()
GenericVector< ColPartition * > cp_seeds_
void StartRadSearch(int x, int y, int max_radius)
int y_gap(const TBOX &box) const
BlobSpecialTextType special_text_type() const
bool IsNearMathNeighbor(const int y_gap, const ColPartition *neighbor) const
void SetResolution(const int resolution)
const TBOX & bounding_box() const
BBC * NextSideSearch(bool right_to_left)
BBC * NextVerticalSearch(bool top_to_bottom)
void PrintSpecialBlobsDensity(const ColPartition *part) const
UNICHAR_ID unichar_id() const
BlobRegionType blob_type() const
void SetLangTesseract(Tesseract *lang_tesseract)
const char * string() const
int LabelSpecialText(TO_BLOCK *to_block)
int SpecialBlobsCount(const BlobSpecialTextType type)
bool ExpandSeed(ColPartition *seed)
LIST search(LIST list, void *key, int_compare is_equal)
bool CheckSeedNeighborDensity(const ColPartition *part) const
ColPartition * SplitAt(int split_x)
UnicityTable< FontInfo > & get_fontinfo_table()
void set_type(PolyBlockType t)
void ComputeSpecialBlobsDensity()
int classify_integer_matcher_multiplier
void Absorb(ColPartition *other, WidthCallback *cb)
void InsertBBox(bool h_spread, bool v_spread, BBC *bbox)
int x_gap(const TBOX &box) const
UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
int source_resolution() const
int binary_search(const T &target) const
void set_flow(BlobTextFlowType f)
ColPartitionSet ** best_columns_
bool joined_to_prev() const
static void RenderSpecialText(Pix *pix, BLOBNBOX *blob)
bool bool_binary_search(const T &target) const
#define BOOL_VAR(name, val, comment)
static TBLOB * PolygonalCopy(bool allow_detailed_fx, C_BLOB *src)
const float kUnclearDensityTh
bool equationdetect_save_seed_image
void IdentifyBlobsToSkip(ColPartition *part)
inT16 fontinfo_id() const
void SetPartitionType(int resolution, ColPartitionSet *columns)
bool IsRightIndented(const EquationDetect::IndentType type)
void IdentifySpecialText()
bool CheckForSeed2(const GenericVector< int > &indented_texts_left, const float foreground_density_th, ColPartition *part)
ColPartition * CopyButDontOwnBlobs()
TBOX bounding_box() const
bool equationdetect_save_spt_image
void IdentifyInlineParts()
EquationDetect(const char *equ_datapath, const char *equ_language)
BOOL8 contains(const char c) const
bool CheckSeedFgDensity(const float density_th, ColPartition *part)
bool IsVerticalType() const
void MergePartsByLocation()
ColPartition * SearchNNVertical(const bool search_bottom, const ColPartition *part)
const int kSeedBlobsCountTh
const int kBlnBaselineOffset
bool IsMathBlockSatellite(ColPartition *part, GenericVector< ColPartition *> *math_blocks)
void IdentifyInlinePartsHorizontal()
void StartVerticalSearch(int xmin, int xmax, int y)
void GridCoords(int x, int y, int *grid_x, int *grid_y) const
const int kLeftIndentAlignmentCountTh
BLOBNBOX_LIST large_blobs
int IntCastRounded(double x)
bool CheckSeedDensity(const float math_density_high, const float math_density_low, const ColPartition *part) const
void InsertPartAfterAbsorb(ColPartition *part)
bool IsInline(const bool search_bottom, const int textPartsLineSpacing, ColPartition *part)
void ProcessMathBlockSatelliteParts()
void PaintSpecialTexts(const STRING &outfile) const
ColPartitionGrid * part_grid_
bool major_y_overlap(const TBOX &box) const
const char * id_to_unichar(UNICHAR_ID id) const
void GetOutputTiffName(const char *name, STRING *image_name) const
int classify_class_pruner_multiplier