tesseract  5.0.0-alpha-619-ge9db
tesseract::TestableEquationDetect Class Reference
Inheritance diagram for tesseract::TestableEquationDetect:
tesseract::EquationDetect tesseract::EquationDetectBase

Public Member Functions

 TestableEquationDetect (const char *tessdata, Tesseract *lang_tesseract)
 
void AddMathDigitBlobs (const int math_blobs, const int digit_blobs, const int total_blobs, ColPartition *part)
 
void SetPixBinary (Pix *pix)
 
void RunIdentifySpecialText (BLOBNBOX *blob, const int height_th)
 
BlobSpecialTextType RunEstimateTypeForUnichar (const char *val)
 
EquationDetect::IndentType RunIsIndented (ColPartitionGrid *part_grid, ColPartition *part)
 
bool RunIsNearSmallNeighbor (const TBOX &seed_box, const TBOX &part_box)
 
bool RunCheckSeedBlobsCount (ColPartition *part)
 
float RunComputeForegroundDensity (const TBOX &tbox)
 
int RunCountAlignment (const GenericVector< int > &sorted_vec, const int val)
 
void RunSplitCPHorLite (ColPartition *part, GenericVector< TBOX > *splitted_boxes)
 
void RunSplitCPHor (ColPartition *part, GenericVector< ColPartition * > *parts_splitted)
 
void TestComputeCPsSuperBBox (const TBOX &box, ColPartitionGrid *part_grid)
 
- Public Member Functions inherited from tesseract::EquationDetect
 EquationDetect (const char *equ_datapath, const char *equ_language)
 
 ~EquationDetect () override
 
void SetLangTesseract (Tesseract *lang_tesseract)
 
int LabelSpecialText (TO_BLOCK *to_block) override
 
int FindEquationParts (ColPartitionGrid *part_grid, ColPartitionSet **best_columns) override
 
void SetResolution (const int resolution)
 
- Public Member Functions inherited from tesseract::EquationDetectBase
 EquationDetectBase ()=default
 
virtual ~EquationDetectBase ()
 

Additional Inherited Members

- Public Types inherited from tesseract::EquationDetect
enum  IndentType {
  NO_INDENT, LEFT_INDENT, RIGHT_INDENT, BOTH_INDENT,
  INDENT_TYPE_COUNT
}
 
- Static Public Member Functions inherited from tesseract::EquationDetectBase
static void RenderSpecialText (Pix *pix, BLOBNBOX *blob)
 
- Protected Member Functions inherited from tesseract::EquationDetect
void IdentifySpecialText (BLOBNBOX *blob, const int height_th)
 
BlobSpecialTextType EstimateTypeForUnichar (const UNICHARSET &unicharset, const UNICHAR_ID id) const
 
void IdentifySpecialText ()
 
void IdentifyBlobsToSkip (ColPartition *part)
 
void MergePartsByLocation ()
 
void SearchByOverlap (ColPartition *seed, GenericVector< ColPartition * > *parts_overlap)
 
void InsertPartAfterAbsorb (ColPartition *part)
 
void IdentifySeedParts ()
 
bool CheckSeedBlobsCount (ColPartition *part)
 
float ComputeForegroundDensity (const TBOX &tbox)
 
bool CheckForSeed2 (const GenericVector< int > &indented_texts_left, const float foreground_density_th, ColPartition *part)
 
int CountAlignment (const GenericVector< int > &sorted_vec, const int val) const
 
bool CheckSeedFgDensity (const float density_th, ColPartition *part)
 
void SplitCPHorLite (ColPartition *part, GenericVector< TBOX > *splitted_boxes)
 
void SplitCPHor (ColPartition *part, GenericVector< ColPartition * > *parts_splitted)
 
bool CheckSeedDensity (const float math_density_high, const float math_density_low, const ColPartition *part) const
 
IndentType IsIndented (ColPartition *part)
 
void IdentifyInlineParts ()
 
void ComputeCPsSuperBBox ()
 
void IdentifyInlinePartsHorizontal ()
 
int EstimateTextPartLineSpacing ()
 
void IdentifyInlinePartsVertical (const bool top_to_bottom, const int textPartsLineSpacing)
 
bool IsInline (const bool search_bottom, const int textPartsLineSpacing, ColPartition *part)
 
bool ExpandSeed (ColPartition *seed)
 
void ExpandSeedHorizontal (const bool search_left, ColPartition *seed, GenericVector< ColPartition * > *parts_to_merge)
 
void ExpandSeedVertical (const bool search_bottom, ColPartition *seed, GenericVector< ColPartition * > *parts_to_merge)
 
bool IsNearSmallNeighbor (const TBOX &seed_box, const TBOX &part_box) const
 
bool CheckSeedNeighborDensity (const ColPartition *part) const
 
