tesseract 4.1.1
Loading...
Searching...
No Matches
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}
@ BSTT_NONE
Definition: blobbox.h:97
@ BSTT_MATH
Definition: blobbox.h:100
@ BSTT_UNCLEAR
Definition: blobbox.h:101
@ BSTT_ITALIC
Definition: blobbox.h:98
@ BSTT_DIGIT
Definition: blobbox.h:99
#define ASSERT_HOST(x)
Definition: errcode.h:88
BlobSpecialTextType special_text_type() const
Definition: blobbox.h:289
const TBOX & bounding_box() const
Definition: blobbox.h:230
Definition: rect.h:34
int16_t top() const
Definition: rect.h:58
int16_t width() const
Definition: rect.h:115
int16_t height() const
Definition: rect.h:108
int16_t left() const
Definition: rect.h:72

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