Tesseract  3.02
tesseract-ocr/cube/feature_base.h
Go to the documentation of this file.
00001 /**********************************************************************
00002  * File:        feature_base.h
00003  * Description: Declaration of the Feature Base Class
00004  * Author:    Ping Ping (xiupingping), Ahmad Abdulkader
00005  * Created:   2007
00006  *
00007  * (C) Copyright 2008, 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  *
00018  **********************************************************************/
00019 
00020 // The FeatureBase class is the base class for any Feature Extraction class
00021 // It provided 3 pure virtual functions (to inherit):
00022 // 1- FeatureCnt: A method to returns the count of features
00023 // 2- ComputeFeatures: A method to compute the features for a given CharSamp
00024 // 3- ComputeFeatureBitmap: A method to render a visualization of the features
00025 // to a CharSamp. This is mainly used by visual-debuggers
00026 
00027 #ifndef FEATURE_BASE_H
00028 #define FEATURE_BASE_H
00029 
00030 #include "char_samp.h"
00031 #include "tuning_params.h"
00032 
00033 namespace tesseract {
00034 class FeatureBase {
00035  public:
00036   explicit FeatureBase(TuningParams *params)
00037       : params_(params) {
00038   }
00039   virtual ~FeatureBase() {}
00040 
00041   // Compute the features for a given CharSamp
00042   virtual bool ComputeFeatures(CharSamp *char_samp, float *features) = 0;
00043   // Render a visualization of the features to a CharSamp.
00044   // This is mainly used by visual-debuggers
00045   virtual CharSamp *ComputeFeatureBitmap(CharSamp *char_samp) = 0;
00046   // Returns the count of features
00047   virtual int FeatureCnt() = 0;
00048 
00049  protected:
00050   TuningParams *params_;
00051 };
00052 }
00053 
00054 #endif  // FEATURE_BASE_H
00055