~ubuntu-branches/ubuntu/vivid/tesseract/vivid

« back to all changes in this revision

Viewing changes to doc/html/a00937_source.html

  • Committer: Package Import Robot
  • Author(s): Jeff Breidenbach
  • Date: 2014-02-03 11:10:20 UTC
  • mfrom: (1.3.1) (19.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140203111020-igquodd7pjlp3uri
Tags: 3.03.01-1
* New upstream release, includes critical fix to PDF rendering
* Complete leptonlib transition (see bug #735509)
* Promote from experimental to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
2
<html xmlns="http://www.w3.org/1999/xhtml">
 
3
<head>
 
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
 
5
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
 
6
<title>tesseract: /usr/local/google/home/jbreiden/tesseract-ocr-read-only/classify/sampleiterator.h Source File</title>
 
7
 
 
8
<link href="tabs.css" rel="stylesheet" type="text/css"/>
 
9
<link href="doxygen.css" rel="stylesheet" type="text/css" />
 
10
<link href="navtree.css" rel="stylesheet" type="text/css"/>
 
11
<script type="text/javascript" src="jquery.js"></script>
 
12
<script type="text/javascript" src="resize.js"></script>
 
13
<script type="text/javascript" src="navtree.js"></script>
 
14
<script type="text/javascript">
 
15
  $(document).ready(initResizable);
 
16
</script>
 
17
<link href="search/search.css" rel="stylesheet" type="text/css"/>
 
18
<script type="text/javascript" src="search/search.js"></script>
 
19
<script type="text/javascript">
 
20
  $(document).ready(function() { searchBox.OnSelectItem(0); });
 
21
</script>
 
22
 
 
23
</head>
 
24
<body>
 
25
<div id="top"><!-- do not remove this div! -->
 
26
 
 
27
 
 
28
<div id="titlearea">
 
29
<table cellspacing="0" cellpadding="0">
 
30
 <tbody>
 
31
 <tr style="height: 56px;">
 
32
  
 
33
  
 
34
  <td style="padding-left: 0.5em;">
 
35
   <div id="projectname">tesseract
 
36
   &#160;<span id="projectnumber">3.03</span>
 
37
   </div>
 
38
   
 
39
  </td>
 
40
  
 
41
  
 
42
  
 
43
 </tr>
 
44
 </tbody>
 
45
</table>
 
46
</div>
 
47
 
 
48
<!-- Generated by Doxygen 1.7.6.1 -->
 
49
<script type="text/javascript">
 
50
var searchBox = new SearchBox("searchBox", "search",false,'Search');
 
51
</script>
 
52
  <div id="navrow1" class="tabs">
 
53
    <ul class="tablist">
 
54
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
 
55
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
 
56
      <li><a href="modules.html"><span>Modules</span></a></li>
 
57
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
 
58
      <li><a href="annotated.html"><span>Classes</span></a></li>
 
59
      <li class="current"><a href="files.html"><span>Files</span></a></li>
 
60
      <li>
 
61
        <div id="MSearchBox" class="MSearchBoxInactive">
 
62
        <span class="left">
 
63
          <img id="MSearchSelect" src="search/mag_sel.png"
 
64
               onmouseover="return searchBox.OnSearchSelectShow()"
 
65
               onmouseout="return searchBox.OnSearchSelectHide()"
 
66
               alt=""/>
 
67
          <input type="text" id="MSearchField" value="Search" accesskey="S"
 
68
               onfocus="searchBox.OnSearchFieldFocus(true)" 
 
69
               onblur="searchBox.OnSearchFieldFocus(false)" 
 
70
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
 
71
          </span><span class="right">
 
72
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
 
73
          </span>
 
74
        </div>
 
75
      </li>
 
76
    </ul>
 
77
  </div>
 
78
  <div id="navrow2" class="tabs2">
 
79
    <ul class="tablist">
 
80
      <li><a href="files.html"><span>File&#160;List</span></a></li>
 
81
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
 
82
    </ul>
 
83
  </div>
 
84
</div>
 
85
<div id="side-nav" class="ui-resizable side-nav-resizable">
 
86
  <div id="nav-tree">
 
87
    <div id="nav-tree-contents">
 
88
    </div>
 
89
  </div>
 
90
  <div id="splitbar" style="-moz-user-select:none;" 
 
91
       class="ui-resizable-handle">
 
92
  </div>
 
93
</div>
 
94
<script type="text/javascript">
 
95
  initNavTree('a00937.html','');
 
96
</script>
 
97
<div id="doc-content">
 
98
<div class="header">
 
99
  <div class="headertitle">
 
100
<div class="title">/usr/local/google/home/jbreiden/tesseract-ocr-read-only/classify/sampleiterator.h</div>  </div>
 
101
</div><!--header-->
 
102
<div class="contents">
 
103
<a href="a00937.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright 2011 Google Inc. All Rights Reserved.</span>
 
104
<a name="l00002"></a>00002 <span class="comment">// Author: rays@google.com (Ray Smith)</span>
 
105
<a name="l00003"></a>00003 <span class="comment">//</span>
 
106
<a name="l00004"></a>00004 <span class="comment">// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
 
107
<a name="l00005"></a>00005 <span class="comment">// you may not use this file except in compliance with the License.</span>
 
108
<a name="l00006"></a>00006 <span class="comment">// You may obtain a copy of the License at</span>
 
109
<a name="l00007"></a>00007 <span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span>
 
110
<a name="l00008"></a>00008 <span class="comment">// Unless required by applicable law or agreed to in writing, software</span>
 
111
<a name="l00009"></a>00009 <span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
 
112
<a name="l00010"></a>00010 <span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
 
113
<a name="l00011"></a>00011 <span class="comment">// See the License for the specific language governing permissions and</span>
 
114
<a name="l00012"></a>00012 <span class="comment">// limitations under the License.</span>
 
115
<a name="l00013"></a>00013 <span class="comment">//</span>
 
116
<a name="l00015"></a>00015 <span class="comment"></span>
 
117
<a name="l00016"></a>00016 
 
118
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef TESSERACT_CLASSIFY_SAMPLEITERATOR_H_</span>
 
119
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define TESSERACT_CLASSIFY_SAMPLEITERATOR_H_</span>
 
120
<a name="l00019"></a>00019 <span class="preprocessor"></span>
 
121
<a name="l00020"></a>00020 <span class="keyword">namespace </span><a class="code" href="a01266.html#afed58feacb84df2de88bdd613cfdba6d">tesseract</a> {
 
122
<a name="l00021"></a>00021 
 
123
<a name="l00022"></a>00022 <span class="keyword">class </span>IndexMapBiDi;
 
124
<a name="l00023"></a>00023 <span class="keyword">class </span>IntFeatureMap;
 
125
<a name="l00024"></a>00024 <span class="keyword">class </span>ShapeTable;
 
126
<a name="l00025"></a>00025 <span class="keyword">class </span>TrainingSample;
 
127
<a name="l00026"></a>00026 <span class="keyword">class </span>TrainingSampleSet;
 
128
<a name="l00027"></a>00027 <span class="keyword">struct </span>UnicharAndFonts;
 
129
<a name="l00028"></a>00028 
 
130
<a name="l00029"></a>00029 <span class="comment">// Iterator class to encapsulate the complex iteration involved in getting</span>
 
131
<a name="l00030"></a>00030 <span class="comment">// all samples of all shapes needed for a classification problem.</span>
 
132
<a name="l00031"></a>00031 <span class="comment">//</span>
 
133
<a name="l00032"></a>00032 <span class="comment">// =====INPUTS TO Init FUNCTION=====</span>
 
134
<a name="l00033"></a>00033 <span class="comment">// The charset_map defines a subset of the sample_set classes (with a NULL</span>
 
135
<a name="l00034"></a>00034 <span class="comment">// shape_table, or the shape_table classes if not NULL.)</span>
 
136
<a name="l00035"></a>00035 <span class="comment">//</span>
 
137
<a name="l00036"></a>00036 <span class="comment">// The shape_table (if not NULL) defines the mapping from shapes to</span>
 
138
<a name="l00037"></a>00037 <span class="comment">// font_id/class_id pairs. Each shape is a list of unichar_id and font lists.</span>
 
139
<a name="l00038"></a>00038 <span class="comment">//</span>
 
140
<a name="l00039"></a>00039 <span class="comment">// The sample_set holds the samples and provides indexed access to samples</span>
 
141
<a name="l00040"></a>00040 <span class="comment">// of font_id/class_id pairs.</span>
 
142
<a name="l00041"></a>00041 <span class="comment">//</span>
 
143
<a name="l00042"></a>00042 <span class="comment">// If randomize is true, the samples are perturbed slightly, but the</span>
 
144
<a name="l00043"></a>00043 <span class="comment">// perturbation is guaranteed to be the same for multiple identical</span>
 
145
<a name="l00044"></a>00044 <span class="comment">// iterations.</span>
 
146
<a name="l00045"></a>00045 <span class="comment">//</span>
 
147
<a name="l00046"></a>00046 <span class="comment">// =====DIFFERENT COMBINATIONS OF INPUTS=====</span>
 
148
<a name="l00047"></a>00047 <span class="comment">// NULL shape_table:</span>
 
149
<a name="l00048"></a>00048 <span class="comment">// Without a shape_table, everything works in UNICHAR_IDs.</span>
 
150
<a name="l00049"></a>00049 <span class="comment">//</span>
 
151
<a name="l00050"></a>00050 <span class="comment">// NULL shape_table, NULL charset_map:</span>
 
152
<a name="l00051"></a>00051 <span class="comment">// Iterations simply run over the samples in the order the samples occur in the</span>
 
153
<a name="l00052"></a>00052 <span class="comment">// input files.</span>
 
154
<a name="l00053"></a>00053 <span class="comment">// GetCompactClassID and GetSparseClassID both return the sample UNICHAR_ID.</span>
 
155
<a name="l00054"></a>00054 <span class="comment">//</span>
 
156
<a name="l00055"></a>00055 <span class="comment">// NULL shape_table, non-NULL charset_map:</span>
 
157
<a name="l00056"></a>00056 <span class="comment">// When shape_table is NULL, the charset_map indexes unichar_ids directly,</span>
 
158
<a name="l00057"></a>00057 <span class="comment">// and an iteration returns all samples of all chars in the charset_map, which</span>
 
159
<a name="l00058"></a>00058 <span class="comment">// is a subset of the full unicharset.</span>
 
160
<a name="l00059"></a>00059 <span class="comment">// The iteration will be in groups of the same unichar_id, in the order</span>
 
161
<a name="l00060"></a>00060 <span class="comment">// defined by the charset_map.</span>
 
162
<a name="l00061"></a>00061 <span class="comment">// GetCompactClassID returns the charset_map index of a sample, and</span>
 
163
<a name="l00062"></a>00062 <span class="comment">// GetSparseClassID returns the sample UNICHAR_ID.</span>
 
164
<a name="l00063"></a>00063 <span class="comment">//</span>
 
165
<a name="l00064"></a>00064 <span class="comment">// Non-NULL shape_table:</span>
 
166
<a name="l00065"></a>00065 <span class="comment">// With a shape_table, samples are grouped according to the shape_table, so</span>
 
167
<a name="l00066"></a>00066 <span class="comment">// multiple UNICHAR_IDs and fonts may be grouped together, and everything</span>
 
168
<a name="l00067"></a>00067 <span class="comment">// works in shape_ids.</span>
 
169
<a name="l00068"></a>00068 <span class="comment">//</span>
 
170
<a name="l00069"></a>00069 <span class="comment">// Non-NULL shape_table, NULL charset_map.</span>
 
171
<a name="l00070"></a>00070 <span class="comment">// Iterations simply run over the samples in the order of shape_id.</span>
 
172
<a name="l00071"></a>00071 <span class="comment">// GetCompactClassID and GetSparseClassID both return the shape_id.</span>
 
173
<a name="l00072"></a>00072 <span class="comment">// (If you want the unichar_id or font_id, the sample still has them.)</span>
 
174
<a name="l00073"></a>00073 <span class="comment">//</span>
 
175
<a name="l00074"></a>00074 <span class="comment">// Non-NULL shape_table, non-NULL charset_map.</span>
 
176
<a name="l00075"></a>00075 <span class="comment">// When shape_table is not NULL, the charset_map indexes and subsets shapes in</span>
 
177
<a name="l00076"></a>00076 <span class="comment">// the shape_table, and iterations will be in shape_table order, not</span>
 
178
<a name="l00077"></a>00077 <span class="comment">// charset_map order.</span>
 
179
<a name="l00078"></a>00078 <span class="comment">// GetCompactClassID returns the charset_map index of a shape, and</span>
 
180
<a name="l00079"></a>00079 <span class="comment">// GetSparseClassID returns the shape_id.</span>
 
181
<a name="l00080"></a>00080 <span class="comment">//</span>
 
182
<a name="l00081"></a>00081 <span class="comment">// =====What is SampleIterator good for?=====</span>
 
183
<a name="l00082"></a>00082 <span class="comment">// Inside a classifier training module, the SampleIterator has abstracted away</span>
 
184
<a name="l00083"></a>00083 <span class="comment">// all the different modes above.</span>
 
185
<a name="l00084"></a>00084 <span class="comment">// Use the following iteration to train your classifier:</span>
 
186
<a name="l00085"></a>00085 <span class="comment">// for (it.Begin(); !it.AtEnd(); it.Next()) {</span>
 
187
<a name="l00086"></a>00086 <span class="comment">//   const TrainingSample&amp; sample = it.GetSample();</span>
 
188
<a name="l00087"></a>00087 <span class="comment">//   int class_id = it.GetCompactClassID();</span>
 
189
<a name="l00088"></a>00088 <span class="comment">// Your classifier may or may not be dealing with a shape_table, and may be</span>
 
190
<a name="l00089"></a>00089 <span class="comment">// dealing with some subset of the character/shape set. It doesn&#39;t need to</span>
 
191
<a name="l00090"></a>00090 <span class="comment">// know and shouldn&#39;t care. It is just learning shapes with compact class ids</span>
 
192
<a name="l00091"></a>00091 <span class="comment">// in the range [0, it.CompactCharsetSize()).</span>
 
193
<a name="l00092"></a><a class="code" href="a00526.html">00092</a> <span class="keyword">class </span><a class="code" href="a00526.html">SampleIterator</a> {
 
194
<a name="l00093"></a>00093  <span class="keyword">public</span>:
 
195
<a name="l00094"></a>00094   <a class="code" href="a00526.html#a9789d39f648bb3942e69fb42402b173c">SampleIterator</a>();
 
196
<a name="l00095"></a>00095   <a class="code" href="a00526.html#a6a7e5ec1f292ab6ecea1f3385496ec37">~SampleIterator</a>();
 
197
<a name="l00096"></a>00096 
 
198
<a name="l00097"></a>00097   <span class="keywordtype">void</span> <a class="code" href="a00526.html#ab9b74fc9ac303c34474b69ee69f2d663">Clear</a>();
 
199
<a name="l00098"></a>00098 
 
200
<a name="l00099"></a>00099   <span class="comment">// See class comment for arguments.</span>
 
201
<a name="l00100"></a>00100   <span class="keywordtype">void</span> <a class="code" href="a00526.html#a0cdb514895d01dff26b51a2e5bc1b0ea">Init</a>(<span class="keyword">const</span> <a class="code" href="a00416.html">IndexMapBiDi</a>* <a class="code" href="a00526.html#a1fdfa33c330477eb7c5eef8ca47fd40c">charset_map</a>,
 
202
<a name="l00101"></a>00101             <span class="keyword">const</span> <a class="code" href="a00544.html">ShapeTable</a>* <a class="code" href="a00526.html#aeae6fe3f5607f0e0ff9f82151d096ced">shape_table</a>,
 
203
<a name="l00102"></a>00102             <span class="keywordtype">bool</span> randomize,
 
204
<a name="l00103"></a>00103             <a class="code" href="a00631.html">TrainingSampleSet</a>* <a class="code" href="a00526.html#a11e0a8f5f60216b68c3fe6528d551295">sample_set</a>);
 
205
<a name="l00104"></a>00104 
 
206
<a name="l00105"></a>00105   <span class="comment">// Iterator functions designed for use with a simple for loop:</span>
 
207
<a name="l00106"></a>00106   <span class="comment">// for (it.Begin(); !it.AtEnd(); it.Next()) {</span>
 
208
<a name="l00107"></a>00107   <span class="comment">//   const TrainingSample&amp; sample = it.GetSample();</span>
 
209
<a name="l00108"></a>00108   <span class="comment">//   int class_id = it.GetCompactClassID();</span>
 
210
<a name="l00109"></a>00109   <span class="comment">//   ...</span>
 
211
<a name="l00110"></a>00110   <span class="comment">// }</span>
 
212
<a name="l00111"></a>00111   <span class="keywordtype">void</span> <a class="code" href="a00526.html#a90e5190efbff41c67519ba29fa59186f">Begin</a>();
 
213
<a name="l00112"></a>00112   <span class="keywordtype">bool</span> <a class="code" href="a00526.html#a4dde9bf911b04c848fbdc4cca8699b70">AtEnd</a>() <span class="keyword">const</span>;
 
214
<a name="l00113"></a>00113   <span class="keyword">const</span> <a class="code" href="a00630.html">TrainingSample</a>&amp; <a class="code" href="a00526.html#a274fa0bca10b58d7efddebde0338a698">GetSample</a>() <span class="keyword">const</span>;
 
215
<a name="l00114"></a>00114   <a class="code" href="a00630.html">TrainingSample</a>* <a class="code" href="a00526.html#a0941312fec55859dc29a1b32b0e298cd">MutableSample</a>() <span class="keyword">const</span>;
 
216
<a name="l00115"></a>00115   <span class="comment">// Returns the total index (from the original set of samples) of the current</span>
 
217
<a name="l00116"></a>00116   <span class="comment">// sample.</span>
 
218
<a name="l00117"></a>00117   <span class="keywordtype">int</span> <a class="code" href="a00526.html#a3651237953d616f7d27f4ed46106707c">GlobalSampleIndex</a>() <span class="keyword">const</span>;
 
219
<a name="l00118"></a>00118   <span class="comment">// Returns the index of the current sample in compact charset space, so</span>
 
220
<a name="l00119"></a>00119   <span class="comment">// in a 2-class problem between x and y, the returned indices will all be</span>
 
221
<a name="l00120"></a>00120   <span class="comment">// 0 or 1, and have nothing to do with the unichar_ids.</span>
 
222
<a name="l00121"></a>00121   <span class="comment">// If the charset_map_ is NULL, then this is equal to GetSparseClassID().</span>
 
223
<a name="l00122"></a>00122   <span class="keywordtype">int</span> <a class="code" href="a00526.html#a745b2bf5f8956bc1233e28f9b1c5b639">GetCompactClassID</a>() <span class="keyword">const</span>;
 
224
<a name="l00123"></a>00123   <span class="comment">// Returns the index of the current sample in sparse charset space, so</span>
 
225
<a name="l00124"></a>00124   <span class="comment">// in a 2-class problem between x and y, the returned indices will all be</span>
 
226
<a name="l00125"></a>00125   <span class="comment">// x or y, where x and y may be unichar_ids (no shape_table_) or shape_ids</span>
 
227
<a name="l00126"></a>00126   <span class="comment">// with a shape_table_.</span>
 
228
<a name="l00127"></a>00127   <span class="keywordtype">int</span> <a class="code" href="a00526.html#a35e0355b17965fef669f2bd84ea624a7">GetSparseClassID</a>() <span class="keyword">const</span>;
 
229
<a name="l00128"></a>00128   <span class="comment">// Moves on to the next indexable sample. If the end is reached, leaves</span>
 
230
<a name="l00129"></a>00129   <span class="comment">// the state such that AtEnd() is true.</span>
 
231
<a name="l00130"></a>00130   <span class="keywordtype">void</span> <a class="code" href="a00526.html#aea58e8234a0b6bab9061929622150bb1">Next</a>();
 
232
<a name="l00131"></a>00131 
 
233
<a name="l00132"></a>00132   <span class="comment">// Returns the size of the compact charset space.</span>
 
234
<a name="l00133"></a>00133   <span class="keywordtype">int</span> <a class="code" href="a00526.html#a95b17d95d0777709dee9606e57a6aad1">CompactCharsetSize</a>() <span class="keyword">const</span>;
 
235
<a name="l00134"></a>00134   <span class="comment">// Returns the size of the sparse charset space.</span>
 
236
<a name="l00135"></a>00135   <span class="keywordtype">int</span> <a class="code" href="a00526.html#ad575eda15498de5a5de614dbcfa4d0aa">SparseCharsetSize</a>() <span class="keyword">const</span>;
 
237
<a name="l00136"></a>00136 
 
238
<a name="l00137"></a><a class="code" href="a00526.html#a1fdfa33c330477eb7c5eef8ca47fd40c">00137</a>   <span class="keyword">const</span> <a class="code" href="a00416.html">IndexMapBiDi</a>&amp; <a class="code" href="a00526.html#a1fdfa33c330477eb7c5eef8ca47fd40c">charset_map</a>()<span class="keyword"> const </span>{
 
239
<a name="l00138"></a>00138     <span class="keywordflow">return</span> *charset_map_;
 
240
<a name="l00139"></a>00139   }
 
241
<a name="l00140"></a><a class="code" href="a00526.html#aeae6fe3f5607f0e0ff9f82151d096ced">00140</a>   <span class="keyword">const</span> <a class="code" href="a00544.html">ShapeTable</a>* <a class="code" href="a00526.html#aeae6fe3f5607f0e0ff9f82151d096ced">shape_table</a>()<span class="keyword"> const </span>{
 
242
<a name="l00141"></a>00141     <span class="keywordflow">return</span> shape_table_;
 
243
<a name="l00142"></a>00142   }
 
244
<a name="l00143"></a>00143   <span class="comment">// Sample set operations.</span>
 
245
<a name="l00144"></a><a class="code" href="a00526.html#a11e0a8f5f60216b68c3fe6528d551295">00144</a>   <span class="keyword">const</span> <a class="code" href="a00631.html">TrainingSampleSet</a>* <a class="code" href="a00526.html#a11e0a8f5f60216b68c3fe6528d551295">sample_set</a>()<span class="keyword"> const </span>{
 
246
<a name="l00145"></a>00145     <span class="keywordflow">return</span> sample_set_;
 
247
<a name="l00146"></a>00146   }
 
248
<a name="l00147"></a>00147 
 
249
<a name="l00148"></a>00148   <span class="comment">// A set of functions that do something to all the samples accessed by the</span>
 
250
<a name="l00149"></a>00149   <span class="comment">// iterator, as it is currently setup.</span>
 
251
<a name="l00150"></a>00150 
 
252
<a name="l00151"></a>00151   <span class="comment">// Apply the supplied feature_space/feature_map transform to all samples</span>
 
253
<a name="l00152"></a>00152   <span class="comment">// accessed by this iterator.</span>
 
254
<a name="l00153"></a>00153   <span class="keywordtype">void</span> <a class="code" href="a00526.html#a476d245234d73a6c9ef7c85b57148a27">MapSampleFeatures</a>(<span class="keyword">const</span> <a class="code" href="a00429.html">IntFeatureMap</a>&amp; feature_map);
 
255
<a name="l00154"></a>00154 
 
256
<a name="l00155"></a>00155   <span class="comment">// Adjust the weights of all the samples to be uniform in the given charset.</span>
 
257
<a name="l00156"></a>00156   <span class="comment">// Returns the number of samples in the iterator.</span>
 
258
<a name="l00157"></a>00157   <span class="keywordtype">int</span> <a class="code" href="a00526.html#a82e48b99ecac34b9e0dbf8a96521bb4e">UniformSamples</a>();
 
259
<a name="l00158"></a>00158 
 
260
<a name="l00159"></a>00159   <span class="comment">// Normalize the weights of all the samples defined by the iterator so they</span>
 
261
<a name="l00160"></a>00160   <span class="comment">// sum to 1. Returns the minimum assigned sample weight.</span>
 
262
<a name="l00161"></a>00161   <span class="keywordtype">double</span> <a class="code" href="a00526.html#ac0a70c42261385f21d97c699ff181fad">NormalizeSamples</a>();
 
263
<a name="l00162"></a>00162 
 
264
<a name="l00163"></a>00163  <span class="keyword">private</span>:
 
265
<a name="l00164"></a>00164   <span class="comment">// Helper returns the current UnicharAndFont shape_entry.</span>
 
266
<a name="l00165"></a>00165   <span class="keyword">const</span> <a class="code" href="a00638.html">UnicharAndFonts</a>* GetShapeEntry() <span class="keyword">const</span>;
 
267
<a name="l00166"></a>00166 
 
268
<a name="l00167"></a>00167   <span class="comment">// Map to subset the actual charset space.</span>
 
269
<a name="l00168"></a>00168   <span class="keyword">const</span> <a class="code" href="a00416.html">IndexMapBiDi</a>* charset_map_;
 
270
<a name="l00169"></a>00169   <span class="comment">// Shape table to recombine character classes into shapes</span>
 
271
<a name="l00170"></a>00170   <span class="keyword">const</span> <a class="code" href="a00544.html">ShapeTable</a>* shape_table_;
 
272
<a name="l00171"></a>00171   <span class="comment">// The samples to iterate over.</span>
 
273
<a name="l00172"></a>00172   <a class="code" href="a00631.html">TrainingSampleSet</a>* sample_set_;
 
274
<a name="l00173"></a>00173   <span class="comment">// Flag to control randomizing the sample features.</span>
 
275
<a name="l00174"></a>00174   <span class="keywordtype">bool</span> randomize_;
 
276
<a name="l00175"></a>00175   <span class="comment">// Shape table owned by this used to iterate character classes.</span>
 
277
<a name="l00176"></a>00176   <a class="code" href="a00544.html">ShapeTable</a>* owned_shape_table_;
 
278
<a name="l00177"></a>00177 
 
279
<a name="l00178"></a>00178   <span class="comment">// Top-level iteration. Shape index in sparse charset_map space.</span>
 
280
<a name="l00179"></a>00179   <span class="keywordtype">int</span> shape_index_;
 
281
<a name="l00180"></a>00180   <span class="keywordtype">int</span> num_shapes_;
 
282
<a name="l00181"></a>00181   <span class="comment">// Index to the character class within a shape.</span>
 
283
<a name="l00182"></a>00182   <span class="keywordtype">int</span> shape_char_index_;
 
284
<a name="l00183"></a>00183   <span class="keywordtype">int</span> num_shape_chars_;
 
285
<a name="l00184"></a>00184   <span class="comment">// Index to the font within a shape/class pair.</span>
 
286
<a name="l00185"></a>00185   <span class="keywordtype">int</span> shape_font_index_;
 
287
<a name="l00186"></a>00186   <span class="keywordtype">int</span> num_shape_fonts_;
 
288
<a name="l00187"></a>00187   <span class="comment">// The lowest level iteration. sample_index_/num_samples_ counts samples</span>
 
289
<a name="l00188"></a>00188   <span class="comment">// in the current shape/class/font combination.</span>
 
290
<a name="l00189"></a>00189   <span class="keywordtype">int</span> sample_index_;
 
291
<a name="l00190"></a>00190   <span class="keywordtype">int</span> num_samples_;
 
292
<a name="l00191"></a>00191 };
 
293
<a name="l00192"></a>00192 
 
294
<a name="l00193"></a>00193 }  <span class="comment">// namespace tesseract.</span>
 
295
<a name="l00194"></a>00194 
 
296
<a name="l00195"></a>00195 <span class="preprocessor">#endif  // TESSERACT_CLASSIFY_SAMPLEITERATOR_H_</span>
 
297
</pre></div></div><!-- contents -->
 
298
</div>
 
299
<!-- window showing the filter options -->
 
300
<div id="MSearchSelectWindow"
 
301
     onmouseover="return searchBox.OnSearchSelectShow()"
 
302
     onmouseout="return searchBox.OnSearchSelectHide()"
 
303
     onkeydown="return searchBox.OnSearchSelectKey(event)">
 
304
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>
 
305
 
 
306
<!-- iframe showing the search results (closed by default) -->
 
307
<div id="MSearchResultsWindow">
 
308
<iframe src="javascript:void(0)" frameborder="0" 
 
309
        name="MSearchResults" id="MSearchResults">
 
310
</iframe>
 
311
</div>
 
312
 
 
313
  <div id="nav-path" class="navpath">
 
314
    <ul>
 
315
      <li class="navelem"><a class="el" href="a00937.html">sampleiterator.h</a>      </li>
 
316
 
 
317
    <li class="footer">Generated on Mon Feb 3 2014 10:59:09 for tesseract by
 
318
    <a href="http://www.doxygen.org/index.html">
 
319
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
 
320
   </ul>
 
321
 </div>
 
322
 
 
323
 
 
324
</body>
 
325
</html>