tesseract  3.05.02
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 #include "platform.h"
27 
28 namespace tesseract {
29 
30 class Classify;
31 class CubeRecoContext;
32 class ShapeTable;
33 class TessClassifier;
34 class Tesseract;
35 class TrainingSample;
36 struct UnicharRating;
37 
38 // Cube implementation of a ShapeClassifier.
40  public:
42  virtual ~CubeClassifier();
43 
44  // Classifies the given [training] sample, writing to results.
45  // See ShapeClassifier for a full description.
46  virtual int UnicharClassifySample(const TrainingSample& sample, Pix* page_pix,
47  int debug, UNICHAR_ID keep_this,
49  // Provides access to the ShapeTable that this classifier works with.
50  virtual const ShapeTable* GetShapeTable() const;
51 
52  private:
53  // Cube objects.
54  CubeRecoContext* cube_cntxt_;
55  const ShapeTable& shape_table_;
56 };
57 
58 // Combination of Tesseract class pruner with scoring by cube.
60  public:
62  virtual ~CubeTessClassifier();
63 
64  // Classifies the given [training] sample, writing to results.
65  // See ShapeClassifier for a full description.
66  virtual int UnicharClassifySample(const TrainingSample& sample, Pix* page_pix,
67  int debug, UNICHAR_ID keep_this,
69  // Provides access to the ShapeTable that this classifier works with.
70  virtual const ShapeTable* GetShapeTable() const;
71 
72  private:
73  // Cube objects.
74  CubeRecoContext* cube_cntxt_;
75  const ShapeTable& shape_table_;
76  TessClassifier* pruner_;
77 };
78 
79 } // namespace tesseract
80 
81 #endif /* THIRD_PARTY_TESSERACT_CCMAIN_CUBECLASSIFIER_H_ */
#define TESS_API
Definition: platform.h:81
Definition: cluster.h:32
int UNICHAR_ID
Definition: unichar.h:33