All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
feature_bmp.h
Go to the documentation of this file.
1 /**********************************************************************
2  * File: feature_bmp.h
3  * Description: Declaration of the Bitmap Feature Class
4  * Author: PingPing xiu (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 FeatureBmp class implements a Bitmap feature extractor class. It
21 // inherits from the FeatureBase class
22 // The Bitmap feature vectors is the the bitmap of the specified CharSamp
23 // scaled to a fixed grid size and then augmented by a 5 aux features that
24 // describe the size, aspect ration and placement within a word
25 
26 #ifndef FEATURE_BMP_H
27 #define FEATURE_BMP_H
28 
29 #include "char_samp.h"
30 #include "feature_base.h"
31 
32 namespace tesseract {
33 class FeatureBmp : public FeatureBase {
34  public:
35  explicit FeatureBmp(TuningParams *params);
36  virtual ~FeatureBmp();
37  // Render a visualization of the features to a CharSamp.
38  // This is mainly used by visual-debuggers
39  virtual CharSamp *ComputeFeatureBitmap(CharSamp *samp);
40  // Compute the features for a given CharSamp
41  virtual bool ComputeFeatures(CharSamp *samp, float *features);
42  // Returns the count of features
43  virtual int FeatureCnt() {
44  return 5 + (conv_grid_size_ * conv_grid_size_);
45  }
46 
47  protected:
48  // grid size, cached from the TuningParams object
50 };
51 }
52 
53 #endif // FEATURE_BMP_H
virtual CharSamp * ComputeFeatureBitmap(CharSamp *samp)
Definition: feature_bmp.cpp:41
virtual bool ComputeFeatures(CharSamp *samp, float *features)
Definition: feature_bmp.cpp:46
FeatureBmp(TuningParams *params)
Definition: feature_bmp.cpp:31
virtual int FeatureCnt()
Definition: feature_bmp.h:43