tesseract
3.05.02
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
#include "
platform.h
"
27
28
namespace
tesseract
{
29
30
class
Classify;
31
class
TrainingSample;
32
33
// Tesseract implementation of a ShapeClassifier.
34
// Due to limitations in the content of TrainingSample, this currently
35
// only works for the static classifier and only works if the ShapeTable
36
// in classify is not NULL.
37
class
TESS_API
TessClassifier
:
public
ShapeClassifier
{
38
public
:
39
TessClassifier
(
bool
pruner_only,
tesseract::Classify
* classify)
40
: pruner_only_(pruner_only), classify_(classify) {}
41
virtual
~TessClassifier
() {}
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,
47
GenericVector<UnicharRating>
* results);
48
// Provides access to the ShapeTable that this classifier works with.
49
virtual
const
ShapeTable
* GetShapeTable()
const
;
50
// Provides access to the UNICHARSET that this classifier works with.
51
// Only needs to be overridden if GetShapeTable() can return NULL.
52
virtual
const
UNICHARSET
& GetUnicharset()
const
;
53
54
// Displays classification as the given shape_id. Creates as many windows
55
// as it feels fit, using index as a guide for placement. Adds any created
56
// windows to the windows output and returns a new index that may be used
57
// by any subsequent classifiers. Caller waits for the user to view and
58
// then destroys the windows by clearing the vector.
59
virtual
int
DisplayClassifyAs(
const
TrainingSample
&
sample
, Pix* page_pix,
60
int
unichar_id,
int
index,
61
PointerVector<ScrollView>
* windows);
62
63
private
:
64
// Indicates that this classifier is to use just the ClassPruner, or the
65
// full classifier if false.
66
bool
pruner_only_;
67
// Borrowed pointer to the actual Tesseract classifier.
68
tesseract::Classify
* classify_;
69
};
70
71
72
}
// namespace tesseract
73
74
75
76
77
78
#endif
/* THIRD_PARTY_TESSERACT_CLASSIFY_TESSCLASSIFIER_H_ */
shapeclassifier.h
tesseract::TessClassifier::~TessClassifier
virtual ~TessClassifier()
Definition:
tessclassifier.h:41
GenericVector< UnicharRating >
TESS_API
#define TESS_API
Definition:
platform.h:81
tesseract::TrainingSample
Definition:
trainingsample.h:53
tesseract::PointerVector
Definition:
genericvector.h:432
UNICHARSET
Definition:
unicharset.h:139
tesseract::TessClassifier::TessClassifier
TessClassifier(bool pruner_only, tesseract::Classify *classify)
Definition:
tessclassifier.h:39
tesseract
Definition:
baseapi.cpp:81
tesseract::TessClassifier
Definition:
tessclassifier.h:37
platform.h
tesseract::ShapeTable
Definition:
shapetable.h:264
sample
Definition:
cluster.h:32
tesseract::Classify
Definition:
classify.h:61
tesseract::ShapeClassifier
Definition:
shapeclassifier.h:43
UNICHAR_ID
int UNICHAR_ID
Definition:
unichar.h:33
classify
tessclassifier.h
Generated on Mon Oct 29 2018 11:27:49 for tesseract by
1.8.14