Tesseract  3.02
tesseract-ocr/textord/equationdetectbase.h
Go to the documentation of this file.
00001 
00002 // File:        equationdetectbase.h
00003 // Description: The base class equation detection class.
00004 // Author:      Zongyi (Joe) Liu (joeliu@google.com)
00005 // Created:     Fri Aug 31 11:13:01 PST 2011
00006 //
00007 // (C) Copyright 2011, Google Inc.
00008 // Licensed under the Apache License, Version 2.0 (the "License");
00009 // you may not use this file except in compliance with the License.
00010 // You may obtain a copy of the License at
00011 // http://www.apache.org/licenses/LICENSE-2.0
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 //
00019 
00020 #ifndef TESSERACT_TEXTORD_EQUATIONDETECTBASE_H__
00021 #define TESSERACT_TEXTORD_EQUATIONDETECTBASE_H__
00022 
00023 class BLOBNBOX_LIST;
00024 class TO_BLOCK;
00025 struct Pix;
00026 
00027 namespace tesseract {
00028 
00029 class ColPartitionGrid;
00030 class ColPartitionSet;
00031 
00032 class EquationDetectBase {
00033  public:
00034   EquationDetectBase();
00035   virtual ~EquationDetectBase();
00036 
00037   // Iterate over the blobs inside to_block, and set the blobs that we want to
00038   // process to BSTT_NONE. (By default, they should be BSTT_SKIP). The function
00039   // returns 0 upon success.
00040   virtual int LabelSpecialText(TO_BLOCK* to_block) = 0;
00041 
00042   // Interface to find possible equation partition grid from part_grid. This
00043   // should be called after IdentifySpecialText function.
00044   virtual int FindEquationParts(ColPartitionGrid* part_grid,
00045                                 ColPartitionSet** best_columns) = 0;
00046 
00047   // Debug function: Render a bounding box on pix based on the value of its
00048   // special_text_type, specifically:
00049   // BSTT_MATH: red box
00050   // BSTT_DIGIT: cyan box
00051   // BSTT_ITALIC: green box
00052   // BSTT_UNCLEAR: blue box
00053   // All others: yellow box
00054   static void RenderSpecialText(Pix* pix, BLOBNBOX* blob);
00055 };
00056 
00057 };  // namespace tesseract
00058 
00059 #endif  // TESSERACT_TEXTORD_EQUATIONDETECTBASE_H__