All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
feature_base.h
Go to the documentation of this file.
1 /**********************************************************************
2  * File: feature_base.h
3  * Description: Declaration of the Feature Base Class
4  * Author: Ping Ping (xiupingping), Ahmad Abdulkader
5  * Created: 2007
6  *
7  * (C) Copyright 2008, 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 // The FeatureBase class is the base class for any Feature Extraction class
21 // It provided 3 pure virtual functions (to inherit):
22 // 1- FeatureCnt: A method to returns the count of features
23 // 2- ComputeFeatures: A method to compute the features for a given CharSamp
24 // 3- ComputeFeatureBitmap: A method to render a visualization of the features
25 // to a CharSamp. This is mainly used by visual-debuggers
26 
27 #ifndef FEATURE_BASE_H
28 #define FEATURE_BASE_H
29 
30 #include "char_samp.h"
31 #include "tuning_params.h"
32 
33 namespace tesseract {
34 class FeatureBase {
35  public:
36  explicit FeatureBase(TuningParams *params)
37  : params_(params) {
38  }
39  virtual ~FeatureBase() {}
40 
41  // Compute the features for a given CharSamp
42  virtual bool ComputeFeatures(CharSamp *char_samp, float *features) = 0;
43  // Render a visualization of the features to a CharSamp.
44  // This is mainly used by visual-debuggers
45  virtual CharSamp *ComputeFeatureBitmap(CharSamp *char_samp) = 0;
46  // Returns the count of features
47  virtual int FeatureCnt() = 0;
48 
49  protected:
51 };
52 }
53 
54 #endif // FEATURE_BASE_H
55 
FeatureBase(TuningParams *params)
Definition: feature_base.h:36
virtual bool ComputeFeatures(CharSamp *char_samp, float *features)=0
virtual CharSamp * ComputeFeatureBitmap(CharSamp *char_samp)=0
TuningParams * params_
Definition: feature_base.h:50
virtual int FeatureCnt()=0