tesseract  4.0.0-1-g2a2b
tesseract::EquationDetectBase Class Referenceabstract

#include <equationdetectbase.h>

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

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 }
Definition: rect.h:34
int16_t width() const
Definition: rect.h:115
int16_t left() const
Definition: rect.h:72
int16_t top() const
Definition: rect.h:58
BlobSpecialTextType special_text_type() const
Definition: blobbox.h:290
const TBOX & bounding_box() const
Definition: blobbox.h:231
int16_t height() const
Definition: rect.h:108
#define ASSERT_HOST(x)
Definition: errcode.h:84

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