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

« back to all changes in this revision

Viewing changes to doc/html/a00890_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/featdefs.cpp 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('a00890.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/featdefs.cpp</div>  </div>
 
101
</div><!--header-->
 
102
<div class="contents">
 
103
<a href="a00890.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/******************************************************************************</span>
 
104
<a name="l00002"></a>00002 <span class="comment"> **     Filename:    featdefs.c</span>
 
105
<a name="l00003"></a>00003 <span class="comment"> **     Purpose:     Definitions of currently defined feature types.</span>
 
106
<a name="l00004"></a>00004 <span class="comment"> **     Author:      Dan Johnson</span>
 
107
<a name="l00005"></a>00005 <span class="comment"> **     History:     Mon May 21 10:26:21 1990, DSJ, Created.</span>
 
108
<a name="l00006"></a>00006 <span class="comment"> **</span>
 
109
<a name="l00007"></a>00007 <span class="comment"> **     (c) Copyright Hewlett-Packard Company, 1988.</span>
 
110
<a name="l00008"></a>00008 <span class="comment"> ** Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
 
111
<a name="l00009"></a>00009 <span class="comment"> ** you may not use this file except in compliance with the License.</span>
 
112
<a name="l00010"></a>00010 <span class="comment"> ** You may obtain a copy of the License at</span>
 
113
<a name="l00011"></a>00011 <span class="comment"> ** http://www.apache.org/licenses/LICENSE-2.0</span>
 
114
<a name="l00012"></a>00012 <span class="comment"> ** Unless required by applicable law or agreed to in writing, software</span>
 
115
<a name="l00013"></a>00013 <span class="comment"> ** distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
 
116
<a name="l00014"></a>00014 <span class="comment"> ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
 
117
<a name="l00015"></a>00015 <span class="comment"> ** See the License for the specific language governing permissions and</span>
 
118
<a name="l00016"></a>00016 <span class="comment"> ** limitations under the License.</span>
 
119
<a name="l00017"></a>00017 <span class="comment"> ******************************************************************************/</span>
 
120
<a name="l00018"></a>00018 <span class="comment">/*-----------------------------------------------------------------------------</span>
 
121
<a name="l00019"></a>00019 <span class="comment">          Include Files and Type Defines</span>
 
122
<a name="l00020"></a>00020 <span class="comment">-----------------------------------------------------------------------------*/</span>
 
123
<a name="l00021"></a>00021 <span class="preprocessor">#ifdef _MSC_VER</span>
 
124
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="a01213.html">mathfix.h</a>&gt;</span>
 
125
<a name="l00023"></a>00023 <span class="preprocessor">#endif</span>
 
126
<a name="l00024"></a>00024 <span class="preprocessor"></span>
 
127
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="a00891.html">featdefs.h</a>&quot;</span>
 
128
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;<a class="code" href="a01036.html">emalloc.h</a>&quot;</span>
 
129
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="a01032.html">danerror.h</a>&quot;</span>
 
130
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;<a class="code" href="a00848.html">scanutils.h</a>&quot;</span>
 
131
<a name="l00029"></a>00029 
 
132
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;string.h&gt;</span>
 
133
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
 
134
<a name="l00032"></a>00032 
 
135
<a name="l00034"></a><a class="code" href="a00890.html#ada39950713e21f70f302841f185fba09">00034</a> <span class="preprocessor">#define ILLEGAL_NUM_SETS  3001</span>
 
136
<a name="l00035"></a>00035 <span class="preprocessor"></span>
 
137
<a name="l00036"></a><a class="code" href="a00890.html#af9508e257a32a6046ee5b30079a50bdb">00036</a> <span class="preprocessor">#define PICO_FEATURE_LENGTH 0.05</span>
 
138
<a name="l00037"></a>00037 <span class="preprocessor"></span>
 
139
<a name="l00038"></a>00038 <span class="comment">/*-----------------------------------------------------------------------------</span>
 
140
<a name="l00039"></a>00039 <span class="comment">        Global Data Definitions and Declarations</span>
 
141
<a name="l00040"></a>00040 <span class="comment">-----------------------------------------------------------------------------*/</span>
 
142
<a name="l00041"></a><a class="code" href="a00891.html#af83d597eb1e077f4ad2b082be6698d20">00041</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="a00890.html#ae706c172f0e1ba7f7cf1a99c560fd99a">kMicroFeatureType</a> = <span class="stringliteral">&quot;mf&quot;</span>;
 
143
<a name="l00042"></a><a class="code" href="a00891.html#aba437789a6614f23dc6d18a5a803ccc8">00042</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="a00890.html#a5f5743c5da72cfdc8eb87e4f2504b2d6">kCNFeatureType</a> = <span class="stringliteral">&quot;cn&quot;</span>;
 
144
<a name="l00043"></a><a class="code" href="a00891.html#abf5c61b4ecdfe9301e0f998156474c6b">00043</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="a00890.html#abf5c61b4ecdfe9301e0f998156474c6b">kIntFeatureType</a> = <span class="stringliteral">&quot;if&quot;</span>;
 
145
<a name="l00044"></a><a class="code" href="a00891.html#abada1502d146a88fadcc73af54ae7540">00044</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="a00890.html#abada1502d146a88fadcc73af54ae7540">kGeoFeatureType</a> = <span class="stringliteral">&quot;tb&quot;</span>;
 
146
<a name="l00045"></a>00045 
 
147
<a name="l00046"></a>00046 <span class="comment">// Define all of the parameters for the MicroFeature type.</span>
 
148
<a name="l00047"></a>00047 <a class="code" href="a00929.html#ab167eb0dd11bcdc485185da17528554e">StartParamDesc</a>(MicroFeatureParams)
 
149
<a name="l00048"></a>00048 <a class="code" href="a00929.html#a2c9b19bf68ac985b694b63908c903ac7">DefineParam</a>(0, 0, -0.5, 0.5)
 
150
<a name="l00049"></a>00049 DefineParam(0, 0, -0.25, 0.75)
 
151
<a name="l00050"></a>00050 DefineParam(0, 1, 0.0, 1.0)
 
152
<a name="l00051"></a>00051 DefineParam(1, 0, 0.0, 1.0)
 
153
<a name="l00052"></a>00052 DefineParam (0, 1, -0.5, 0.5)
 
154
<a name="l00053"></a>00053 DefineParam (0, 1, -0.5, 0.5)
 
155
<a name="l00054"></a>00054 <a class="code" href="a00929.html#a24f96cc11dfea22b55b18b2e991be813">EndParamDesc</a>
 
156
<a name="l00055"></a>00055 <span class="comment">// Now define the feature type itself (see features.h for parameters).</span>
 
157
<a name="l00056"></a>00056 <a class="code" href="a00929.html#a6998a902eeedeb654f5209cd390c69c3">DefineFeature</a>(MicroFeatureDesc, 5, 1, <a class="code" href="a00890.html#ae706c172f0e1ba7f7cf1a99c560fd99a">kMicroFeatureType</a>, MicroFeatureParams)
 
158
<a name="l00057"></a>00057 
 
159
<a name="l00058"></a>00058 <span class="comment">// Define all of the parameters for the NormFeat type.</span>
 
160
<a name="l00059"></a>00059 <a class="code" href="a00929.html#ab167eb0dd11bcdc485185da17528554e">StartParamDesc</a> (CharNormParams)
 
161
<a name="l00060"></a>00060 DefineParam(0, 0, -0.25, 0.75)
 
162
<a name="l00061"></a>00061 DefineParam(0, 1, 0.0, 1.0)
 
163
<a name="l00062"></a>00062 DefineParam(0, 0, 0.0, 1.0)
 
164
<a name="l00063"></a>00063 DefineParam(0, 0, 0.0, 1.0)
 
165
<a name="l00064"></a>00064 <a class="code" href="a00929.html#a24f96cc11dfea22b55b18b2e991be813">EndParamDesc</a>
 
166
<a name="l00065"></a>00065 <span class="comment">// Now define the feature type itself (see features.h for parameters).</span>
 
167
<a name="l00066"></a>00066 <a class="code" href="a00929.html#a6998a902eeedeb654f5209cd390c69c3">DefineFeature</a>(CharNormDesc, 4, 0, <a class="code" href="a00890.html#a5f5743c5da72cfdc8eb87e4f2504b2d6">kCNFeatureType</a>, CharNormParams)
 
168
<a name="l00067"></a>00067 
 
169
<a name="l00068"></a>00068 <span class="comment">// Define all of the parameters for the IntFeature type</span>
 
170
<a name="l00069"></a>00069 <a class="code" href="a00929.html#ab167eb0dd11bcdc485185da17528554e">StartParamDesc</a>(IntFeatParams)
 
171
<a name="l00070"></a>00070 DefineParam(0, 0, 0.0, 255.0)
 
172
<a name="l00071"></a>00071 DefineParam(0, 0, 0.0, 255.0)
 
173
<a name="l00072"></a>00072 DefineParam(1, 0, 0.0, 255.0)
 
174
<a name="l00073"></a>00073 <a class="code" href="a00929.html#a24f96cc11dfea22b55b18b2e991be813">EndParamDesc</a>
 
175
<a name="l00074"></a>00074 <span class="comment">// Now define the feature type itself (see features.h for parameters).</span>
 
176
<a name="l00075"></a>00075 <a class="code" href="a00929.html#a6998a902eeedeb654f5209cd390c69c3">DefineFeature</a>(IntFeatDesc, 2, 1, <a class="code" href="a00890.html#abf5c61b4ecdfe9301e0f998156474c6b">kIntFeatureType</a>, IntFeatParams)
 
177
<a name="l00076"></a>00076 
 
178
<a name="l00077"></a>00077 <span class="comment">// Define all of the parameters for the GeoFeature type</span>
 
179
<a name="l00078"></a>00078 <a class="code" href="a00929.html#ab167eb0dd11bcdc485185da17528554e">StartParamDesc</a>(GeoFeatParams)
 
180
<a name="l00079"></a>00079 DefineParam(0, 0, 0.0, 255.0)
 
181
<a name="l00080"></a>00080 DefineParam(0, 0, 0.0, 255.0)
 
182
<a name="l00081"></a>00081 DefineParam(0, 0, 0.0, 255.0)
 
183
<a name="l00082"></a>00082 <a class="code" href="a00929.html#a24f96cc11dfea22b55b18b2e991be813">EndParamDesc</a>
 
184
<a name="l00083"></a>00083 <span class="comment">// Now define the feature type itself (see features.h for parameters).</span>
 
185
<a name="l00084"></a>00084 <a class="code" href="a00929.html#a6998a902eeedeb654f5209cd390c69c3">DefineFeature</a>(GeoFeatDesc, 3, 0, <a class="code" href="a00890.html#abada1502d146a88fadcc73af54ae7540">kGeoFeatureType</a>, GeoFeatParams)
 
186
<a name="l00085"></a>00085 
 
187
<a name="l00086"></a>00086 <span class="comment">// Other features used for training the adaptive classifier, but not used</span>
 
188
<a name="l00087"></a>00087 <span class="comment">// during normal training, therefore not in the DescDefs array.</span>
 
189
<a name="l00088"></a>00088 
 
190
<a name="l00089"></a>00089 <span class="comment">// Define all of the parameters for the PicoFeature type</span>
 
191
<a name="l00090"></a>00090 <span class="comment">// define knob that can be used to adjust pico-feature length.</span>
 
192
<a name="l00091"></a>00091 <a class="code" href="a00831.html#a6a3da5f1db8d485c0d2f5a7ba526c4a0">FLOAT32</a> PicoFeatureLength = <a class="code" href="a00890.html#af9508e257a32a6046ee5b30079a50bdb">PICO_FEATURE_LENGTH</a>;
 
193
<a name="l00092"></a>00092 <a class="code" href="a00929.html#ab167eb0dd11bcdc485185da17528554e">StartParamDesc</a>(PicoFeatParams)
 
194
<a name="l00093"></a>00093 DefineParam(0, 0, -0.25, 0.75)
 
195
<a name="l00094"></a>00094 DefineParam(1, 0, 0.0, 1.0)
 
196
<a name="l00095"></a>00095 DefineParam(0, 0, -0.5, 0.5)
 
197
<a name="l00096"></a>00096 <a class="code" href="a00929.html#a24f96cc11dfea22b55b18b2e991be813">EndParamDesc</a>
 
198
<a name="l00097"></a>00097 <span class="comment">// Now define the feature type itself (see features.h for parameters).</span>
 
199
<a name="l00098"></a>00098 <a class="code" href="a00929.html#a6998a902eeedeb654f5209cd390c69c3">DefineFeature</a>(PicoFeatDesc, 2, 1, &quot;pf&quot;, PicoFeatParams)
 
200
<a name="l00099"></a>00099 
 
201
<a name="l00100"></a>00100 <span class="comment">// Define all of the parameters for the OutlineFeature type.</span>
 
202
<a name="l00101"></a>00101 <a class="code" href="a00929.html#ab167eb0dd11bcdc485185da17528554e">StartParamDesc</a>(OutlineFeatParams)
 
203
<a name="l00102"></a>00102 DefineParam(0, 0, -0.5, 0.5)
 
204
<a name="l00103"></a>00103 DefineParam(0, 0, -0.25, 0.75)
 
205
<a name="l00104"></a>00104 DefineParam(0, 0, 0.0, 1.0)
 
206
<a name="l00105"></a>00105 DefineParam(1, 0, 0.0, 1.0)
 
207
<a name="l00106"></a>00106 <a class="code" href="a00929.html#a24f96cc11dfea22b55b18b2e991be813">EndParamDesc</a>
 
208
<a name="l00107"></a>00107 <span class="comment">// Now define the feature type itself (see features.h for parameters).</span>
 
209
<a name="l00108"></a><a class="code" href="a00890.html#a66c7f757ef35e33a52ac2efe3f4e8247">00108</a> <a class="code" href="a00929.html#a6998a902eeedeb654f5209cd390c69c3">DefineFeature</a>(OutlineFeatDesc, 3, 1, &quot;<a class="code" href="a00890.html#a66c7f757ef35e33a52ac2efe3f4e8247">of</a>&quot;, OutlineFeatParams)
 
210
<a name="l00109"></a>00109 
 
211
<a name="l00110"></a>00110 <span class="comment">// MUST be kept in-sync with ExtractorDefs in fxdefs.cpp.</span>
 
212
<a name="l00111"></a>00111 static const <a class="code" href="a00377.html">FEATURE_DESC_STRUCT</a> *DescDefs[<a class="code" href="a00891.html#aff5d3186888ac3dbd87adcc54b7f2ecf">NUM_FEATURE_TYPES</a>] = {
 
213
<a name="l00112"></a>00112   &amp;MicroFeatureDesc,
 
214
<a name="l00113"></a>00113   &amp;CharNormDesc,
 
215
<a name="l00114"></a>00114   &amp;IntFeatDesc,
 
216
<a name="l00115"></a>00115   &amp;GeoFeatDesc
 
217
<a name="l00116"></a>00116 };
 
218
<a name="l00117"></a>00117 
 
219
<a name="l00118"></a>00118 <span class="comment">/*-----------------------------------------------------------------------------</span>
 
220
<a name="l00119"></a>00119 <span class="comment">              Public Code</span>
 
221
<a name="l00120"></a>00120 <span class="comment">-----------------------------------------------------------------------------*/</span>
 
222
<a name="l00121"></a><a class="code" href="a00891.html#a6e4c84ab01e39577e4a74d9ab1eff68b">00121</a> <span class="keywordtype">void</span> <a class="code" href="a00890.html#a6e4c84ab01e39577e4a74d9ab1eff68b">InitFeatureDefs</a>(<a class="code" href="a00376.html">FEATURE_DEFS_STRUCT</a> *featuredefs) {
 
223
<a name="l00122"></a>00122   featuredefs-&gt;<a class="code" href="a00376.html#ac99b06fc21085f9b57a4b3d56a67a715">NumFeatureTypes</a> = <a class="code" href="a00891.html#aff5d3186888ac3dbd87adcc54b7f2ecf">NUM_FEATURE_TYPES</a>;
 
224
<a name="l00123"></a>00123   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="a00891.html#aff5d3186888ac3dbd87adcc54b7f2ecf">NUM_FEATURE_TYPES</a>; ++i) {
 
225
<a name="l00124"></a>00124     featuredefs-&gt;<a class="code" href="a00376.html#ab09a6d77d42a8a2b5882bbc27ee4f23c">FeatureDesc</a>[i] = DescDefs[i];
 
226
<a name="l00125"></a>00125   }
 
227
<a name="l00126"></a>00126 }
 
