tesseract 5.2.0
Loading...
Searching...
No Matches
tesseract::EquationFinderTest Class Reference
Inheritance diagram for tesseract::EquationFinderTest:

Protected Member Functions

void SetUp () override
 
void TearDown () override
 
void AddPageBlock (Image 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 115 of file equationdetect_test.cc.

Member Function Documentation

◆ AddBlobIntoPart()

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

Definition at line 172 of file equationdetect_test.cc.

172 {
173 CHECK(part != nullptr);
174 auto *blob = new BLOBNBOX();
175 blob->set_bounding_box(tbox);
176 part->AddBox(blob);
177 }
#define CHECK(condition)
Definition: include_gunit.h:76

◆ AddPageBlock()

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

Definition at line 140 of file equationdetect_test.cc.

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

◆ ClearParts()

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

Definition at line 164 of file equationdetect_test.cc.

164 {
165 for (auto &all_part : *all_parts) {
166 all_part->DeleteBoxes();
167 delete all_part;
168 }
169 }

◆ CreateColParts()

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

Definition at line 149 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);
158 part_grid->InsertBBox(true, true, part);
159 all_parts->push_back(part);
160 }
161 }
162 }
@ TBOX
@ BRT_TEXT
Definition: blobbox.h:82
@ BTFT_NONE
Definition: blobbox.h:111
@ PT_FLOWING_TEXT
Definition: publictypes.h:53
static ColPartition * FakePartition(const TBOX &box, PolyBlockType block_type, BlobRegionType blob_type, BlobTextFlowType flow)
void ClearParts(std::vector< ColPartition * > *all_parts)

◆ SetUp()

void tesseract::EquationFinderTest::SetUp ( )
inlineoverrideprotected

Definition at line 123 of file equationdetect_test.cc.

123 {
124 std::locale::global(std::locale(""));
125 tesseract_ = std::make_unique<Tesseract>();
126 tesseract_->init_tesseract(TESSDATA_DIR, "eng", OEM_TESSERACT_ONLY);
127 tesseract_->set_source_resolution(300);
128 equation_det_ = std::make_unique<TestableEquationDetect>(TESSDATA_DIR, tesseract_.get());
129 equation_det_->SetResolution(300);
130
131 testdata_dir_ = TESTDATA_DIR;
132 }
@ OEM_TESSERACT_ONLY
Definition: publictypes.h:264
std::unique_ptr< Tesseract > tesseract_
std::unique_ptr< TestableEquationDetect > equation_det_

◆ TearDown()

void tesseract::EquationFinderTest::TearDown ( )
inlineoverrideprotected

Definition at line 134 of file equationdetect_test.cc.

134 {
135 tesseract_.reset(nullptr);
136 equation_det_.reset(nullptr);
137 }

Member Data Documentation

◆ equation_det_

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

Definition at line 117 of file equationdetect_test.cc.

◆ tesseract_

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

Definition at line 118 of file equationdetect_test.cc.

◆ testdata_dir_

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

Definition at line 121 of file equationdetect_test.cc.


The documentation for this class was generated from the following file: