tesseract  5.0.0-alpha-619-ge9db
tesseract::EquationDetectBase Class Referenceabstract

#include <equationdetectbase.h>

Inheritance diagram for tesseract::EquationDetectBase:
tesseract::EquationDetect tesseract::TestableEquationDetect

Public Member Functions

 EquationDetectBase ()=default
 
virtual ~EquationDetectBase ()
 
virtual int LabelSpecialText (TO_BLOCK *to_block)=0
 
virtual int FindEquationParts (ColPartitionGrid *part_grid, ColPartitionSet **best_columns)=0
 

Static Public Member Functions

static void RenderSpecialText (Pix *pix, BLOBNBOX *blob)
 

Detailed Description

Definition at line 32 of file equationdetectbase.h.

Constructor & Destructor Documentation

◆ EquationDetectBase()

tesseract::EquationDetectBase::EquationDetectBase ( )
default

◆ ~EquationDetectBase()

tesseract::EquationDetectBase::~EquationDetectBase ( )
virtualdefault

Member Function Documentation

◆ FindEquationParts()

virtual int tesseract::EquationDetectBase::FindEquationParts ( ColPartitionGrid part_grid,
ColPartitionSet **  best_columns 
)
pure virtual

Implemented in tesseract::EquationDetect.

◆ LabelSpecialText()

virtual int tesseract::EquationDetectBase::LabelSpecialText ( TO_BLOCK to_block)
pure virtual

Implemented in tesseract::EquationDetect.

◆ RenderSpecialText()

void tesseract::EquationDetectBase::RenderSpecialText ( Pix *  pix,
BLOBNBOX blob 
)
static

Definition at line 31 of file equationdetectbase.cpp.

32  {
33  ASSERT_HOST(pix != nullptr && pixGetDepth(pix) == 32 && blob != nullptr);
34  const TBOX& tbox = blob->bounding_box();
35  int height = pixGetHeight(pix);
36  const int box_width = 5;
37 
38  // Coordinate translation: tesseract use left bottom as the original, while
39  // leptonica uses left top as the original.
40  Box *box = boxCreate(tbox.left(), height - tbox.top(),
41  tbox.width(), tbox.height());
42  switch (blob->special_text_type()) {
43  case BSTT_MATH: // Red box.
44  pixRenderBoxArb(pix, box, box_width, 255, 0, 0);
45  break;
46  case BSTT_DIGIT: // cyan box.
47  pixRenderBoxArb(pix, box, box_width, 0, 255, 255);
48  break;
49  case BSTT_ITALIC: // Green box.
50  pixRenderBoxArb(pix, box, box_width, 0, 255, 0);
51  break;
52  case BSTT_UNCLEAR: // blue box.
53  pixRenderBoxArb(pix, box, box_width, 0, 255, 0);
54  break;
55  case BSTT_NONE:
56  default:
57  // yellow box.
58  pixRenderBoxArb(pix, box, box_width, 255, 255, 0);
59  break;
60  }
61  boxDestroy(&box);
62 }

The documentation for this class was generated from the following files:
ASSERT_HOST
#define ASSERT_HOST(x)
Definition: errcode.h:87
TBOX::top
int16_t top() const
Definition: rect.h:57
BSTT_MATH
Definition: blobbox.h:99
BSTT_DIGIT
Definition: blobbox.h:98
TBOX::height
int16_t height() const
Definition: rect.h:107
BSTT_UNCLEAR
Definition: blobbox.h:100
BLOBNBOX::special_text_type
BlobSpecialTextType special_text_type() const
Definition: blobbox.h:288
TBOX::width
int16_t width() const
Definition: rect.h:114
BLOBNBOX::bounding_box
const TBOX & bounding_box() const
Definition: blobbox.h:229
TBOX::left
int16_t left() const
Definition: rect.h:71
BSTT_ITALIC
Definition: blobbox.h:97
BSTT_NONE
Definition: blobbox.h:96
TBOX
Definition: rect.h:33