228
<a name="l00127"></a>00127 
 
229
<a name="l00128"></a>00128 <span class="comment">/*---------------------------------------------------------------------------*/</span>
 
230
<a name="l00141"></a><a class="code" href="a00891.html#ae2a92eefc3755300284119692527e3b9">00141</a> <span class="keywordtype">void</span> <a class="code" href="a00890.html#ae2a92eefc3755300284119692527e3b9">FreeCharDescription</a>(<a class="code" href="a00297.html">CHAR_DESC</a> CharDesc) {
 
231
<a name="l00142"></a>00142   <span class="keywordtype">int</span> i;
 
232
<a name="l00143"></a>00143 
 
233
<a name="l00144"></a>00144   <span class="keywordflow">if</span> (CharDesc) {
 
234
<a name="l00145"></a>00145     <span class="keywordflow">for</span> (i = 0; i &lt; CharDesc-&gt;<a class="code" href="a00297.html#a44c9d1024eb43636b98d19c92f4e4b0f">NumFeatureSets</a>; i++)
 
235
<a name="l00146"></a>00146       <a class="code" href="a00928.html#a72b29c3d875eb9a2241385b1f1388b2d">FreeFeatureSet</a> (CharDesc-&gt;<a class="code" href="a00297.html#ae04ec3a6b5e474d83930ff3e57a42acb">FeatureSets</a>[i]);
 
236
<a name="l00147"></a>00147     <a class="code" href="a01035.html#af846576ae65dc13e49ddc616e17baa27">Efree</a>(CharDesc);
 
237
<a name="l00148"></a>00148   }
 
238
<a name="l00149"></a>00149 }                                <span class="comment">/* FreeCharDescription */</span>
 
