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
tessclassifier.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: tessclassifier.h
5 // Description: Tesseract implementation of a ShapeClassifier.
6 // Author: Ray Smith
7 // Created: Tue Nov 22 14:10:45 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_CLASSIFY_TESSCLASSIFIER_H_
23 #define THIRD_PARTY_TESSERACT_CLASSIFY_TESSCLASSIFIER_H_
24
25 #include "shapeclassifier.h"
26
27 namespace tesseract {
28
29 class Classify;
30 class TrainingSample;
31
32 // Tesseract implementation of a ShapeClassifier.
33 // Due to limitations in the content of TrainingSample, this currently
34 // only works for the static classifier and only works if the ShapeTable
35 // in classify is not NULL.
36 class TessClassifier : public ShapeClassifier {
37 public:
38 TessClassifier(bool pruner_only, tesseract::Classify* classify)
39 : pruner_only_(pruner_only), classify_(classify) {}
40 virtual ~TessClassifier() {}
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 // Indicates that this classifier is to use just the ClassPruner, or the
52 // full classifier if false.
53 bool pruner_only_;
54 // Borrowed pointer to the actual Tesseract classifier.
55 tesseract::Classify* classify_;
56 };
57
58
59 } // namespace tesseract
60
61
62
63
64
65 #endif /* THIRD_PARTY_TESSERACT_CLASSIFY_TESSCLASSIFIER_H_ */