All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 struct UnicharRating;
36 
37 // Cube implementation of a ShapeClassifier.
39  public:
41  virtual ~CubeClassifier();
42 
43  // Classifies the given [training] sample, writing to results.
44  // See ShapeClassifier for a full description.
45  virtual int UnicharClassifySample(const TrainingSample& sample, Pix* page_pix,
46  int debug, UNICHAR_ID keep_this,
48  // Provides access to the ShapeTable that this classifier works with.
49  virtual const ShapeTable* GetShapeTable() const;
50 
51  private:
52  // Cube objects.
53  CubeRecoContext* cube_cntxt_;
54  const ShapeTable& shape_table_;
55 };
56 
57 // Combination of Tesseract class pruner with scoring by cube.
59  public:
61  virtual ~CubeTessClassifier();
62 
63  // Classifies the given [training] sample, writing to results.
64  // See ShapeClassifier for a full description.
65  virtual int UnicharClassifySample(const TrainingSample& sample, Pix* page_pix,
66  int debug, UNICHAR_ID keep_this,
68  // Provides access to the ShapeTable that this classifier works with.
69  virtual const ShapeTable* GetShapeTable() const;
70 
71  private:
72  // Cube objects.
73  CubeRecoContext* cube_cntxt_;
74  const ShapeTable& shape_table_;
75  TessClassifier* pruner_;
76 };
77 
78 } // namespace tesseract
79 
80 #endif /* THIRD_PARTY_TESSERACT_CCMAIN_CUBECLASSIFIER_H_ */
virtual int UnicharClassifySample(const TrainingSample &sample, Pix *page_pix, int debug, UNICHAR_ID keep_this, GenericVector< UnicharRating > *results)
virtual int UnicharClassifySample(const TrainingSample &sample, Pix *page_pix, int debug, UNICHAR_ID keep_this, GenericVector< UnicharRating > *results)
virtual const ShapeTable * GetShapeTable() const
int UNICHAR_ID
Definition: unichar.h:33
CubeClassifier(Tesseract *tesseract)
CubeTessClassifier(Tesseract *tesseract)
virtual const ShapeTable * GetShapeTable() const
Definition: cluster.h:32