239
<a name="l00150"></a>00150 
 
240
<a name="l00151"></a>00151 
 
241
<a name="l00152"></a>00152 <span class="comment">/*---------------------------------------------------------------------------*/</span>
 
242
<a name="l00164"></a><a class="code" href="a00891.html#a860f7517bac9477e79551e501df549ed">00164</a> <a class="code" href="a00297.html">CHAR_DESC</a> <a class="code" href="a00890.html#a860f7517bac9477e79551e501df549ed">NewCharDescription</a>(<span class="keyword">const</span> <a class="code" href="a00376.html">FEATURE_DEFS_STRUCT</a> &amp;FeatureDefs) {
 
243
<a name="l00165"></a>00165   <a class="code" href="a00297.html">CHAR_DESC</a> CharDesc;
 
244
<a name="l00166"></a>00166   <span class="keywordtype">int</span> i;
 
245
<a name="l00167"></a>00167 
 
246
<a name="l00168"></a>00168   CharDesc = (<a class="code" href="a00891.html#a41cfd9e7d2129a4e068683b2bafab0ee">CHAR_DESC</a>) <a class="code" href="a01035.html#a9bdc0885c33bbb5b062c77b1d90e2305">Emalloc</a> (<span class="keyword">sizeof</span> (<a class="code" href="a00297.html">CHAR_DESC_STRUCT</a>));
 
247
<a name="l00169"></a>00169   CharDesc-&gt;<a class="code" href="a00297.html#a44c9d1024eb43636b98d19c92f4e4b0f">NumFeatureSets</a> = FeatureDefs.<a class="code" href="a00376.html#ac99b06fc21085f9b57a4b3d56a67a715">NumFeatureTypes</a>;
 
248
<a name="l00170"></a>00170 
 
249
<a name="l00171"></a>00171   <span class="keywordflow">for</span> (i = 0; i &lt; CharDesc-&gt;<a class="code" href="a00297.html#a44c9d1024eb43636b98d19c92f4e4b0f">NumFeatureSets</a>; i++)
 
250
<a name="l00172"></a>00172     CharDesc-&gt;<a class="code" href="a00297.html#ae04ec3a6b5e474d83930ff3e57a42acb">FeatureSets</a>[i] = NULL;
 
251
<a name="l00173"></a>00173 
 
252
<a name="l00174"></a>00174   return (CharDesc);
 
253
<a name="l00175"></a>00175 
 
254
<a name="l00176"></a>00176 }                                <span class="comment">/* NewCharDescription */</span>
 
