tesseract  5.0.0-alpha-619-ge9db
tesseract::EquationFinderTest Class Reference
Inheritance diagram for tesseract::EquationFinderTest:

Protected Member Functions

void SetUp ()
 
void TearDown ()
 
void AddPageBlock (Pix *pix, BLOCK_LIST *blocks)
 
void CreateColParts (const int rows, const int cols, ColPartitionGrid *part_grid, std::vector< ColPartition * > *all_parts)
 
void ClearParts (std::vector< ColPartition * > *all_parts)
 
void AddBlobIntoPart (const TBOX &tbox, ColPartition *part)
 

Protected Attributes

std::unique_ptr< TestableEquationDetectequation_det_
 
std::unique_ptr< Tesseracttesseract_
 
std::string testdata_dir_
 

Detailed Description

Definition at line 112 of file equationdetect_test.cc.

Member Function Documentation

◆ AddBlobIntoPart()

void tesseract::EquationFinderTest::AddBlobIntoPart ( const TBOX tbox,
ColPartition part 
)
inlineprotected

Definition at line 173 of file equationdetect_test.cc.

173  {
174  CHECK(part != nullptr);
175  BLOBNBOX* blob = new BLOBNBOX();
176  blob->set_bounding_box(tbox);
177  part->AddBox(blob);
178  }

◆ AddPageBlock()

void tesseract::EquationFinderTest::AddPageBlock ( Pix *  pix,
BLOCK_LIST *  blocks 
)
inlineprotected

Definition at line 138 of file equationdetect_test.cc.

138  {
139  CHECK(pix != nullptr);
140  CHECK(blocks != nullptr);
141  BLOCK_IT block_it(blocks);
142  BLOCK* block =
143  new BLOCK("", true, 0, 0, 0, 0, pixGetWidth(pix), pixGetHeight(pix));
144  block_it.add_to_end(block);
145  }

◆ ClearParts()

void tesseract::EquationFinderTest::ClearParts ( std::vector< ColPartition * > *  all_parts)
inlineprotected

Definition at line 165 of file equationdetect_test.cc.

165  {
166  for (size_t i = 0; i < all_parts->size(); ++i) {
167  (*all_parts)[i]->DeleteBoxes();
168  delete ((*all_parts)[i]);
169  }
170  }

◆ CreateColParts()

void tesseract::EquationFinderTest::CreateColParts ( const int  rows,
const int  cols,
ColPartitionGrid part_grid,
std::vector< ColPartition * > *  all_parts 
)
inlineprotected

Definition at line 148 of file equationdetect_test.cc.

150  {
151  const int kWidth = 10, kHeight = 10;
152  ClearParts(all_parts);
153  for (int y = 0; y < rows; ++y) {
154  for (int x = 0; x < cols; ++x) {
155  int left = x * kWidth * 2, bottom = y * kHeight * 2;
156  TBOX box(left, bottom, left + kWidth, bottom + kHeight);
157  ColPartition* part = ColPartition::FakePartition(box, PT_FLOWING_TEXT,
159  part_grid->InsertBBox(true, true, part);
160  all_parts->push_back(part);
161  }
162  }
163  }

◆ SetUp()

void tesseract::EquationFinderTest::SetUp ( )
inlineprotected

Definition at line 120 of file equationdetect_test.cc.

120  {
121  std::locale::global(std::locale(""));
122  tesseract_.reset(new Tesseract());
123  tesseract_->init_tesseract(TESSDATA_DIR, "eng", OEM_TESSERACT_ONLY);
124  tesseract_->set_source_resolution(300);
125  equation_det_.reset(
126  new TestableEquationDetect(TESSDATA_DIR, tesseract_.get()));
127  equation_det_->SetResolution(300);
128 
129  testdata_dir_ = TESTDATA_DIR;
130  }

◆ TearDown()

void tesseract::EquationFinderTest::TearDown ( )
inlineprotected

Definition at line 132 of file equationdetect_test.cc.

132  {
133  tesseract_.reset(nullptr);
134  equation_det_.reset(nullptr);
135  }

Member Data Documentation

◆ equation_det_

std::unique_ptr<TestableEquationDetect> tesseract::EquationFinderTest::equation_det_
protected

Definition at line 114 of file equationdetect_test.cc.

◆ tesseract_

std::unique_ptr<Tesseract> tesseract::EquationFinderTest::tesseract_
protected

Definition at line 115 of file equationdetect_test.cc.

◆ testdata_dir_

std::string tesseract::EquationFinderTest::testdata_dir_
protected

Definition at line 118 of file equationdetect_test.cc.


The documentation for this class was generated from the following file:
tesseract::EquationFinderTest::equation_det_
std::unique_ptr< TestableEquationDetect > equation_det_
Definition: equationdetect_test.cc:114
BTFT_NONE
Definition: blobbox.h:114
BLOBNBOX::set_bounding_box
void set_bounding_box(const TBOX &new_box)
Definition: blobbox.h:234
tesseract::EquationFinderTest::testdata_dir_
std::string testdata_dir_
Definition: equationdetect_test.cc:118
tesseract::EquationFinderTest::tesseract_
std::unique_ptr< Tesseract > tesseract_
Definition: equationdetect_test.cc:115
BLOBNBOX
Definition: blobbox.h:142
BLOCK
Definition: ocrblock.h:28
CHECK
#define CHECK(test)
Definition: include_gunit.h:57
tesseract::EquationFinderTest::ClearParts
void ClearParts(std::vector< ColPartition * > *all_parts)
Definition: equationdetect_test.cc:165
BRT_TEXT
Definition: blobbox.h:79
tesseract::ColPartition::FakePartition
static ColPartition * FakePartition(const TBOX &box, PolyBlockType block_type, BlobRegionType blob_type, BlobTextFlowType flow)
Definition: colpartition.cpp:95
PT_FLOWING_TEXT
Definition: capi.h:109
tesseract::OEM_TESSERACT_ONLY
Definition: publictypes.h:266
TBOX
Definition: rect.h:33