void ProcessMathBlockSatelliteParts ()
 
bool IsMathBlockSatellite (ColPartition *part, GenericVector< ColPartition * > *math_blocks)
 
ColPartitionSearchNNVertical (const bool search_bottom, const ColPartition *part)
 
bool IsNearMathNeighbor (const int y_gap, const ColPartition *neighbor) const
 
void GetOutputTiffName (const char *name, STRING *image_name) const
 
void PaintColParts (const STRING &outfile) const
 
void PaintSpecialTexts (const STRING &outfile) const
 
void PrintSpecialBlobsDensity (const ColPartition *part) const
 
- Protected Attributes inherited from tesseract::EquationDetect
Tesseract equ_tesseract_
 
Tesseractlang_tesseract_
 
ColPartitionGridpart_grid_ = nullptr
 
ColPartitionSet ** best_columns_ = nullptr
 
TBOXcps_super_bbox_
 
GenericVector< ColPartition * > cp_seeds_
 
int resolution_
 
int page_count_
 

Detailed Description

Definition at line 27 of file equationdetect_test.cc.

Constructor & Destructor Documentation

◆ TestableEquationDetect()

tesseract::TestableEquationDetect::TestableEquationDetect ( const char *  tessdata,
Tesseract lang_tesseract 
)
inline

Definition at line 29 of file equationdetect_test.cc.

30  : EquationDetect(tessdata, "equ") {
31  SetLangTesseract(lang_tesseract);
32  }

Member Function Documentation

◆ AddMathDigitBlobs()

void tesseract::TestableEquationDetect::AddMathDigitBlobs ( const int  math_blobs,
const int  digit_blobs,
const int  total_blobs,
ColPartition part 
)
inline

Definition at line 35 of file equationdetect_test.cc.

36  {
37  CHECK(part != nullptr);
38  CHECK_LE(math_blobs + digit_blobs, total_blobs);
39  int count = 0;
40  for (int i = 0; i < math_blobs; i++, count++) {
41  BLOBNBOX* blob = new BLOBNBOX();
43  part->AddBox(blob);
44  }
45  for (int i = 0; i < digit_blobs; i++, count++) {
46  BLOBNBOX* blob = new BLOBNBOX();
48  part->AddBox(blob);
49  }
50  for (int i = count; i < total_blobs; i++) {
51  BLOBNBOX* blob = new BLOBNBOX();
53  part->AddBox(blob);
54  }
55  }

◆ RunCheckSeedBlobsCount()

bool tesseract::TestableEquationDetect::RunCheckSeedBlobsCount ( ColPartition part)
inline

Definition at line 82 of file equationdetect_test.cc.

82  {
83  return CheckSeedBlobsCount(part);
84  }

◆ RunComputeForegroundDensity()

float tesseract::TestableEquationDetect::RunComputeForegroundDensity ( const TBOX tbox)
inline

Definition at line 86 of file equationdetect_test.cc.

86  {
87  return ComputeForegroundDensity(tbox);
88  }

◆ RunCountAlignment()

int tesseract::TestableEquationDetect::RunCountAlignment ( const GenericVector< int > &  sorted_vec,
const int  val 
)
inline

Definition at line 90 of file equationdetect_test.cc.

90  {
91  return CountAlignment(sorted_vec, val);
92  }

◆ RunEstimateTypeForUnichar()

BlobSpecialTextType tesseract::TestableEquationDetect::RunEstimateTypeForUnichar ( const char *  val)
inline

Definition at line 67 of file equationdetect_test.cc.

67  {
68  const UNICHARSET& unicharset = lang_tesseract_->unicharset;
69  return EstimateTypeForUnichar(unicharset, unicharset.unichar_to_id(val));
70  }

◆ RunIdentifySpecialText()

void tesseract::TestableEquationDetect::RunIdentifySpecialText ( BLOBNBOX blob,
const int  height_th 
)
inline

Definition at line 63 of file equationdetect_test.cc.

63  {
64  IdentifySpecialText(blob, height_th);
65  }

◆ RunIsIndented()

EquationDetect::IndentType tesseract::TestableEquationDetect::RunIsIndented ( ColPartitionGrid part_grid,
ColPartition part 
)
inline

Definition at line 72 of file equationdetect_test.cc.

73  {
74  this->part_grid_ = part_grid;
75  return IsIndented(part);
76  }

◆ RunIsNearSmallNeighbor()

bool tesseract::TestableEquationDetect::RunIsNearSmallNeighbor ( const TBOX seed_box,
const TBOX part_box 
)
inline

Definition at line 78 of file equationdetect_test.cc.

78  {
79  return IsNearSmallNeighbor(seed_box, part_box);
80  }

◆ RunSplitCPHor()