255
<a name="l00177"></a>00177 
 
256
<a name="l00178"></a>00178 
 
257
<a name="l00179"></a>00179 <span class="comment">/*---------------------------------------------------------------------------*/</span>
 
258
<a name="l00200"></a><a class="code" href="a00891.html#a52fa2e188f92a8642277f83873efa212">00200</a> <span class="keywordtype">void</span> <a class="code" href="a00890.html#a52fa2e188f92a8642277f83873efa212">WriteCharDescription</a>(<span class="keyword">const</span> <a class="code" href="a00376.html">FEATURE_DEFS_STRUCT</a> &amp;FeatureDefs,
 
259
<a name="l00201"></a>00201                           FILE *File, <a class="code" href="a00297.html">CHAR_DESC</a> CharDesc) {
 
260
<a name="l00202"></a>00202   <span class="keywordtype">int</span> Type;
 
261
<a name="l00203"></a>00203   <span class="keywordtype">int</span> NumSetsToWrite = 0;
 
262
<a name="l00204"></a>00204 
 
263
<a name="l00205"></a>00205   <span class="keywordflow">for</span> (Type = 0; Type &lt; CharDesc-&gt;<a class="code" href="a00297.html#a44c9d1024eb43636b98d19c92f4e4b0f">NumFeatureSets</a>; Type++)
 
264
<a name="l00206"></a>00206     <span class="keywordflow">if</span> (CharDesc-&gt;<a class="code" href="a00297.html#ae04ec3a6b5e474d83930ff3e57a42acb">FeatureSets</a>[Type])
 
265
<a name="l00207"></a>00207       NumSetsToWrite++;
 
266
<a name="l00208"></a>00208 
 
267
<a name="l00209"></a>00209   fprintf (File, <span class="stringliteral">&quot; %d\n&quot;</span>, NumSetsToWrite);
 
268
<a name="l00210"></a>00210   <span class="keywordflow">for</span> (Type = 0; Type &lt; CharDesc-&gt;<a class="code" href="a00297.html#a44c9d1024eb43636b98d19c92f4e4b0f">NumFeatureSets</a>; Type++)
 
269
<a name="l00211"></a>00211   <span class="keywordflow">if</span> (CharDesc-&gt;<a class="code" href="a00297.html#ae04ec3a6b5e474d83930ff3e57a42acb">FeatureSets</a>[Type]) {
 
270
<a name="l00212"></a>00212     fprintf (File, <span class="stringliteral">&quot;%s &quot;</span>, (FeatureDefs.<a class="code" href="a00376.html#ab09a6d77d42a8a2b5882bbc27ee4f23c">FeatureDesc</a>[Type])-&gt;ShortName);
 
271
<a name="l00213"></a>00213     <a class="code" href="a00928.html#a9a2f4672497a1aa6d8378d083c0b70c8">WriteFeatureSet</a> (File, CharDesc-&gt;<a class="code" href="a00297.html#ae04ec3a6b5e474d83930ff3e57a42acb">FeatureSets</a>[Type]);
 
272
<a name="l00214"></a>00214   }
 
273
<a name="l00215"></a>00215 }                                <span class="comment">/* WriteCharDescription */</span>
 
