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
cubeclassifier.h
Go to the documentation of this file.
1 // Copyright 2011 Google Inc. All Rights Reserved.
2 // Author: rays@google.com (Ray Smith)
4 // File: cubeclassifier.h
5 // Description: Cube implementation of a ShapeClassifier.
6 // Author: Ray Smith
7 // Created: Wed Nov 23 10:36:32 PST 2011
8 //
9 // (C) Copyright 2011, Google Inc.
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 // http://www.apache.org/licenses/LICENSE-2.0
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 //
21
22 #ifndef THIRD_PARTY_TESSERACT_CCMAIN_CUBECLASSIFIER_H_
23 #define THIRD_PARTY_TESSERACT_CCMAIN_CUBECLASSIFIER_H_
24
25 #include "shapeclassifier.h"
26
27 namespace tesseract {
28
29 class Classify;
30 class CubeRecoContext;
31 class ShapeTable;
32 class TessClassifier;
33 class Tesseract;
34 class TrainingSample;
35
36 // Cube implementation of a ShapeClassifier.
37 class CubeClassifier : public ShapeClassifier {
38 public:
39 explicit CubeClassifier(Tesseract* tesseract);
40 virtual ~CubeClassifier();
41
42 // Classifies the given [training] sample, writing to results.
43 // See ShapeClassifier for a full description.
44 virtual int ClassifySample(const TrainingSample& sample, Pix* page_pix,
45 int debug, int keep_this,
46 GenericVector<ShapeRating>* results);
47 // Provides access to the ShapeTable that this classifier works with.
48 virtual const ShapeTable* GetShapeTable() const;
49
50 private:
51 // Cube objects.
52 CubeRecoContext* cube_cntxt_;
53 const ShapeTable& shape_table_;
54 };
55
56 // Combination of Tesseract class pruner with scoring by cube.
57 class CubeTessClassifier : public ShapeClassifier {
58 public:
59 explicit CubeTessClassifier(Tesseract* tesseract);
60 virtual ~CubeTessClassifier();
61
62 // Classifies the given [training] sample, writing to results.
63 // See ShapeClassifier for a full description.
64 virtual int ClassifySample(const TrainingSample& sample, Pix* page_pix,
65 int debug, int keep_this,
66 GenericVector<ShapeRating>* results);
67 // Provides access to the ShapeTable that this classifier works with.
68 virtual const ShapeTable* GetShapeTable() const;
69
70 private:
71 // Cube objects.
72 CubeRecoContext* cube_cntxt_;
73 const ShapeTable& shape_table_;
74 TessClassifier* pruner_;
75 };
76
77 } // namespace tesseract
78
79 #endif /* THIRD_PARTY_TESSERACT_CCMAIN_CUBECLASSIFIER_H_ */