Tesseract  3.02
tesseract-ocr/classify/tessclassifier.h
Go to the documentation of this file.
00001 // Copyright 2011 Google Inc. All Rights Reserved.
00002 // Author: rays@google.com (Ray Smith)
00004 // File:        tessclassifier.h
00005 // Description: Tesseract implementation of a ShapeClassifier.
00006 // Author:      Ray Smith
00007 // Created:     Tue Nov 22 14:10:45 PST 2011
00008 //
00009 // (C) Copyright 2011, Google Inc.
00010 // Licensed under the Apache License, Version 2.0 (the "License");
00011 // you may not use this file except in compliance with the License.
00012 // You may obtain a copy of the License at
00013 // http://www.apache.org/licenses/LICENSE-2.0
00014 // Unless required by applicable law or agreed to in writing, software
00015 // distributed under the License is distributed on an "AS IS" BASIS,
00016 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017 // See the License for the specific language governing permissions and
00018 // limitations under the License.
00019 //
00021 
00022 #ifndef THIRD_PARTY_TESSERACT_CLASSIFY_TESSCLASSIFIER_H_
00023 #define THIRD_PARTY_TESSERACT_CLASSIFY_TESSCLASSIFIER_H_
00024 
00025 #include "shapeclassifier.h"
00026 
00027 namespace tesseract {
00028 
00029 class Classify;
00030 class TrainingSample;
00031 
00032 // Tesseract implementation of a ShapeClassifier.
00033 // Due to limitations in the content of TrainingSample, this currently
00034 // only works for the static classifier and only works if the ShapeTable
00035 // in classify is not NULL.
00036 class TessClassifier : public ShapeClassifier {
00037  public:
00038   TessClassifier(bool pruner_only, tesseract::Classify* classify)
00039     : pruner_only_(pruner_only), classify_(classify) {}
00040   virtual ~TessClassifier() {}
00041 
00042   // Classifies the given [training] sample, writing to results.
00043   // See ShapeClassifier for a full description.
00044   virtual int ClassifySample(const TrainingSample& sample, Pix* page_pix,
00045                              int debug, int keep_this,
00046                              GenericVector<ShapeRating>* results);
00047   // Provides access to the ShapeTable that this classifier works with.
00048   virtual const ShapeTable* GetShapeTable() const;
00049 
00050  private:
00051   // Indicates that this classifier is to use just the ClassPruner, or the
00052   // full classifier if false.
00053   bool pruner_only_;
00054   // Borrowed pointer to the actual Tesseract classifier.
00055   tesseract::Classify* classify_;
00056 };
00057 
00058 
00059 }  // namespace tesseract
00060 
00061 
00062 
00063 
00064 
00065 #endif /* THIRD_PARTY_TESSERACT_CLASSIFY_TESSCLASSIFIER_H_ */