274
<a name="l00216"></a>00216 
 
275
<a name="l00217"></a>00217 <span class="comment">// Return whether all of the fields of the given feature set</span>
 
276
<a name="l00218"></a>00218 <span class="comment">// are well defined (not inf or nan).</span>
 
277
<a name="l00219"></a><a class="code" href="a00891.html#af8fa799b7b0c0c8e18648a521ef2775f">00219</a> <span class="keywordtype">bool</span> <a class="code" href="a00890.html#af8fa799b7b0c0c8e18648a521ef2775f">ValidCharDescription</a>(<span class="keyword">const</span> <a class="code" href="a00376.html">FEATURE_DEFS_STRUCT</a> &amp;FeatureDefs,
 
278
<a name="l00220"></a>00220                           <a class="code" href="a00297.html">CHAR_DESC</a> CharDesc) {
 
279
<a name="l00221"></a>00221   <span class="keywordtype">bool</span> anything_written = <span class="keyword">false</span>;
 
280
<a name="l00222"></a>00222   <span class="keywordtype">bool</span> well_formed = <span class="keyword">true</span>;
 
281
<a name="l00223"></a>00223   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> Type = 0; Type &lt; CharDesc-&gt;<a class="code" href="a00297.html#a44c9d1024eb43636b98d19c92f4e4b0f">NumFeatureSets</a>; Type++) {
 
282
<a name="l00224"></a>00224     <span class="keywordflow">if</span> (CharDesc-&gt;<a class="code" href="a00297.html#ae04ec3a6b5e474d83930ff3e57a42acb">FeatureSets</a>[Type]) {
 
283
<a name="l00225"></a>00225       <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; CharDesc-&gt;<a class="code" href="a00297.html#ae04ec3a6b5e474d83930ff3e57a42acb">FeatureSets</a>[Type]-&gt;<a class="code" href="a00379.html#a154a6ca419f3f16fccf11b7217351570">NumFeatures</a>; i++) {
 
284
<a name="l00226"></a>00226         <a class="code" href="a00380.html">FEATURE</a> feat = CharDesc-&gt;<a class="code" href="a00297.html#ae04ec3a6b5e474d83930ff3e57a42acb">FeatureSets</a>[Type]-&gt;<a class="code" href="a00379.html#a4664d6a22a9d12f4011de4d877664c45">Features</a>[i];
 
285
<a name="l00227"></a>00227         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> p = 0; p &lt; feat-&gt;<a class="code" href="a00380.html#a1a034f275ff504afd63bd99643fae589">Type</a>-&gt;<a class="code" href="a00377.html#a0edbab02900ae01549f742582236eb6d">NumParams</a>; p++) {
 
286
<a name="l00228"></a>00228           <span class="keywordflow">if</span> (<a class="code" href="a01213.html#a2e1baae9134e580910322362dc23290e">isnan</a>(feat-&gt;<a class="code" href="a00380.html#ace52f36cfcba955504f4a24f86a897b4">Params</a>[p]) || <a class="code" href="a01213.html#a2a266c767456556e5c0da234b602b18b">isinf</a>(feat-&gt;<a class="code" href="a00380.html#ace52f36cfcba955504f4a24f86a897b4">Params</a>[p]))
 
287
<a name="l00229"></a>00229             well_formed = <span class="keyword">false</span>;
 
288
<a name="l00230"></a>00230           <span class="keywordflow">else</span>
 
289
<a name="l00231"></a>00231             anything_written = <span class="keyword">true</span>;
 
290
<a name="l00232"></a>00232         }
 
291
<a name="l00233"></a>00233       }
 
