19#ifndef TESSERACT_CCMAIN_EQUATIONDETECT_H_
20#define TESSERACT_CCMAIN_EQUATIONDETECT_H_
34class ColPartitionGrid;
39 EquationDetect(
const char *equ_datapath,
const char *equ_language);
46 void SetLangTesseract(
Tesseract *lang_tesseract);
51 int LabelSpecialText(
TO_BLOCK *to_block)
override;
59 void SetResolution(
const int resolution);
65 void IdentifySpecialText(
BLOBNBOX *blob,
const int height_th);
72 void IdentifySpecialText();
81 void MergePartsByLocation();
88 void SearchByOverlap(
ColPartition *seed, std::vector<ColPartition *> *parts_overlap);
95 void IdentifySeedParts();
101 float ComputeForegroundDensity(
const TBOX &tbox);
108 bool CheckForSeed2(
const std::vector<int> &indented_texts_left,
113 int CountAlignment(
const std::vector<int> &sorted_vec,
const int val)
const;
118 bool CheckSeedFgDensity(
const float density_th,
ColPartition *part);
122 void SplitCPHorLite(
ColPartition *part, std::vector<TBOX> *splitted_boxes);
129 void SplitCPHor(
ColPartition *part, std::vector<ColPartition *> *parts_splitted);
133 bool CheckSeedDensity(
const float math_density_high,
const float math_density_low,
140 void IdentifyInlineParts();
143 void ComputeCPsSuperBBox();
146 void IdentifyInlinePartsHorizontal();
150 int EstimateTextPartLineSpacing();
153 void IdentifyInlinePartsVertical(
const bool top_to_bottom,
const int textPartsLineSpacing);
157 bool IsInline(
const bool search_bottom,
const int textPartsLineSpacing,
ColPartition *part);
168 void ExpandSeedHorizontal(
const bool search_left,
ColPartition *seed,
169 std::vector<ColPartition *> *parts_to_merge);
170 void ExpandSeedVertical(
const bool search_bottom,
ColPartition *seed,
171 std::vector<ColPartition *> *parts_to_merge);
174 bool IsNearSmallNeighbor(
const TBOX &seed_box,
const TBOX &part_box)
const;
178 bool CheckSeedNeighborDensity(
const ColPartition *part)
const;
188 void ProcessMathBlockSatelliteParts();
192 bool IsMathBlockSatellite(
ColPartition *part, std::vector<ColPartition *> *math_blocks);
201 bool IsNearMathNeighbor(
const int y_gap,
const ColPartition *neighbor)
const;
204 void GetOutputTiffName(
const char *name, std::string &image_name)
const;
209 void PaintColParts(
const std::string &outfile)
const;
213 void PaintSpecialTexts(
const std::string &outfile)
const;
217 void PrintSpecialBlobsDensity(
const ColPartition *part)
const;
std::vector< ColPartition * > cp_seeds_
Tesseract * lang_tesseract_