tesseract v5.3.3.20231005
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 (Image pix, BLOBNBOX *blob)
 

Detailed Description

Definition at line 35 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 ( Image  pix,
BLOBNBOX blob 
)
static

Definition at line 37 of file equationdetectbase.cpp.

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

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