Tesseract  3.02
tesseract-ocr/cube/feature_hybrid.h
Go to the documentation of this file.
00001 /**********************************************************************
00002  * File:        feature_chebyshev.h
00003  * Description: Declaration of the Chebyshev coefficients Feature Class
00004  * Author:    Ahmad Abdulkader
00005  * Created:   2008
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 FeatureHybrid class implements a Bitmap feature extractor class. It
00021 // inherits from the FeatureBase class
00022 // This class describes the a hybrid feature vector composed by combining
00023 // the bitmap and the chebyshev feature vectors
00024 
00025 #ifndef FEATURE_HYBRID_H
00026 #define FEATURE_HYBRID_H
00027 
00028 #include "char_samp.h"
00029 #include "feature_bmp.h"
00030 #include "feature_chebyshev.h"
00031 
00032 namespace tesseract {
00033 class FeatureHybrid : public FeatureBase {
00034  public:
00035   explicit FeatureHybrid(TuningParams *params);
00036   virtual ~FeatureHybrid();
00037   // Render a visualization of the features to a CharSamp.
00038   // This is mainly used by visual-debuggers
00039   virtual CharSamp *ComputeFeatureBitmap(CharSamp *samp);
00040   // Compute the features for a given CharSamp
00041   virtual bool ComputeFeatures(CharSamp *samp, float *features);
00042   // Returns the count of features
00043   virtual int FeatureCnt() {
00044     if (feature_bmp_ == NULL || feature_chebyshev_ == NULL) {
00045       return 0;
00046     }
00047     return feature_bmp_->FeatureCnt() + feature_chebyshev_->FeatureCnt();
00048   }
00049 
00050  protected:
00051   FeatureBmp *feature_bmp_;
00052   FeatureChebyshev *feature_chebyshev_;
00053 };
00054 }
00055 
00056 #endif  // FEATURE_HYBRID_H