void tesseract::TestableEquationDetect::RunSplitCPHor ( ColPartition part,
GenericVector< ColPartition * > *  parts_splitted 
)
inline

Definition at line 99 of file equationdetect_test.cc.

100  {
101  SplitCPHor(part, parts_splitted);
102  }

◆ RunSplitCPHorLite()

void tesseract::TestableEquationDetect::RunSplitCPHorLite ( ColPartition part,
GenericVector< TBOX > *  splitted_boxes 
)
inline

Definition at line 94 of file equationdetect_test.cc.

95  {
96  SplitCPHorLite(part, splitted_boxes);
97  }

◆ SetPixBinary()

void tesseract::TestableEquationDetect::SetPixBinary ( Pix *  pix)
inline

Definition at line 58 of file equationdetect_test.cc.

58  {
59  CHECK_EQ(1, pixGetDepth(pix));
61  }

◆ TestComputeCPsSuperBBox()

void tesseract::TestableEquationDetect::TestComputeCPsSuperBBox ( const TBOX box,
ColPartitionGrid part_grid 
)
inline

Definition at line 104 of file equationdetect_test.cc.

104  {
105  CHECK(part_grid != nullptr);
106  part_grid_ = part_grid;
108  EXPECT_TRUE(*cps_super_bbox_ == box);
109  }

The documentation for this class was generated from the following file:
tesseract::EquationDetect::SetLangTesseract
void SetLangTesseract(Tesseract *lang_tesseract)
Definition: equationdetect.cpp:123
BLOBNBOX::set_special_text_type
void set_special_text_type(BlobSpecialTextType new_type)
Definition: blobbox.h:291
tesseract::EquationDetect::SplitCPHor
void SplitCPHor(ColPartition *part, GenericVector< ColPartition * > *parts_splitted)
Definition: equationdetect.cpp:647
BSTT_MATH
Definition: blobbox.h:99
BLOBNBOX
Definition: blobbox.h:142
tesseract::CCUtil::unicharset
UNICHARSET unicharset
Definition: ccutil.h:57
BSTT_DIGIT
Definition: blobbox.h:98
tesseract::EquationDetect::EquationDetect
EquationDetect(const char *equ_datapath, const char *equ_language)
Definition: equationdetect.cpp:102
CHECK
#define CHECK(test)
Definition: include_gunit.h:57
tesseract::EquationDetect::EstimateTypeForUnichar
BlobSpecialTextType EstimateTypeForUnichar(const UNICHARSET &unicharset, const UNICHAR_ID id) const
Definition: equationdetect.cpp:224
tesseract::EquationDetect::IsNearSmallNeighbor
bool IsNearSmallNeighbor(const TBOX &seed_box, const TBOX &part_box) const
Definition: equationdetect.cpp:1270
UNICHARSET::unichar_to_id
UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
Definition: unicharset.cpp:209
tesseract::EquationDetect::SplitCPHorLite
void SplitCPHorLite(ColPartition *part, GenericVector< TBOX > *splitted_boxes)
Definition: equationdetect.cpp:697
tesseract::EquationDetect::IdentifySpecialText
void IdentifySpecialText()
Definition: equationdetect.cpp:258
tesseract::EquationDetect::CountAlignment
int CountAlignment(const GenericVector< int > &sorted_vec, const int val) const
Definition: equationdetect.cpp:759
UNICHARSET
Definition: unicharset.h:145
tesseract::EquationDetect::IsIndented
IndentType IsIndented(ColPartition *part)
Definition: equationdetect.cpp:1020
tesseract::EquationDetect::cps_super_bbox_
TBOX * cps_super_bbox_
Definition: equationdetect.h:259
tesseract::EquationDetect::ComputeForegroundDensity
float ComputeForegroundDensity(const TBOX &tbox)
Definition: equationdetect.cpp:611
tesseract::EquationDetect::lang_tesseract_
Tesseract * lang_tesseract_
Definition: equationdetect.h:247
tesseract::EquationDetect::CheckSeedBlobsCount
bool CheckSeedBlobsCount(ColPartition *part)
Definition: equationdetect.cpp:983
tesseract::Tesseract::mutable_pix_binary
Pix ** mutable_pix_binary()
Definition: tesseractclass.h:196
tesseract::EquationDetect::ComputeCPsSuperBBox
void ComputeCPsSuperBBox()
Definition: equationdetect.cpp:791
tesseract::EquationDetect::part_grid_
ColPartitionGrid * part_grid_
Definition: equationdetect.h:251
CHECK_LE
#define CHECK_LE(test, value)
Definition: include_gunit.h:61
count
int count(LIST var_list)
Definition: oldlist.cpp:79
BSTT_NONE
Definition: blobbox.h:96
CHECK_EQ
#define CHECK_EQ(test, value)
Definition: include_gunit.h:58