1 /////////////////////////////////////////////////////////////////////// 2 // File: equationdetectbase.h 3 // Description: The base class equation detection class. 4 // Author: Zongyi (Joe) Liu (joeliu@google.com) 5 // Created: Fri Aug 31 11:13:01 PST 2011 6 // 7 // (C) Copyright 2011, Google Inc. 8 // Licensed under the Apache License, Version 2.0 (the "License"); 9 // you may not use this file except in compliance with the License. 10 // You may obtain a copy of the License at 11 // http://www.apache.org/licenses/LICENSE-2.0 12 // Unless required by applicable law or agreed to in writing, software 13 // distributed under the License is distributed on an "AS IS" BASIS, 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 // See the License for the specific language governing permissions and 16 // limitations under the License. 17 // 18 /////////////////////////////////////////////////////////////////////// 19 20 #ifndef TESSERACT_TEXTORD_EQUATIONDETECTBASE_H_ 21 #define TESSERACT_TEXTORD_EQUATIONDETECTBASE_H_ 22 23 #include "image.h" 24 25 class BLOBNBOX_LIST; 26 class TO_BLOCK; 27 struct Pix; 28 29 namespace tesseract { 30 31 class ColPartitionGrid; 32 class ColPartitionSet; 33 class BLOBNBOX; 34 35 class TESS_API EquationDetectBase { 36 public: 37 EquationDetectBase() = default; 38 virtual ~EquationDetectBase(); 39 40 // Iterate over the blobs inside to_block, and set the blobs that we want to 41 // process to BSTT_NONE. (By default, they should be BSTT_SKIP). The function 42 // returns 0 upon success. 43 virtual int LabelSpecialText(TO_BLOCK *to_block) = 0; 44 45 // Interface to find possible equation partition grid from part_grid. This 46 // should be called after IdentifySpecialText function. 47 virtual int FindEquationParts(ColPartitionGrid *part_grid, ColPartitionSet **best_columns) = 0; 48 49 // Debug function: Render a bounding box on pix based on the value of its 50 // special_text_type, specifically: 51 // BSTT_MATH: red box 52 // BSTT_DIGIT: cyan box 53 // BSTT_ITALIC: green box 54 // BSTT_UNCLEAR: blue box 55 // All others: yellow box 56 static void RenderSpecialText(Image pix, BLOBNBOX *blob); 57 }; 58 59 } // namespace tesseract 60 61 #endif // TESSERACT_TEXTORD_EQUATIONDETECTBASE_H_ 62