Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
altlist.h
Go to the documentation of this file.
1
/**********************************************************************
2
* File: alt_list.h
3
* Description: Class to abstarct a list of alternate results
4
* Author: Ahmad Abdulkader
5
* Created: 2007
6
*
7
* (C) Copyright 2008, Google Inc.
8
** Licensed under the Apache License, Version 2.0 (the "License");
9
** you may not use this file except in compliance with the License.
10
** You may obtain a copy of the License at
11
** http://www.apache.org/licenses/LICENSE-2.0
12
** Unless required by applicable law or agreed to in writing, software
13
** distributed under the License is distributed on an "AS IS" BASIS,
14
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
** See the License for the specific language governing permissions and
16
** limitations under the License.
17
*
18
**********************************************************************/
19
20
// The AltList class is the base class for the list of alternate recognition
21
// results. Each alternate has a cost an an optional tag associated with it
22
23
#ifndef ALT_LIST_H
24
#define ALT_LIST_H
25
26
#include <math.h>
27
#include "
cube_utils.h
"
28
29
namespace
tesseract
{
30
class
AltList
{
31
public
:
32
explicit
AltList
(
int
max_alt);
33
virtual
~AltList
();
34
// sort the list of alternates based
35
virtual
void
Sort
() = 0;
36
// return the best possible cost and index of corresponding alternate
37
int
BestCost
(
int
*best_alt)
const
;
38
// return the count of alternates
39
inline
int
AltCount
()
const
{
return
alt_cnt_
; }
40
// returns the cost (-ve log prob) of an alternate
41
inline
int
AltCost
(
int
alt_idx)
const
{
return
alt_cost_
[alt_idx]; }
42
// returns the prob of an alternate
43
inline
double
AltProb
(
int
alt_idx)
const
{
44
return
CubeUtils::Cost2Prob
(
AltCost
(alt_idx));
45
}
46
// returns the alternate tag
47
inline
void
*
AltTag
(
int
alt_idx)
const
{
return
alt_tag_
[alt_idx]; }
48
49
protected
:
50
// max number of alternates the list can hold
51
int
max_alt_
;
52
// actual alternate count
53
int
alt_cnt_
;
54
// array of alternate costs
55
int
*
alt_cost_
;
56
// array of alternate tags
57
void
**
alt_tag_
;
58
};
59
}
60
61
#endif // ALT_LIST_H
tesseract::AltList::alt_tag_
void ** alt_tag_
Definition:
altlist.h:57
tesseract::AltList::AltCost
int AltCost(int alt_idx) const
Definition:
altlist.h:41
tesseract::AltList
Definition:
altlist.h:30
cube_utils.h
tesseract::AltList::AltList
AltList(int max_alt)
Definition:
altlist.cpp:25
tesseract::AltList::~AltList
virtual ~AltList()
Definition:
altlist.cpp:32
tesseract::AltList::alt_cnt_
int alt_cnt_
Definition:
altlist.h:53
tesseract::AltList::max_alt_
int max_alt_
Definition:
altlist.h:51
tesseract::AltList::BestCost
int BestCost(int *best_alt) const
Definition:
altlist.cpp:45
tesseract::AltList::alt_cost_
int * alt_cost_
Definition:
altlist.h:55
tesseract::CubeUtils::Cost2Prob
static double Cost2Prob(int cost)
Definition:
cube_utils.cpp:47
tesseract
Definition:
baseapi.cpp:83
tesseract::AltList::AltCount
int AltCount() const
Definition:
altlist.h:39
tesseract::AltList::AltTag
void * AltTag(int alt_idx) const
Definition:
altlist.h:47
tesseract::AltList::Sort
virtual void Sort()=0
tesseract::AltList::AltProb
double AltProb(int alt_idx) const
Definition:
altlist.h:43
cube
altlist.h
Generated on Mon Jul 20 2015 18:37:53 by
1.8.8