tesseract  v4.0.0-17-g361f3264
Open Source OCR Engine
equationdetectbase.h
1 // 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 //
19 
20 #ifndef TESSERACT_TEXTORD_EQUATIONDETECTBASE_H_
21 #define TESSERACT_TEXTORD_EQUATIONDETECTBASE_H_
22 
23 class BLOBNBOX_LIST;
24 class TO_BLOCK;
25 struct Pix;
26 
27 namespace tesseract {
28 
29 class ColPartitionGrid;
30 class ColPartitionSet;
31 
33  public:
34  EquationDetectBase() = default;
35  virtual ~EquationDetectBase();
36 
37  // Iterate over the blobs inside to_block, and set the blobs that we want to
38  // process to BSTT_NONE. (By default, they should be BSTT_SKIP). The function
39  // returns 0 upon success.
40  virtual int LabelSpecialText(TO_BLOCK* to_block) = 0;
41 
42  // Interface to find possible equation partition grid from part_grid. This
43  // should be called after IdentifySpecialText function.
44  virtual int FindEquationParts(ColPartitionGrid* part_grid,
45  ColPartitionSet** best_columns) = 0;
46 
47  // Debug function: Render a bounding box on pix based on the value of its
48  // special_text_type, specifically:
49  // BSTT_MATH: red box
50  // BSTT_DIGIT: cyan box
51  // BSTT_ITALIC: green box
52  // BSTT_UNCLEAR: blue box
53  // All others: yellow box
54  static void RenderSpecialText(Pix* pix, BLOBNBOX* blob);
55 };
56 
57 } // namespace tesseract
58 
59 #endif // TESSERACT_TEXTORD_EQUATIONDETECTBASE_H_
Definition: colpartitiongrid.h:33
Definition: colpartitionset.h:40
Definition: equationdetectbase.h:32
Definition: baseapi.cpp:94
Definition: blobbox.h:144
static void RenderSpecialText(Pix *pix, BLOBNBOX *blob)
Definition: equationdetectbase.cpp:31
virtual int LabelSpecialText(TO_BLOCK *to_block)=0
virtual int FindEquationParts(ColPartitionGrid *part_grid, ColPartitionSet **best_columns)=0
Definition: blobbox.h:705