Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019
00020 #include "allheaders.h"
00021 #include "blobbox.h"
00022 #include "equationdetectbase.h"
00023
00024 namespace tesseract {
00025
00026 EquationDetectBase::EquationDetectBase() {
00027 }
00028
00029 EquationDetectBase::~EquationDetectBase() {
00030 }
00031
00032 void EquationDetectBase::RenderSpecialText(Pix* pix,
00033 BLOBNBOX* blob) {
00034 ASSERT_HOST(pix != NULL && pixGetDepth(pix) == 32 && blob != NULL);
00035 const TBOX& tbox = blob->bounding_box();
00036 int height = pixGetHeight(pix);
00037 const int box_width = 5;
00038
00039
00040
00041 Box *box = boxCreate(tbox.left(), height - tbox.top(),
00042 tbox.width(), tbox.height());
00043 switch (blob->special_text_type()) {
00044 case BSTT_MATH:
00045 pixRenderBoxArb(pix, box, box_width, 255, 0, 0);
00046 break;
00047 case BSTT_DIGIT:
00048 pixRenderBoxArb(pix, box, box_width, 0, 255, 255);
00049 break;
00050 case BSTT_ITALIC:
00051 pixRenderBoxArb(pix, box, box_width, 0, 255, 0);
00052 break;
00053 case BSTT_UNCLEAR:
00054 pixRenderBoxArb(pix, box, box_width, 0, 255, 0);
00055 break;
00056 case BSTT_NONE:
00057 default:
00058
00059 pixRenderBoxArb(pix, box, box_width, 255, 255, 0);
00060 break;
00061 }
00062 boxDestroy(&box);
00063 }
00064
00065 };