292
<a name="l00234"></a>00234     }
 
293
<a name="l00235"></a>00235   }
 
294
<a name="l00236"></a>00236   <span class="keywordflow">return</span> anything_written &amp;&amp; well_formed;
 
295
<a name="l00237"></a>00237 }                                <span class="comment">/* ValidCharDescription */</span>
 
296
<a name="l00238"></a>00238 
 
297
<a name="l00239"></a>00239 <span class="comment">/*---------------------------------------------------------------------------*/</span>
 
298
<a name="l00261"></a><a class="code" href="a00891.html#ae1558f5d4119a9e651a85e10887be9f3">00261</a> <a class="code" href="a00297.html">CHAR_DESC</a> <a class="code" href="a00890.html#ae1558f5d4119a9e651a85e10887be9f3">ReadCharDescription</a>(<span class="keyword">const</span> <a class="code" href="a00376.html">FEATURE_DEFS_STRUCT</a> &amp;FeatureDefs,
 
299
<a name="l00262"></a>00262                               FILE *File) {
 
300
<a name="l00263"></a>00263   <span class="keywordtype">int</span> NumSetsToRead;
 
301
<a name="l00264"></a>00264   <span class="keywordtype">char</span> ShortName[<a class="code" href="a00929.html#a988007e06743db204d076f3c68161469">FEAT_NAME_SIZE</a>];
 
302
<a name="l00265"></a>00265   <a class="code" href="a00297.html">CHAR_DESC</a> CharDesc;
 
303
<a name="l00266"></a>00266   <span class="keywordtype">int</span> Type;
 
304
<a name="l00267"></a>00267 
 
305
<a name="l00268"></a>00268   <span class="keywordflow">if</span> (fscanf (File, <span class="stringliteral">&quot;%d&quot;</span>, &amp;NumSetsToRead) != 1 ||
 
306
<a name="l00269"></a>00269     NumSetsToRead &lt; 0 || NumSetsToRead &gt; FeatureDefs.<a class="code" href="a00376.html#ac99b06fc21085f9b57a4b3d56a67a715">NumFeatureTypes</a>)
 
307
<a name="l00270"></a>00270     <a class="code" href="a01031.html#a480942fa88232bda23e9809e5afa9f25">DoError</a> (<a class="code" href="a00890.html#ada39950713e21f70f302841f185fba09">ILLEGAL_NUM_SETS</a>, <span class="stringliteral">&quot;Illegal number of feature sets&quot;</span>);
 
308
<a name="l00271"></a>00271 
 
309
<a name="l00272"></a>00272   CharDesc = <a class="code" href="a00890.html#a860f7517bac9477e79551e501df549ed">NewCharDescription</a>(FeatureDefs);
 
310
<a name="l00273"></a>00273   <span class="keywordflow">for</span> (; NumSetsToRead &gt; 0; NumSetsToRead--) {
 
311
<a name="l00274"></a>00274     fscanf (File, <span class="stringliteral">&quot;%s&quot;</span>, ShortName);
 
312
<a name="l00275"></a>00275     Type = <a class="code" href="a00890.html#a46a09d60beb44b9c9156346595f352ee">ShortNameToFeatureType</a>(FeatureDefs, ShortName);
 
313
<a name="l00276"></a>00276     CharDesc-&gt;<a class="code" href="a00297.html#ae04ec3a6b5e474d83930ff3e57a42acb">FeatureSets</a>[Type] =
 
314
<a name="l00277"></a>00277       <a class="code" href="a00928.html#adbac3342338c1fb0f38aad20c3c324d8">ReadFeatureSet</a> (File, FeatureDefs.<a class="code" href="a00376.html#ab09a6d77d42a8a2b5882bbc27ee4f23c">FeatureDesc</a>[Type]);
 
315
<a name="l00278"></a>00278   }
 
316
<a name="l00279"></a>00279   <span class="keywordflow">return</span> (CharDesc);
 
317
<a name="l00280"></a>00280 
 
318
<a name="l00281"></a>00281 }                                <span class="comment">// ReadCharDescription</span>
 
