Tesseract  3.02
tesseract-ocr/cube/feature_bmp.h
Go to the documentation of this file.
00001 /**********************************************************************
00002  * File:        feature_bmp.h
00003  * Description: Declaration of the Bitmap Feature Class
00004  * Author:    PingPing xiu (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 FeatureBmp class implements a Bitmap feature extractor class. It
00021 // inherits from the FeatureBase class
00022 // The Bitmap feature vectors is the the bitmap of the specified CharSamp
00023 // scaled to a fixed grid size and then augmented by a 5 aux features that
00024 // describe the size, aspect ration and placement within a word
00025 
00026 #ifndef FEATURE_BMP_H
00027 #define FEATURE_BMP_H
00028 
00029 #include "char_samp.h"
00030 #include "feature_base.h"
00031 
00032 namespace tesseract {
00033 class FeatureBmp : public FeatureBase {
00034  public:
00035   explicit FeatureBmp(TuningParams *params);
00036   virtual ~FeatureBmp();
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     return 5 + (conv_grid_size_ * conv_grid_size_);
00045   }
00046 
00047  protected:
00048   // grid size, cached from the TuningParams object
00049   int conv_grid_size_;
00050 };
00051 }
00052 
00053 #endif  // FEATURE_BMP_H