Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tessclassifier.cpp
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.cpp
5 // Description: Tesseract implementation of a ShapeClassifier.
6 // Author: Ray Smith
7 // Created: Tue Nov 22 14:16:25 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 #include "tessclassifier.h"
23 
24 #include "classify.h"
25 #include "trainingsample.h"
26 
27 namespace tesseract {
28 
29 // Classifies the given [training] sample, writing to results.
30 // See ShapeClassifier for a full description.
32  Pix* page_pix, int debug, int keep_this,
33  GenericVector<ShapeRating>* results) {
34  if (debug) {
35  classify_->matcher_debug_level.set_value(debug ? 2 : 0);
36  classify_->matcher_debug_flags.set_value(debug ? 25 : 0);
37  classify_->classify_debug_level.set_value(debug ? 3 : 0);
38  } else {
39  classify_->classify_debug_level.set_value(debug ? 2 : 0);
40  }
41  classify_->CharNormTrainingSample(pruner_only_, sample, results);
42  return results->size();
43 }
44 
45 // Provides access to the ShapeTable that this classifier works with.
47  return classify_->shape_table();
48 }
49 
50 } // namespace tesseract
51 
52