319
<a name="l00282"></a>00282 
 
320
<a name="l00283"></a>00283 
 
321
<a name="l00284"></a>00284 <span class="comment">/*---------------------------------------------------------------------------*/</span>
 
322
<a name="l00300"></a><a class="code" href="a00891.html#a46a09d60beb44b9c9156346595f352ee">00300</a> <span class="keywordtype">int</span> <a class="code" href="a00890.html#a46a09d60beb44b9c9156346595f352ee">ShortNameToFeatureType</a>(<span class="keyword">const</span> <a class="code" href="a00376.html">FEATURE_DEFS_STRUCT</a> &amp;FeatureDefs,
 
323
<a name="l00301"></a>00301                            <span class="keyword">const</span> <span class="keywordtype">char</span> *ShortName) {
 
324
<a name="l00302"></a>00302   <span class="keywordtype">int</span> i;
 
325
<a name="l00303"></a>00303 
 
326
<a name="l00304"></a>00304   <span class="keywordflow">for</span> (i = 0; i &lt; FeatureDefs.<a class="code" href="a00376.html#ac99b06fc21085f9b57a4b3d56a67a715">NumFeatureTypes</a>; i++)
 
327
<a name="l00305"></a>00305     <span class="keywordflow">if</span> (!strcmp ((FeatureDefs.<a class="code" href="a00376.html#ab09a6d77d42a8a2b5882bbc27ee4f23c">FeatureDesc</a>[i]-&gt;<a class="code" href="a00377.html#a11853141d8e7d72bdb9bc320001fa3d0">ShortName</a>), ShortName))
 
328
<a name="l00306"></a>00306       <span class="keywordflow">return</span> (i);
 
329
<a name="l00307"></a>00307   <a class="code" href="a01031.html#a480942fa88232bda23e9809e5afa9f25">DoError</a> (<a class="code" href="a00891.html#a868936345759056133e0fbbc97d1a656">ILLEGAL_SHORT_NAME</a>, <span class="stringliteral">&quot;Illegal short name for a feature&quot;</span>);
 
330
<a name="l00308"></a>00308   <span class="keywordflow">return</span> 0;
 
331
<a name="l00309"></a>00309 
 
332
<a name="l00310"></a>00310 }                                <span class="comment">// ShortNameToFeatureType</span>
 
333
</pre></div></div><!-- contents -->
 
334
</div>
 
335
<!-- window showing the filter options -->
 
336
<div id="MSearchSelectWindow"
 
337
     onmouseover="return searchBox.OnSearchSelectShow()"
 
338
     onmouseout="return searchBox.OnSearchSelectHide()"
 
339
     onkeydown="return searchBox.OnSearchSelectKey(event)">
 
340
<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>
 
341
 
 
342
<!-- iframe showing the search results (closed by default) -->
 
343
<div id="MSearchResultsWindow">
 
344
<iframe src="javascript:void(0)" frameborder="0" 
 
345
        name="MSearchResults" id="MSearchResults">
 
346
</iframe>
 
347
</div>
 
348
 
 
349
  <div id="nav-path" class="navpath">
 
350
    <ul>
 
351
      <li class="navelem"><a class="el" href="a00890.html">featdefs.cpp</a>      </li>
 
352
 
 
353
    <li class="footer">Generated on Mon Feb 3 2014 10:59:09 for tesseract by
 
354
    <a href="http://www.doxygen.org/index.html">
 
355
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
 
356
   </ul>
 
357
 </div>
 
358
 
 
359
 
 
360
</body>
 
361
</html>