Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
feature_chebyshev.h
Go to the documentation of this file.
1 /**********************************************************************
2 * File: feature_chebyshev.h
3 * Description: Declaration of the Chebyshev coefficients Feature Class
4 * Author: Ahmad Abdulkader
5 * Created: 2008
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 FeatureChebyshev class implements a Bitmap feature extractor class. It
21 // inherits from the FeatureBase class
22 // The feature vector is the composed of the chebyshev coefficients of 4 time
23 // sequences. The time sequences are the left, top, right & bottom
24 // bitmap profiles of the input samples
25
26 #ifndef FEATURE_CHEBYSHEV_H
27 #define FEATURE_CHEBYSHEV_H
28
29 #include "char_samp.h"
30 #include "feature_base.h"
31
32 namespace tesseract {
33 class FeatureChebyshev : public FeatureBase {
34 public:
35 explicit FeatureChebyshev(TuningParams *params);
36 virtual ~FeatureChebyshev();
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 (4 * kChebychevCoefficientCnt);
45 }
46
47 protected:
48 static const int kChebychevCoefficientCnt = 40;
49 // Compute Chebychev coefficients for the specified vector
50 void ChebyshevCoefficients(const vector<float> &input,
51 int coeff_cnt, float *coeff);
52 // Compute the features for a given CharSamp
53 bool ComputeChebyshevCoefficients(CharSamp *samp, float *features);
54 };
55 }
56
57 #endif // FEATURE_CHEBYSHEV_H