-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy patha00083_source.html
302 lines (300 loc) · 340 KB
/
a00083_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tesseract: /usr/src/tesseract-ocr.master/src/ccmain/equationdetect.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">tesseract
 <span id="projectnumber">4.0.0-1-g2a2b</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00083_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">equationdetect.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="a00083.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// File: equationdetect.cpp</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// Description: Helper classes to detect equations.</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">// Author: Zongyi (Joe) Liu ([email protected])</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">// Created: Fri Aug 31 11:13:01 PST 2011</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">//</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">// (C) Copyright 2011, Google Inc.</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">// Licensed under the Apache License, Version 2.0 (the "License");</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">// you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">// You may obtain a copy of the License at</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">// distributed under the License is distributed on an "AS IS" BASIS,</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">// See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment">// limitations under the License.</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment">//</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"></span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#ifdef __MINGW32__</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <limits.h></span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> </div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include <algorithm></span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <cfloat></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <limits></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include <memory></span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> </div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="comment">// Include automatically generated configuration file if running autoconf.</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#ifdef HAVE_CONFIG_H</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#include "config_auto.h"</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#include "<a class="code" href="a00086.html">equationdetect.h</a>"</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#include "<a class="code" href="a01091.html">bbgrid.h</a>"</span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="preprocessor">#include "<a class="code" href="a00659.html">classify.h</a>"</span></div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="preprocessor">#include "<a class="code" href="a01127.html">colpartition.h</a>"</span></div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#include "<a class="code" href="a01133.html">colpartitiongrid.h</a>"</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor">#include "<a class="code" href="a01139.html">colpartitionset.h</a>"</span></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="preprocessor">#include "<a class="code" href="a00527.html">helpers.h</a>"</span></div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="preprocessor">#include "<a class="code" href="a00401.html">ratngs.h</a>"</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="preprocessor">#include "<a class="code" href="a00191.html">tesseractclass.h</a>"</span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="comment">// Config variables.</span></div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="a00083.html#ab3821a15abf7ddbf050f01af5138a7ec"> 46</a></span> <a class="code" href="a00557.html#a442e7f541a050acf5ebda026db177877">BOOL_VAR</a>(<a class="code" href="a00083.html#ab3821a15abf7ddbf050f01af5138a7ec">equationdetect_save_bi_image</a>, <span class="keyword">false</span>, <span class="stringliteral">"Save input bi image"</span>);</div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="a00083.html#a6a58c01b3dc1775eb9566e7151be8389"> 47</a></span> <a class="code" href="a00557.html#a442e7f541a050acf5ebda026db177877">BOOL_VAR</a>(<a class="code" href="a00083.html#a6a58c01b3dc1775eb9566e7151be8389">equationdetect_save_spt_image</a>, <span class="keyword">false</span>, <span class="stringliteral">"Save special character image"</span>);</div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="a00083.html#a5c4a2fdf13d6975e77cffaa102f74b37"> 48</a></span> <a class="code" href="a00557.html#a442e7f541a050acf5ebda026db177877">BOOL_VAR</a>(<a class="code" href="a00083.html#a5c4a2fdf13d6975e77cffaa102f74b37">equationdetect_save_seed_image</a>, <span class="keyword">false</span>, <span class="stringliteral">"Save the seed image"</span>);</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="a00083.html#ad6fcc8bf72a1d8f1162e2dfb30d30d2f"> 49</a></span> <a class="code" href="a00557.html#a442e7f541a050acf5ebda026db177877">BOOL_VAR</a>(<a class="code" href="a00083.html#ad6fcc8bf72a1d8f1162e2dfb30d30d2f">equationdetect_save_merged_image</a>, <span class="keyword">false</span>, <span class="stringliteral">"Save the merged image"</span>);</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="keyword">namespace </span><a class="code" href="a01629.html">tesseract</a> {</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="comment">// Utility ColParition sort functions.</span></div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> <span class="comment"></span><span class="keyword">static</span> <span class="keywordtype">int</span> SortCPByTopReverse(<span class="keyword">const</span> <span class="keywordtype">void</span>* p1, <span class="keyword">const</span> <span class="keywordtype">void</span>* p2) {</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keyword">const</span> ColPartition* cp1 = *<span class="keyword">static_cast<</span>ColPartition* const*<span class="keyword">></span>(p1);</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keyword">const</span> ColPartition* cp2 = *<span class="keyword">static_cast<</span>ColPartition* const*<span class="keyword">></span>(p2);</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(cp1 != <span class="keyword">nullptr</span> && cp2 != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a> &box1(cp1->bounding_box()), &box2(cp2->bounding_box());</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keywordflow">return</span> box2.<a class="code" href="a02610.html#a5dc64d0677b5d65385bc07a78cf49c4d">top</a>() - box1.top();</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> }</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span> </div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <span class="keyword">static</span> <span class="keywordtype">int</span> SortCPByBottom(<span class="keyword">const</span> <span class="keywordtype">void</span>* p1, <span class="keyword">const</span> <span class="keywordtype">void</span>* p2) {</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keyword">const</span> ColPartition* cp1 = *<span class="keyword">static_cast<</span>ColPartition* const*<span class="keyword">></span>(p1);</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keyword">const</span> ColPartition* cp2 = *<span class="keyword">static_cast<</span>ColPartition* const*<span class="keyword">></span>(p2);</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(cp1 != <span class="keyword">nullptr</span> && cp2 != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a> &box1(cp1->bounding_box()), &box2(cp2->bounding_box());</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keywordflow">return</span> box1.<a class="code" href="a02610.html#a9fee4521e71300975cb34ebb21e3fca5">bottom</a>() - box2.bottom();</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> }</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span> <span class="keyword">static</span> <span class="keywordtype">int</span> SortCPByHeight(<span class="keyword">const</span> <span class="keywordtype">void</span>* p1, <span class="keyword">const</span> <span class="keywordtype">void</span>* p2) {</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keyword">const</span> ColPartition* cp1 = *<span class="keyword">static_cast<</span>ColPartition* const*<span class="keyword">></span>(p1);</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="keyword">const</span> ColPartition* cp2 = *<span class="keyword">static_cast<</span>ColPartition* const*<span class="keyword">></span>(p2);</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(cp1 != <span class="keyword">nullptr</span> && cp2 != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a> &box1(cp1->bounding_box()), &box2(cp2->bounding_box());</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="keywordflow">return</span> box1.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>() - box2.height();</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> }</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span> </div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="comment">// TODO(joeliu): we may want to parameterize these constants.</span></div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="a01629.html#ad996502770c51cc260e4d66db9543bcc"> 81</a></span> <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="a01629.html#ad996502770c51cc260e4d66db9543bcc">kMathDigitDensityTh1</a> = 0.25;</div><div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="a01629.html#a2a82022958d051af0fb624095c3ada00"> 82</a></span> <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="a01629.html#a2a82022958d051af0fb624095c3ada00">kMathDigitDensityTh2</a> = 0.1;</div><div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="a01629.html#ad64e658be002902d7a5b0dd98ab0fe35"> 83</a></span> <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="a01629.html#ad64e658be002902d7a5b0dd98ab0fe35">kMathItalicDensityTh</a> = 0.5;</div><div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="a01629.html#a07a51423879204a025d373c6ae40fba5"> 84</a></span> <span class="keyword">const</span> <span class="keywordtype">float</span> <a class="code" href="a01629.html#a07a51423879204a025d373c6ae40fba5">kUnclearDensityTh</a> = 0.25;</div><div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="a01629.html#a113f000461790e1cd1c397f382814da5"> 85</a></span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="a01629.html#a113f000461790e1cd1c397f382814da5">kSeedBlobsCountTh</a> = 10;</div><div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="a01629.html#a1a5ac6fad51e61e88df309fb704d8ebc"> 86</a></span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="a01629.html#a1a5ac6fad51e61e88df309fb704d8ebc">kLeftIndentAlignmentCountTh</a> = 1;</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> </div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="comment">// Returns true if PolyBlockType is of text type or equation type.</span></div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="a01629.html#a1aff6897e170c358d7672413b3c221de"> 89</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(<a class="code" href="a00380.html#a03566528a98c079dafeebf00502f2b60">PolyBlockType</a> type) {</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordflow">return</span> <a class="code" href="a00380.html#a49b7c03fb4e55b82a8fd22b7c6094082">PTIsTextType</a>(type) || type == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> }</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> </div><div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="a01629.html#afe260b66ccf11a3f3346ba282f315c49"> 93</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a01629.html#afe260b66ccf11a3f3346ba282f315c49">IsLeftIndented</a>(<span class="keyword">const</span> <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223">EquationDetect::IndentType</a> type) {</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordflow">return</span> type == <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223aab75a5b0799710a14abdda1687c1ae0e">EquationDetect::LEFT_INDENT</a> ||</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  type == <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a4c2d65f544868a206cf72cd4928c8d06">EquationDetect::BOTH_INDENT</a>;</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> }</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> </div><div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="a01629.html#a8a161b61eb46383ddad93473fb3d8749"> 98</a></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a01629.html#a8a161b61eb46383ddad93473fb3d8749">IsRightIndented</a>(<span class="keyword">const</span> <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223">EquationDetect::IndentType</a> type) {</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordflow">return</span> type == <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a8b060953ddfce6e934e4346ba630606b">EquationDetect::RIGHT_INDENT</a> ||</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  type == <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a4c2d65f544868a206cf72cd4928c8d06">EquationDetect::BOTH_INDENT</a>;</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> }</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> </div><div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="a02246.html#a0867ba3cb66855f3c625537b6b570447"> 103</a></span> <a class="code" href="a02246.html#a0867ba3cb66855f3c625537b6b570447">EquationDetect::EquationDetect</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* equ_datapath,</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* equ_name) {</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keyword">const</span> <span class="keywordtype">char</span>* default_name = <span class="stringliteral">"equ"</span>;</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">if</span> (equ_name == <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  equ_name = default_name;</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  }</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a> = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a> = 0;</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <a class="code" href="a02246.html#aec76c4ef860f40ec042c65ea1340fc31">page_count_</a> = 0;</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> </div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#a4a19110ed5696ad383849388f1d7cb6f">equ_tesseract_</a>.<a class="code" href="a02358.html#a1267fb55994276b60fa5f5a34f508135">init_tesseract</a>(equ_datapath, equ_name,</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <a class="code" href="a01629.html#a04550a0ed1279562027bf2fc92c421aeaea8028f61e76a0f4def7cbe7905206cf">OEM_TESSERACT_ONLY</a>)) {</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Warning: equation region detection requested,"</span></div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="stringliteral">" but %s failed to load from %s\n"</span>, equ_name, equ_datapath);</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  }</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a> = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span> }</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00122"></a><span class="lineno"><a class="line" href="a02246.html#a09236e0cf2e96fd341927a9dbb822f95"> 122</a></span> <a class="code" href="a02246.html#a09236e0cf2e96fd341927a9dbb822f95">EquationDetect::~EquationDetect</a>() { <span class="keyword">delete</span> (<a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a>); }</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> </div><div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="a02246.html#aded5530c6cdae80194a4ec70104d9889"> 124</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#aded5530c6cdae80194a4ec70104d9889">EquationDetect::SetLangTesseract</a>(<a class="code" href="a02358.html">Tesseract</a>* lang_tesseract) {</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a> = lang_tesseract;</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span> }</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span> </div><div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="a02246.html#a1e62860539cd17573c8f8d8aaf4a07e2"> 128</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a1e62860539cd17573c8f8d8aaf4a07e2">EquationDetect::SetResolution</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> resolution) {</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a> = resolution;</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> }</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div><div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="a02246.html#af6d40cc16252ebeba9458c3d5946b5f9"> 132</a></span> <span class="keywordtype">int</span> <a class="code" href="a02246.html#af6d40cc16252ebeba9458c3d5946b5f9">EquationDetect::LabelSpecialText</a>(<a class="code" href="a02382.html">TO_BLOCK</a>* to_block) {</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordflow">if</span> (to_block == <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Warning: input to_block is nullptr!\n"</span>);</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  }</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <a class="code" href="a02182.html">GenericVector<BLOBNBOX_LIST*></a> blob_lists;</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  blob_lists.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(&(to_block-><a class="code" href="a02382.html#a5dd67c54162a6b60b0fd11500d4a3025">blobs</a>));</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  blob_lists.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(&(to_block-><a class="code" href="a02382.html#aafe2a9baa69300ee71da42e6dc18cfee">large_blobs</a>));</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < blob_lists.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  BLOBNBOX_IT bbox_it(blob_lists[i]);</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keywordflow">for</span> (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list();</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  bbox_it.forward()) {</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  bbox_it.data()->set_special_text_type(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca1e2ca6a59ce1487c101d4605eab44b7a">BSTT_NONE</a>);</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  }</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  }</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> </div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span> }</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span> </div><div class="line"><a name="l00152"></a><span class="lineno"><a class="line" href="a02246.html#a3ca64bf338dcbdc3ed9bdc4abf1c7aa1"> 152</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ae00172a9d9483ef7a204f2316e4d7f96">EquationDetect::IdentifySpecialText</a>(</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <a class="code" href="a02374.html">BLOBNBOX</a> *blobnbox, <span class="keyword">const</span> <span class="keywordtype">int</span> height_th) {</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(blobnbox != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <span class="keywordflow">if</span> (blobnbox-><a class="code" href="a02374.html#acc27a54c9735f05e9152ba5f1c1a8261">bounding_box</a>().<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>() < height_th && height_th > 0) {</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="comment">// For small blob, we simply set to BSTT_NONE.</span></div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  blobnbox-><a class="code" href="a02374.html#a1650427df7e6b935dd737ad9eb70c36b">set_special_text_type</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca1e2ca6a59ce1487c101d4605eab44b7a">BSTT_NONE</a>);</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  }</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> </div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  BLOB_CHOICE_LIST ratings_equ, ratings_lang;</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <a class="code" href="a02634.html">C_BLOB</a>* blob = blobnbox-><a class="code" href="a02374.html#a5d497fdc454feff733889db8fe604868">cblob</a>();</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  <span class="comment">// TODO(joeliu/rays) Fix this. We may have to normalize separately for</span></div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <span class="comment">// each classifier here, as they may require different PolygonalCopy.</span></div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <a class="code" href="a02398.html">TBLOB</a>* tblob = <a class="code" href="a02398.html#a7b6051e1c1934265a91e1ee864bd5164">TBLOB::PolygonalCopy</a>(<span class="keyword">false</span>, blob);</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& box = tblob-><a class="code" href="a02398.html#a56599f0cc0c2eb73d9c5fd490f03fc56">bounding_box</a>();</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span> </div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <span class="comment">// Normalize the blob. Set the origin to the place we want to be the</span></div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  <span class="comment">// bottom-middle, and scaling is to make the height the x-height.</span></div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> scaling = <span class="keyword">static_cast<</span><span class="keywordtype">float</span><span class="keyword">></span>(<a class="code" href="a00314.html#af974e6755e636c8bc7cbe57e3bcbdd73">kBlnXHeight</a>) / box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>();</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> x_orig = (box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>() + box.<a class="code" href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">right</a>()) / 2.0f, y_orig = box.<a class="code" href="a02610.html#a9fee4521e71300975cb34ebb21e3fca5">bottom</a>();</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  std::unique_ptr<TBLOB> normed_blob(<span class="keyword">new</span> <a class="code" href="a02398.html">TBLOB</a>(*tblob));</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  normed_blob-><a class="code" href="a02398.html#a6aef0201c756ed33e68a94abc8ac2b8e">Normalize</a>(<span class="keyword">nullptr</span>, <span class="keyword">nullptr</span>, <span class="keyword">nullptr</span>, x_orig, y_orig, scaling, scaling,</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  0.0f, static_cast<float>(<a class="code" href="a00314.html#abe10ce41bf7240ae8a053dea471d6ed5">kBlnBaselineOffset</a>),</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  <span class="keyword">false</span>, <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <a class="code" href="a02246.html#a4a19110ed5696ad383849388f1d7cb6f">equ_tesseract_</a>.<a class="code" href="a03998.html#ab39a42222f621c9a5f1bd1b31db3a930">AdaptiveClassifier</a>(normed_blob.get(), &ratings_equ);</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a03998.html#ab39a42222f621c9a5f1bd1b31db3a930">AdaptiveClassifier</a>(normed_blob.get(), &ratings_lang);</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  <span class="keyword">delete</span> tblob;</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span> </div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  <span class="comment">// Get the best choice from ratings_lang and rating_equ. As the choice in the</span></div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <span class="comment">// list has already been sorted by the certainty, we simply use the first</span></div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <span class="comment">// choice.</span></div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  <a class="code" href="a02602.html">BLOB_CHOICE</a> *lang_choice = <span class="keyword">nullptr</span>, *equ_choice = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <span class="keywordflow">if</span> (ratings_lang.length() > 0) {</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  BLOB_CHOICE_IT choice_it(&ratings_lang);</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  lang_choice = choice_it.data();</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  }</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <span class="keywordflow">if</span> (ratings_equ.length() > 0) {</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  BLOB_CHOICE_IT choice_it(&ratings_equ);</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  equ_choice = choice_it.data();</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  }</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span> </div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> lang_score = lang_choice ? lang_choice-><a class="code" href="a02602.html#a32e1cb6ffd5a422c29da3557d826fa3c">certainty</a>() : -FLT_MAX;</div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> equ_score = equ_choice ? equ_choice->certainty() : -FLT_MAX;</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span> </div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> kConfScoreTh = -5.0f, kConfDiffTh = 1.8;</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="comment">// The scores here are negative, so the max/min == fabs(min/max).</span></div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  <span class="comment">// float ratio = fmax(lang_score, equ_score) / fmin(lang_score, equ_score);</span></div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> diff = fabs(lang_score - equ_score);</div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8c">BlobSpecialTextType</a> type = <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca1e2ca6a59ce1487c101d4605eab44b7a">BSTT_NONE</a>;</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> </div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  <span class="comment">// Classification.</span></div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  <span class="keywordflow">if</span> (fmax(lang_score, equ_score) < kConfScoreTh) {</div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  <span class="comment">// If both score are very small, then mark it as unclear.</span></div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  type = <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca604529fa299b8dcc81b0ac07ebb2c9b7">BSTT_UNCLEAR</a>;</div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (diff > kConfDiffTh && equ_score > lang_score) {</div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="comment">// If equ_score is significantly higher, then we classify this character as</span></div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span>  <span class="comment">// math symbol.</span></div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  type = <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca356056d522254adc40c8acdf14f19c4d">BSTT_MATH</a>;</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (lang_choice) {</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="comment">// For other cases: lang_score is similar or significantly higher.</span></div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  type = <a class="code" href="a02246.html#a488adea749ff34ca6f2efc000c82001d">EstimateTypeForUnichar</a>(</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">unicharset</a>, lang_choice-><a class="code" href="a02602.html#ad448095b666bfb864211714ec2c2375e">unichar_id</a>());</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  }</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span> </div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <span class="keywordflow">if</span> (type == <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca1e2ca6a59ce1487c101d4605eab44b7a">BSTT_NONE</a> && <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a03998.html#a62597f182a5e23c3b8a030c06e699e99">get_fontinfo_table</a>().get(</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  lang_choice-><a class="code" href="a02602.html#a8f65937e4611000f52b89235dcc28d7f">fontinfo_id</a>()).is_italic()) {</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  <span class="comment">// For text symbol, we still check if it is italic.</span></div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  blobnbox-><a class="code" href="a02374.html#a1650427df7e6b935dd737ad9eb70c36b">set_special_text_type</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca9f7c059031ba5f95a4e0f43bac16a33a">BSTT_ITALIC</a>);</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  blobnbox-><a class="code" href="a02374.html#a1650427df7e6b935dd737ad9eb70c36b">set_special_text_type</a>(type);</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  }</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span> }</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span> </div><div class="line"><a name="l00225"></a><span class="lineno"><a class="line" href="a02246.html#a488adea749ff34ca6f2efc000c82001d"> 225</a></span> <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8c">BlobSpecialTextType</a> <a class="code" href="a02246.html#a488adea749ff34ca6f2efc000c82001d">EquationDetect::EstimateTypeForUnichar</a>(</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  <span class="keyword">const</span> <a class="code" href="a03950.html">UNICHARSET</a>& unicharset, <span class="keyword">const</span> <a class="code" href="a00605.html#afedceee7ea132dae3d224db2cf8b5618">UNICHAR_ID</a> <span class="keywordtype">id</span>)<span class="keyword"> const </span>{</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="keyword">const</span> <a class="code" href="a02834.html">STRING</a> s = unicharset.<a class="code" href="a03950.html#aa19fb595808fe4688c580334937dfa45">id_to_unichar</a>(<span class="keywordtype">id</span>);</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <span class="keywordflow">if</span> (unicharset.<a class="code" href="a03950.html#a620c3ec802c8ddf9401a6940f542618e">get_isalpha</a>(<span class="keywordtype">id</span>)) {</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="keywordflow">return</span> <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca1e2ca6a59ce1487c101d4605eab44b7a">BSTT_NONE</a>;</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  }</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span> </div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keywordflow">if</span> (unicharset.<a class="code" href="a03950.html#a4b8a480ae40b5ead314b25f95a5dc490">get_ispunctuation</a>(<span class="keywordtype">id</span>)) {</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <span class="comment">// Exclude some special texts that are likely to be confused as math symbol.</span></div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <span class="keyword">static</span> <a class="code" href="a02182.html">GenericVector<UNICHAR_ID></a> ids_to_exclude;</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="keywordflow">if</span> (ids_to_exclude.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>()) {</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="a02834.html">STRING</a> kCharsToEx[] = {<span class="stringliteral">"'"</span>, <span class="stringliteral">"`"</span>, <span class="stringliteral">"\""</span>, <span class="stringliteral">"\\"</span>, <span class="stringliteral">","</span>, <span class="stringliteral">"."</span>,</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="stringliteral">"〈"</span>, <span class="stringliteral">"〉"</span>, <span class="stringliteral">"《"</span>, <span class="stringliteral">"》"</span>, <span class="stringliteral">"」"</span>, <span class="stringliteral">"「"</span>, <span class="stringliteral">""</span>};</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordtype">int</span> i = 0;</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <span class="keywordflow">while</span> (kCharsToEx[i] != <span class="stringliteral">""</span>) {</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  ids_to_exclude.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  unicharset.<a class="code" href="a03950.html#aeb2253dcb5f01c81fcba5f4af417eadf">unichar_to_id</a>(kCharsToEx[i++].<a class="code" href="a02834.html#abf0a7b3c6ae39a46e5441f28f61de5de">string</a>()));</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  }</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  ids_to_exclude.<a class="code" href="a02182.html#a999bbd8ff336c81fe1198ea714c7936d">sort</a>();</div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  }</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  <span class="keywordflow">return</span> ids_to_exclude.<a class="code" href="a02182.html#a8c261f66a24da67aac1acca7aa8f650a">bool_binary_search</a>(<span class="keywordtype">id</span>) ? <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca1e2ca6a59ce1487c101d4605eab44b7a">BSTT_NONE</a> : <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca356056d522254adc40c8acdf14f19c4d">BSTT_MATH</a>;</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  }</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> </div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <span class="comment">// Check if it is digit. In addition to the isdigit attribute, we also check</span></div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  <span class="comment">// if this character belongs to those likely to be confused with a digit.</span></div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="a02834.html">STRING</a> kDigitsChars = <span class="stringliteral">"|"</span>;</div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="keywordflow">if</span> (unicharset.<a class="code" href="a03950.html#a98079b3ce062183388c653eee9838e3c">get_isdigit</a>(<span class="keywordtype">id</span>) ||</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  (s.<a class="code" href="a02834.html#a7a1f2a841e8d01d5a8c05bc3ab8064eb">length</a>() == 1 && kDigitsChars.<a class="code" href="a02834.html#ac8c4ceca1e688adcdf188aef108dc18b">contains</a>(s[0]))) {</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordflow">return</span> <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8caaf28e2df284d1c1c8caf262b5fcdb3f4">BSTT_DIGIT</a>;</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  <span class="keywordflow">return</span> <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca356056d522254adc40c8acdf14f19c4d">BSTT_MATH</a>;</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  }</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span> }</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span> </div><div class="line"><a name="l00259"></a><span class="lineno"><a class="line" href="a02246.html#ae00172a9d9483ef7a204f2316e4d7f96"> 259</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ae00172a9d9483ef7a204f2316e4d7f96">EquationDetect::IdentifySpecialText</a>() {</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  <span class="comment">// Set configuration for Tesseract::AdaptiveClassifier.</span></div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <a class="code" href="a02246.html#a4a19110ed5696ad383849388f1d7cb6f">equ_tesseract_</a>.<a class="code" href="a03998.html#a746dbbd1c99e99f3d213077cceedf80e">tess_cn_matching</a>.set_value(1); <span class="comment">// turn it on</span></div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <a class="code" href="a02246.html#a4a19110ed5696ad383849388f1d7cb6f">equ_tesseract_</a>.<a class="code" href="a03998.html#a85fcc9966cddbc38adf1014dd0cd778c">tess_bn_matching</a>.set_value(0);</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span> </div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  <span class="comment">// Set the multiplier to zero for lang_tesseract_ to improve the accuracy.</span></div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> classify_class_pruner = <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a03998.html#a406c1644ce61dfb376ae9975f89c54ba">classify_class_pruner_multiplier</a>;</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> classify_integer_matcher =</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a03998.html#acab8de2f560b04b48191f60099e4244b">classify_integer_matcher_multiplier</a>;</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a03998.html#a406c1644ce61dfb376ae9975f89c54ba">classify_class_pruner_multiplier</a>.set_value(0);</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a03998.html#acab8de2f560b04b48191f60099e4244b">classify_integer_matcher_multiplier</a>.set_value(0);</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span> </div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> gsearch(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <a class="code" href="a04570.html">ColPartition</a> *part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  gsearch.<a class="code" href="a04502.html#ad7f7e99bcda5e0daeb682b772e445f60">StartFullSearch</a>();</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <span class="keywordflow">while</span> ((part = gsearch.<a class="code" href="a04502.html#ae9cd15b1815e744caf0650320aecfc2c">NextFullSearch</a>()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <span class="keywordflow">if</span> (!<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>())) {</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  }</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  <a class="code" href="a02246.html#ab4f5bf2daf3f1ab5332c879ef98e5008">IdentifyBlobsToSkip</a>(part);</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  BLOBNBOX_C_IT bbox_it(part-><a class="code" href="a04570.html#a3fc2dd797ede7a62546b2565811e9ce0">boxes</a>());</div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <span class="comment">// Compute the height threshold.</span></div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <a class="code" href="a02182.html">GenericVector<int></a> blob_heights;</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  <span class="keywordflow">for</span> (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list();</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  bbox_it.forward()) {</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  <span class="keywordflow">if</span> (bbox_it.data()->special_text_type() != <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca6fac1a2510eab4553549833d5d1afdc0">BSTT_SKIP</a>) {</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  blob_heights.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(bbox_it.data()->bounding_box().height());</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  }</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  }</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  blob_heights.sort();</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> height_th = blob_heights[blob_heights.size() / 2] / 3 * 2;</div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  <span class="keywordflow">for</span> (bbox_it.mark_cycle_pt (); !bbox_it.cycled_list();</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  bbox_it.forward()) {</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  <span class="keywordflow">if</span> (bbox_it.data()->special_text_type() != <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca6fac1a2510eab4553549833d5d1afdc0">BSTT_SKIP</a>) {</div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  <a class="code" href="a02246.html#ae00172a9d9483ef7a204f2316e4d7f96">IdentifySpecialText</a>(bbox_it.data(), height_th);</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  }</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  }</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  }</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span> </div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  <span class="comment">// Set the multiplier values back.</span></div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a03998.html#a406c1644ce61dfb376ae9975f89c54ba">classify_class_pruner_multiplier</a>.set_value(</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  classify_class_pruner);</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a03998.html#acab8de2f560b04b48191f60099e4244b">classify_integer_matcher_multiplier</a>.set_value(</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  classify_integer_matcher);</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span> </div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  <span class="keywordflow">if</span> (<a class="code" href="a00083.html#a6a58c01b3dc1775eb9566e7151be8389">equationdetect_save_spt_image</a>) { <span class="comment">// For debug.</span></div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  <a class="code" href="a02834.html">STRING</a> outfile;</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  <a class="code" href="a02246.html#a0c05543fe14374e0ecbbcd40568ef318">GetOutputTiffName</a>(<span class="stringliteral">"_spt"</span>, &outfile);</div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <a class="code" href="a02246.html#a56443e2bab5cd7a0376dbd8e05fe7bdd">PaintSpecialTexts</a>(outfile);</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  }</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span> }</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span> </div><div class="line"><a name="l00311"></a><span class="lineno"><a class="line" href="a02246.html#ab4f5bf2daf3f1ab5332c879ef98e5008"> 311</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ab4f5bf2daf3f1ab5332c879ef98e5008">EquationDetect::IdentifyBlobsToSkip</a>(<a class="code" href="a04570.html">ColPartition</a>* part) {</div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part);</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span>  BLOBNBOX_C_IT blob_it(part-><a class="code" href="a04570.html#a3fc2dd797ede7a62546b2565811e9ce0">boxes</a>());</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span> </div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  <span class="keywordflow">for</span> (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  <span class="comment">// At this moment, no blob should have been joined.</span></div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(!blob_it.data()->joined_to_prev());</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  }</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  <span class="keywordflow">for</span> (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  <a class="code" href="a02374.html">BLOBNBOX</a>* blob = blob_it.data();</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  <span class="keywordflow">if</span> (blob-><a class="code" href="a02374.html#ab8e7a33dc069de65fa4b6d0cab61d0c1">joined_to_prev</a>() || blob-><a class="code" href="a02374.html#a79b752b4d1c29649d56006acb960aa13">special_text_type</a>() == <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca6fac1a2510eab4553549833d5d1afdc0">BSTT_SKIP</a>) {</div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span>  }</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  <a class="code" href="a02610.html">TBOX</a> blob_box = blob-><a class="code" href="a02374.html#acc27a54c9735f05e9152ba5f1c1a8261">bounding_box</a>();</div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span> </div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  <span class="comment">// Search if any blob can be merged into blob. If found, then we mark all</span></div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  <span class="comment">// these blobs as BSTT_SKIP.</span></div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  BLOBNBOX_C_IT blob_it2 = blob_it;</div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  <span class="keywordtype">bool</span> found = <span class="keyword">false</span>;</div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  <span class="keywordflow">while</span> (!blob_it2.at_last()) {</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span>  <a class="code" href="a02374.html">BLOBNBOX</a>* nextblob = blob_it2.forward();</div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& nextblob_box = nextblob-><a class="code" href="a02374.html#acc27a54c9735f05e9152ba5f1c1a8261">bounding_box</a>();</div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span>  <span class="keywordflow">if</span> (nextblob_box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>() >= blob_box.<a class="code" href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">right</a>()) {</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  }</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> kWidthR = 0.4, kHeightR = 0.3;</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  <span class="keyword">const</span> <span class="keywordtype">bool</span> xoverlap = blob_box.<a class="code" href="a02610.html#ade947e3871fa316e3e0b0864905c2997">major_x_overlap</a>(nextblob_box),</div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  yoverlap = blob_box.<a class="code" href="a02610.html#a8b532906f18f4c55055f47ec6b843608">y_overlap</a>(nextblob_box);</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> widthR = <span class="keyword">static_cast<</span><span class="keywordtype">float</span><span class="keyword">></span>(</div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  std::min(nextblob_box.<a class="code" href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">width</a>(), blob_box.<a class="code" href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">width</a>())) /</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  std::max(nextblob_box.<a class="code" href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">width</a>(), blob_box.<a class="code" href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">width</a>());</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> heightR = <span class="keyword">static_cast<</span><span class="keywordtype">float</span><span class="keyword">></span>(</div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  std::min(nextblob_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>(), blob_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>())) /</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  std::max(nextblob_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>(), blob_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>());</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span> </div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  <span class="keywordflow">if</span> (xoverlap && yoverlap && widthR > kWidthR && heightR > kHeightR) {</div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span>  <span class="comment">// Found one, set nextblob type and recompute blob_box.</span></div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  found = <span class="keyword">true</span>;</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  nextblob-><a class="code" href="a02374.html#a1650427df7e6b935dd737ad9eb70c36b">set_special_text_type</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca6fac1a2510eab4553549833d5d1afdc0">BSTT_SKIP</a>);</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  blob_box += nextblob_box;</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  }</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  }</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  <span class="keywordflow">if</span> (found) {</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  blob-><a class="code" href="a02374.html#a1650427df7e6b935dd737ad9eb70c36b">set_special_text_type</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca6fac1a2510eab4553549833d5d1afdc0">BSTT_SKIP</a>);</div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  }</div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  }</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span> }</div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span> </div><div class="line"><a name="l00359"></a><span class="lineno"><a class="line" href="a02246.html#a800a94628a99a8f3e054619e170d7fbb"> 359</a></span> <span class="keywordtype">int</span> <a class="code" href="a02246.html#a800a94628a99a8f3e054619e170d7fbb">EquationDetect::FindEquationParts</a>(</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  <a class="code" href="a04574.html">ColPartitionGrid</a>* part_grid, <a class="code" href="a04578.html">ColPartitionSet</a>** best_columns) {</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  <span class="keywordflow">if</span> (!<a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>) {</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Warning: lang_tesseract_ is nullptr!\n"</span>);</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  }</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  <span class="keywordflow">if</span> (!part_grid || !best_columns) {</div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"part_grid/best_columns is nullptr!!\n"</span>);</div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  }</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.clear();</div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span>  <a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a> = part_grid;</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span>  <a class="code" href="a02246.html#a56fe80b060d60fd1d833b3054f44abdf">best_columns_</a> = best_columns;</div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a> = <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02358.html#aef3ac5f0035b4a75b470e96d0cab103a">source_resolution</a>();</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  <a class="code" href="a02834.html">STRING</a> outfile;</div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  <a class="code" href="a02246.html#aec76c4ef860f40ec042c65ea1340fc31">page_count_</a>++;</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span> </div><div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  <span class="keywordflow">if</span> (<a class="code" href="a00083.html#ab3821a15abf7ddbf050f01af5138a7ec">equationdetect_save_bi_image</a>) {</div><div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <a class="code" href="a02246.html#a0c05543fe14374e0ecbbcd40568ef318">GetOutputTiffName</a>(<span class="stringliteral">"_bi"</span>, &outfile);</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  pixWrite(outfile.<a class="code" href="a02834.html#abf0a7b3c6ae39a46e5441f28f61de5de">string</a>(), <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02358.html#ae6daf71366bf37ae460f95c5d9cad11b">pix_binary</a>(), IFF_TIFF_G4);</div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  }</div><div class="line"><a name="l00380"></a><span class="lineno"> 380</span> </div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  <span class="comment">// Pass 0: Compute special text type for blobs.</span></div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  <a class="code" href="a02246.html#ae00172a9d9483ef7a204f2316e4d7f96">IdentifySpecialText</a>();</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span> </div><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <span class="comment">// Pass 1: Merge parts by overlap.</span></div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  <a class="code" href="a02246.html#ad26e2adac7587d71b2a9394a4b8897a6">MergePartsByLocation</a>();</div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span> </div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  <span class="comment">// Pass 2: compute the math blob density and find the seed partition.</span></div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <a class="code" href="a02246.html#a39c1397a958168add27d1a4bbc3ff916">IdentifySeedParts</a>();</div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  <span class="comment">// We still need separate seed into block seed and inline seed partition.</span></div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  <a class="code" href="a02246.html#a89b2d841680f6f6207fc4f10b8d7839f">IdentifyInlineParts</a>();</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span> </div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  <span class="keywordflow">if</span> (<a class="code" href="a00083.html#a5c4a2fdf13d6975e77cffaa102f74b37">equationdetect_save_seed_image</a>) {</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  <a class="code" href="a02246.html#a0c05543fe14374e0ecbbcd40568ef318">GetOutputTiffName</a>(<span class="stringliteral">"_seed"</span>, &outfile);</div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  <a class="code" href="a02246.html#ada4df5ef0eee657cfeb7524205ce878a">PaintColParts</a>(outfile);</div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span>  }</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span> </div><div class="line"><a name="l00397"></a><span class="lineno"> 397</span>  <span class="comment">// Pass 3: expand block equation seeds.</span></div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  <span class="keywordflow">while</span> (!<a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.empty()) {</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> seeds_expanded;</div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.size(); ++i) {</div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#a76bc8a18a94fc5f89f6d4d073ba0c9bf">ExpandSeed</a>(<a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>[i])) {</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span>  <span class="comment">// If this seed is expanded, then we add it into seeds_expanded. Note</span></div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  <span class="comment">// this seed has been removed from part_grid_ if it is expanded.</span></div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  seeds_expanded.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(<a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>[i]);</div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  }</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span>  }</div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  <span class="comment">// Add seeds_expanded back into part_grid_ and reset cp_seeds_.</span></div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < seeds_expanded.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  <a class="code" href="a02246.html#a5f75b1dad656abfdb1a10eddeb8e65de">InsertPartAfterAbsorb</a>(seeds_expanded[i]);</div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  }</div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span>  <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a> = seeds_expanded;</div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span>  }</div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span> </div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <span class="comment">// Pass 4: find math block satellite text partitions and merge them.</span></div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  <a class="code" href="a02246.html#a0bb5b44fbab44c93cb338eed35b4ef4a">ProcessMathBlockSatelliteParts</a>();</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span> </div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span>  <span class="keywordflow">if</span> (<a class="code" href="a00083.html#ad6fcc8bf72a1d8f1162e2dfb30d30d2f">equationdetect_save_merged_image</a>) { <span class="comment">// For debug.</span></div><div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  <a class="code" href="a02246.html#a0c05543fe14374e0ecbbcd40568ef318">GetOutputTiffName</a>(<span class="stringliteral">"_merged"</span>, &outfile);</div><div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  <a class="code" href="a02246.html#ada4df5ef0eee657cfeb7524205ce878a">PaintColParts</a>(outfile);</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  }</div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span> </div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00423"></a><span class="lineno"> 423</span> }</div><div class="line"><a name="l00424"></a><span class="lineno"> 424</span> </div><div class="line"><a name="l00425"></a><span class="lineno"><a class="line" href="a02246.html#ad26e2adac7587d71b2a9394a4b8897a6"> 425</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ad26e2adac7587d71b2a9394a4b8897a6">EquationDetect::MergePartsByLocation</a>() {</div><div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  <a class="code" href="a04570.html">ColPartition</a>* part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  <span class="comment">// partitions that have been updated.</span></div><div class="line"><a name="l00429"></a><span class="lineno"> 429</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> parts_updated;</div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> gsearch(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span>  gsearch.<a class="code" href="a04502.html#ad7f7e99bcda5e0daeb682b772e445f60">StartFullSearch</a>();</div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span>  <span class="keywordflow">while</span> ((part = gsearch.<a class="code" href="a04502.html#ae9cd15b1815e744caf0650320aecfc2c">NextFullSearch</a>()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00433"></a><span class="lineno"> 433</span>  <span class="keywordflow">if</span> (!<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>())) {</div><div class="line"><a name="l00434"></a><span class="lineno"> 434</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00435"></a><span class="lineno"> 435</span>  }</div><div class="line"><a name="l00436"></a><span class="lineno"> 436</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> parts_to_merge;</div><div class="line"><a name="l00437"></a><span class="lineno"> 437</span>  <a class="code" href="a02246.html#ace94a05a89afb074b106c444584254d6">SearchByOverlap</a>(part, &parts_to_merge);</div><div class="line"><a name="l00438"></a><span class="lineno"> 438</span>  <span class="keywordflow">if</span> (parts_to_merge.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>()) {</div><div class="line"><a name="l00439"></a><span class="lineno"> 439</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00440"></a><span class="lineno"> 440</span>  }</div><div class="line"><a name="l00441"></a><span class="lineno"> 441</span> </div><div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  <span class="comment">// Merge parts_to_merge with part, and remove them from part_grid_.</span></div><div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  <a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>-><a class="code" href="a04514.html#adc713153c1282d8727f85ee6d38d7d31">RemoveBBox</a>(part);</div><div class="line"><a name="l00444"></a><span class="lineno"> 444</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < parts_to_merge.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l00445"></a><span class="lineno"> 445</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(parts_to_merge[i] != <span class="keyword">nullptr</span> && parts_to_merge[i] != part);</div><div class="line"><a name="l00446"></a><span class="lineno"> 446</span>  part-><a class="code" href="a04570.html#aedb906fb73709c79d702f0f95a85b300">Absorb</a>(parts_to_merge[i], <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00447"></a><span class="lineno"> 447</span>  }</div><div class="line"><a name="l00448"></a><span class="lineno"> 448</span>  gsearch.<a class="code" href="a04502.html#ae43afa517cd9b682f10ca1d54dad4ab0">RepositionIterator</a>();</div><div class="line"><a name="l00449"></a><span class="lineno"> 449</span> </div><div class="line"><a name="l00450"></a><span class="lineno"> 450</span>  parts_updated.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l00451"></a><span class="lineno"> 451</span>  }</div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span> </div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span>  <span class="keywordflow">if</span> (parts_updated.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>()) { <span class="comment">// Exit the loop</span></div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00455"></a><span class="lineno"> 455</span>  }</div><div class="line"><a name="l00456"></a><span class="lineno"> 456</span> </div><div class="line"><a name="l00457"></a><span class="lineno"> 457</span>  <span class="comment">// Re-insert parts_updated into part_grid_.</span></div><div class="line"><a name="l00458"></a><span class="lineno"> 458</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < parts_updated.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l00459"></a><span class="lineno"> 459</span>  <a class="code" href="a02246.html#a5f75b1dad656abfdb1a10eddeb8e65de">InsertPartAfterAbsorb</a>(parts_updated[i]);</div><div class="line"><a name="l00460"></a><span class="lineno"> 460</span>  }</div><div class="line"><a name="l00461"></a><span class="lineno"> 461</span>  }</div><div class="line"><a name="l00462"></a><span class="lineno"> 462</span> }</div><div class="line"><a name="l00463"></a><span class="lineno"> 463</span> </div><div class="line"><a name="l00464"></a><span class="lineno"><a class="line" href="a02246.html#ace94a05a89afb074b106c444584254d6"> 464</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ace94a05a89afb074b106c444584254d6">EquationDetect::SearchByOverlap</a>(</div><div class="line"><a name="l00465"></a><span class="lineno"> 465</span>  <a class="code" href="a04570.html">ColPartition</a>* seed,</div><div class="line"><a name="l00466"></a><span class="lineno"> 466</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a>* parts_overlap) {</div><div class="line"><a name="l00467"></a><span class="lineno"> 467</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(seed != <span class="keyword">nullptr</span> && parts_overlap != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span>  <span class="keywordflow">if</span> (!<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(seed-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>())) {</div><div class="line"><a name="l00469"></a><span class="lineno"> 469</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l00470"></a><span class="lineno"> 470</span>  }</div><div class="line"><a name="l00471"></a><span class="lineno"> 471</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l00472"></a><span class="lineno"> 472</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& seed_box(seed-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l00473"></a><span class="lineno"> 473</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kRadNeighborCells = 30;</div><div class="line"><a name="l00474"></a><span class="lineno"> 474</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.StartRadSearch((seed_box.left() + seed_box.right()) / 2,</div><div class="line"><a name="l00475"></a><span class="lineno"> 475</span>  (seed_box.top() + seed_box.bottom()) / 2,</div><div class="line"><a name="l00476"></a><span class="lineno"> 476</span>  kRadNeighborCells);</div><div class="line"><a name="l00477"></a><span class="lineno"> 477</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.SetUniqueMode(<span class="keyword">true</span>);</div><div class="line"><a name="l00478"></a><span class="lineno"> 478</span> </div><div class="line"><a name="l00479"></a><span class="lineno"> 479</span>  <span class="comment">// Search iteratively.</span></div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span>  <a class="code" href="a04570.html">ColPartition</a> *part;</div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> parts;</div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> kLargeOverlapTh = 0.95;</div><div class="line"><a name="l00483"></a><span class="lineno"> 483</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> kEquXOverlap = 0.4, kEquYOverlap = 0.5;</div><div class="line"><a name="l00484"></a><span class="lineno"> 484</span>  <span class="keywordflow">while</span> ((part = <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.NextRadSearch()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00485"></a><span class="lineno"> 485</span>  <span class="keywordflow">if</span> (part == seed || !<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>())) {</div><div class="line"><a name="l00486"></a><span class="lineno"> 486</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00487"></a><span class="lineno"> 487</span>  }</div><div class="line"><a name="l00488"></a><span class="lineno"> 488</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l00489"></a><span class="lineno"> 489</span>  <span class="keywordtype">bool</span> merge = <span class="keyword">false</span>;</div><div class="line"><a name="l00490"></a><span class="lineno"> 490</span> </div><div class="line"><a name="l00491"></a><span class="lineno"> 491</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> x_overlap_fraction = part_box.<a class="code" href="a02610.html#a4eadffcf205164157624bc934adcd144">x_overlap_fraction</a>(seed_box),</div><div class="line"><a name="l00492"></a><span class="lineno"> 492</span>  y_overlap_fraction = part_box.y_overlap_fraction(seed_box);</div><div class="line"><a name="l00493"></a><span class="lineno"> 493</span> </div><div class="line"><a name="l00494"></a><span class="lineno"> 494</span>  <span class="comment">// If part is large overlapped with seed, then set merge to true.</span></div><div class="line"><a name="l00495"></a><span class="lineno"> 495</span>  <span class="keywordflow">if</span> (x_overlap_fraction >= kLargeOverlapTh &&</div><div class="line"><a name="l00496"></a><span class="lineno"> 496</span>  y_overlap_fraction >= kLargeOverlapTh) {</div><div class="line"><a name="l00497"></a><span class="lineno"> 497</span>  merge = <span class="keyword">true</span>;</div><div class="line"><a name="l00498"></a><span class="lineno"> 498</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (seed-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a> &&</div><div class="line"><a name="l00499"></a><span class="lineno"> 499</span>  <a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>())) {</div><div class="line"><a name="l00500"></a><span class="lineno"> 500</span>  <span class="keywordflow">if</span> ((x_overlap_fraction > kEquXOverlap && y_overlap_fraction > 0.0) ||</div><div class="line"><a name="l00501"></a><span class="lineno"> 501</span>  (x_overlap_fraction > 0.0 && y_overlap_fraction > kEquYOverlap)) {</div><div class="line"><a name="l00502"></a><span class="lineno"> 502</span>  merge = <span class="keyword">true</span>;</div><div class="line"><a name="l00503"></a><span class="lineno"> 503</span>  }</div><div class="line"><a name="l00504"></a><span class="lineno"> 504</span>  }</div><div class="line"><a name="l00505"></a><span class="lineno"> 505</span> </div><div class="line"><a name="l00506"></a><span class="lineno"> 506</span>  <span class="keywordflow">if</span> (merge) { <span class="comment">// Remove the part from search and put it into parts.</span></div><div class="line"><a name="l00507"></a><span class="lineno"> 507</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.RemoveBBox();</div><div class="line"><a name="l00508"></a><span class="lineno"> 508</span>  parts_overlap-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l00509"></a><span class="lineno"> 509</span>  }</div><div class="line"><a name="l00510"></a><span class="lineno"> 510</span>  }</div><div class="line"><a name="l00511"></a><span class="lineno"> 511</span> }</div><div class="line"><a name="l00512"></a><span class="lineno"> 512</span> </div><div class="line"><a name="l00513"></a><span class="lineno"><a class="line" href="a02246.html#a5f75b1dad656abfdb1a10eddeb8e65de"> 513</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a5f75b1dad656abfdb1a10eddeb8e65de">EquationDetect::InsertPartAfterAbsorb</a>(<a class="code" href="a04570.html">ColPartition</a>* part) {</div><div class="line"><a name="l00514"></a><span class="lineno"> 514</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part);</div><div class="line"><a name="l00515"></a><span class="lineno"> 515</span> </div><div class="line"><a name="l00516"></a><span class="lineno"> 516</span>  <span class="comment">// Before insert part back into part_grid_, we will need re-compute some</span></div><div class="line"><a name="l00517"></a><span class="lineno"> 517</span>  <span class="comment">// of its attributes such as first_column_, last_column_. However, we still</span></div><div class="line"><a name="l00518"></a><span class="lineno"> 518</span>  <span class="comment">// want to preserve its type.</span></div><div class="line"><a name="l00519"></a><span class="lineno"> 519</span>  <a class="code" href="a00224.html#aa72f1499398e9694bf46752e1cc895e1">BlobTextFlowType</a> flow_type = part-><a class="code" href="a04570.html#a0f844b22a8ef8024a2c7eb9eed7523f3">flow</a>();</div><div class="line"><a name="l00520"></a><span class="lineno"> 520</span>  <a class="code" href="a00380.html#a03566528a98c079dafeebf00502f2b60">PolyBlockType</a> part_type = part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>();</div><div class="line"><a name="l00521"></a><span class="lineno"> 521</span>  <a class="code" href="a00224.html#aebfaf711760a99b60c297d1d619df575">BlobRegionType</a> blob_type = part-><a class="code" href="a04570.html#a5ce26bd79f510a828e566d37a3abd8de">blob_type</a>();</div><div class="line"><a name="l00522"></a><span class="lineno"> 522</span> </div><div class="line"><a name="l00523"></a><span class="lineno"> 523</span>  <span class="comment">// Call SetPartitionType to re-compute the attributes of part.</span></div><div class="line"><a name="l00524"></a><span class="lineno"> 524</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l00525"></a><span class="lineno"> 525</span>  <span class="keywordtype">int</span> grid_x, grid_y;</div><div class="line"><a name="l00526"></a><span class="lineno"> 526</span>  <a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>-><a class="code" href="a04506.html#ade0cdea2e618882c670c7077257a7609">GridCoords</a>(</div><div class="line"><a name="l00527"></a><span class="lineno"> 527</span>  part_box.left(), part_box.bottom(), &grid_x, &grid_y);</div><div class="line"><a name="l00528"></a><span class="lineno"> 528</span>  part-><a class="code" href="a04570.html#acf8233abc2eb9a0b9cc6f258ddd1d04d">SetPartitionType</a>(<a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>, <a class="code" href="a02246.html#a56fe80b060d60fd1d833b3054f44abdf">best_columns_</a>[grid_y]);</div><div class="line"><a name="l00529"></a><span class="lineno"> 529</span> </div><div class="line"><a name="l00530"></a><span class="lineno"> 530</span>  <span class="comment">// Reset the types back.</span></div><div class="line"><a name="l00531"></a><span class="lineno"> 531</span>  part-><a class="code" href="a04570.html#a9fcf07be83840289187d6358ee752a46">set_type</a>(part_type);</div><div class="line"><a name="l00532"></a><span class="lineno"> 532</span>  part-><a class="code" href="a04570.html#a67554d4553f198980b504091557442c7">set_blob_type</a>(blob_type);</div><div class="line"><a name="l00533"></a><span class="lineno"> 533</span>  part-><a class="code" href="a04570.html#aff449be10b9bb6e480b65cd1042e38e4">set_flow</a>(flow_type);</div><div class="line"><a name="l00534"></a><span class="lineno"> 534</span>  part-><a class="code" href="a04570.html#abfa13ecb273fa29166a663daf82a2254">SetBlobTypes</a>();</div><div class="line"><a name="l00535"></a><span class="lineno"> 535</span> </div><div class="line"><a name="l00536"></a><span class="lineno"> 536</span>  <span class="comment">// Insert into part_grid_.</span></div><div class="line"><a name="l00537"></a><span class="lineno"> 537</span>  <a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>-><a class="code" href="a04514.html#a7b379525e3d60c68e583352ae4b8a750">InsertBBox</a>(<span class="keyword">true</span>, <span class="keyword">true</span>, part);</div><div class="line"><a name="l00538"></a><span class="lineno"> 538</span> }</div><div class="line"><a name="l00539"></a><span class="lineno"> 539</span> </div><div class="line"><a name="l00540"></a><span class="lineno"><a class="line" href="a02246.html#a39c1397a958168add27d1a4bbc3ff916"> 540</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a39c1397a958168add27d1a4bbc3ff916">EquationDetect::IdentifySeedParts</a>() {</div><div class="line"><a name="l00541"></a><span class="lineno"> 541</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> gsearch(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l00542"></a><span class="lineno"> 542</span>  <a class="code" href="a04570.html">ColPartition</a> *part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00543"></a><span class="lineno"> 543</span>  gsearch.<a class="code" href="a04502.html#ad7f7e99bcda5e0daeb682b772e445f60">StartFullSearch</a>();</div><div class="line"><a name="l00544"></a><span class="lineno"> 544</span> </div><div class="line"><a name="l00545"></a><span class="lineno"> 545</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> seeds1, seeds2;</div><div class="line"><a name="l00546"></a><span class="lineno"> 546</span>  <span class="comment">// The left coordinates of indented text partitions.</span></div><div class="line"><a name="l00547"></a><span class="lineno"> 547</span>  <a class="code" href="a02182.html">GenericVector<int></a> indented_texts_left;</div><div class="line"><a name="l00548"></a><span class="lineno"> 548</span>  <span class="comment">// The foreground density of text partitions.</span></div><div class="line"><a name="l00549"></a><span class="lineno"> 549</span>  <a class="code" href="a02182.html">GenericVector<float></a> texts_foreground_density;</div><div class="line"><a name="l00550"></a><span class="lineno"> 550</span>  <span class="keywordflow">while</span> ((part = gsearch.<a class="code" href="a04502.html#ae9cd15b1815e744caf0650320aecfc2c">NextFullSearch</a>()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00551"></a><span class="lineno"> 551</span>  <span class="keywordflow">if</span> (!<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>())) {</div><div class="line"><a name="l00552"></a><span class="lineno"> 552</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00553"></a><span class="lineno"> 553</span>  }</div><div class="line"><a name="l00554"></a><span class="lineno"> 554</span>  part-><a class="code" href="a04570.html#aa348155cfa970382ea67c69ac2a95376">ComputeSpecialBlobsDensity</a>();</div><div class="line"><a name="l00555"></a><span class="lineno"> 555</span>  <span class="keyword">const</span> <span class="keywordtype">bool</span> blobs_check = <a class="code" href="a02246.html#a14f4d2d35ed292b40ce57b028d7e124a">CheckSeedBlobsCount</a>(part);</div><div class="line"><a name="l00556"></a><span class="lineno"> 556</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kTextBlobsTh = 20;</div><div class="line"><a name="l00557"></a><span class="lineno"> 557</span> </div><div class="line"><a name="l00558"></a><span class="lineno"> 558</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#a056b756d6ebd931501b3488b2b526336">CheckSeedDensity</a>(<a class="code" href="a01629.html#ad996502770c51cc260e4d66db9543bcc">kMathDigitDensityTh1</a>, <a class="code" href="a01629.html#a2a82022958d051af0fb624095c3ada00">kMathDigitDensityTh2</a>, part) &&</div><div class="line"><a name="l00559"></a><span class="lineno"> 559</span>  blobs_check) {</div><div class="line"><a name="l00560"></a><span class="lineno"> 560</span>  <span class="comment">// Passed high density threshold test, save into seeds1.</span></div><div class="line"><a name="l00561"></a><span class="lineno"> 561</span>  seeds1.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l00562"></a><span class="lineno"> 562</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00563"></a><span class="lineno"> 563</span>  <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223">IndentType</a> indent = <a class="code" href="a02246.html#a35912b69ed5ffa28d88ed53ba9f060d3">IsIndented</a>(part);</div><div class="line"><a name="l00564"></a><span class="lineno"> 564</span>  <span class="keywordflow">if</span> (<a class="code" href="a01629.html#afe260b66ccf11a3f3346ba282f315c49">IsLeftIndented</a>(indent) && blobs_check &&</div><div class="line"><a name="l00565"></a><span class="lineno"> 565</span>  <a class="code" href="a02246.html#a056b756d6ebd931501b3488b2b526336">CheckSeedDensity</a>(<a class="code" href="a01629.html#a2a82022958d051af0fb624095c3ada00">kMathDigitDensityTh2</a>, <a class="code" href="a01629.html#a2a82022958d051af0fb624095c3ada00">kMathDigitDensityTh2</a>, part)) {</div><div class="line"><a name="l00566"></a><span class="lineno"> 566</span>  <span class="comment">// Passed low density threshold test and is indented, save into seeds2.</span></div><div class="line"><a name="l00567"></a><span class="lineno"> 567</span>  seeds2.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l00568"></a><span class="lineno"> 568</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a class="code" href="a01629.html#a8a161b61eb46383ddad93473fb3d8749">IsRightIndented</a>(indent) &&</div><div class="line"><a name="l00569"></a><span class="lineno"> 569</span>  part-><a class="code" href="a04570.html#a2ad3b1e781a208614d52e263a28c1e00">boxes_count</a>() > kTextBlobsTh) {</div><div class="line"><a name="l00570"></a><span class="lineno"> 570</span>  <span class="comment">// This is likely to be a text part, save the features.</span></div><div class="line"><a name="l00571"></a><span class="lineno"> 571</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>&box = part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>();</div><div class="line"><a name="l00572"></a><span class="lineno"> 572</span>  <span class="keywordflow">if</span> (<a class="code" href="a01629.html#afe260b66ccf11a3f3346ba282f315c49">IsLeftIndented</a>(indent)) {</div><div class="line"><a name="l00573"></a><span class="lineno"> 573</span>  indented_texts_left.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>());</div><div class="line"><a name="l00574"></a><span class="lineno"> 574</span>  }</div><div class="line"><a name="l00575"></a><span class="lineno"> 575</span>  texts_foreground_density.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(<a class="code" href="a02246.html#a4aa9c0126e15827ea9c66319558d2fb9">ComputeForegroundDensity</a>(box));</div><div class="line"><a name="l00576"></a><span class="lineno"> 576</span>  }</div><div class="line"><a name="l00577"></a><span class="lineno"> 577</span>  }</div><div class="line"><a name="l00578"></a><span class="lineno"> 578</span>  }</div><div class="line"><a name="l00579"></a><span class="lineno"> 579</span> </div><div class="line"><a name="l00580"></a><span class="lineno"> 580</span>  <span class="comment">// Sort the features collected from text regions.</span></div><div class="line"><a name="l00581"></a><span class="lineno"> 581</span>  indented_texts_left.<a class="code" href="a02182.html#a999bbd8ff336c81fe1198ea714c7936d">sort</a>();</div><div class="line"><a name="l00582"></a><span class="lineno"> 582</span>  texts_foreground_density.<a class="code" href="a02182.html#a999bbd8ff336c81fe1198ea714c7936d">sort</a>();</div><div class="line"><a name="l00583"></a><span class="lineno"> 583</span>  <span class="keywordtype">float</span> foreground_density_th = 0.15; <span class="comment">// Default value.</span></div><div class="line"><a name="l00584"></a><span class="lineno"> 584</span>  <span class="keywordflow">if</span> (!texts_foreground_density.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>()) {</div><div class="line"><a name="l00585"></a><span class="lineno"> 585</span>  <span class="comment">// Use the median of the texts_foreground_density.</span></div><div class="line"><a name="l00586"></a><span class="lineno"> 586</span>  foreground_density_th = 0.8 * texts_foreground_density[</div><div class="line"><a name="l00587"></a><span class="lineno"> 587</span>  texts_foreground_density.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() / 2];</div><div class="line"><a name="l00588"></a><span class="lineno"> 588</span>  }</div><div class="line"><a name="l00589"></a><span class="lineno"> 589</span> </div><div class="line"><a name="l00590"></a><span class="lineno"> 590</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < seeds1.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l00591"></a><span class="lineno"> 591</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& box = seeds1[i]->bounding_box();</div><div class="line"><a name="l00592"></a><span class="lineno"> 592</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#aac03fc4552265dd3e79fae673fa63b88">CheckSeedFgDensity</a>(foreground_density_th, seeds1[i]) &&</div><div class="line"><a name="l00593"></a><span class="lineno"> 593</span>  !(<a class="code" href="a01629.html#afe260b66ccf11a3f3346ba282f315c49">IsLeftIndented</a>(<a class="code" href="a02246.html#a35912b69ed5ffa28d88ed53ba9f060d3">IsIndented</a>(seeds1[i])) &&</div><div class="line"><a name="l00594"></a><span class="lineno"> 594</span>  <a class="code" href="a02246.html#a8348581de747f0ddedd47c852b36a4ae">CountAlignment</a>(indented_texts_left, box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>()) >=</div><div class="line"><a name="l00595"></a><span class="lineno"> 595</span>  <a class="code" href="a01629.html#a1a5ac6fad51e61e88df309fb704d8ebc">kLeftIndentAlignmentCountTh</a>)) {</div><div class="line"><a name="l00596"></a><span class="lineno"> 596</span>  <span class="comment">// Mark as PT_EQUATION type.</span></div><div class="line"><a name="l00597"></a><span class="lineno"> 597</span>  seeds1[i]->set_type(<a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>);</div><div class="line"><a name="l00598"></a><span class="lineno"> 598</span>  <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.push_back(seeds1[i]);</div><div class="line"><a name="l00599"></a><span class="lineno"> 599</span>  } <span class="keywordflow">else</span> { <span class="comment">// Mark as PT_INLINE_EQUATION type.</span></div><div class="line"><a name="l00600"></a><span class="lineno"> 600</span>  seeds1[i]->set_type(<a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faa52ce81f771512916e01215965910fc6">PT_INLINE_EQUATION</a>);</div><div class="line"><a name="l00601"></a><span class="lineno"> 601</span>  }</div><div class="line"><a name="l00602"></a><span class="lineno"> 602</span>  }</div><div class="line"><a name="l00603"></a><span class="lineno"> 603</span> </div><div class="line"><a name="l00604"></a><span class="lineno"> 604</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < seeds2.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l00605"></a><span class="lineno"> 605</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#a2a1d7cd57ac4ed59a38ffd3b476dd2bf">CheckForSeed2</a>(indented_texts_left, foreground_density_th, seeds2[i])) {</div><div class="line"><a name="l00606"></a><span class="lineno"> 606</span>  seeds2[i]->set_type(<a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>);</div><div class="line"><a name="l00607"></a><span class="lineno"> 607</span>  <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.push_back(seeds2[i]);</div><div class="line"><a name="l00608"></a><span class="lineno"> 608</span>  }</div><div class="line"><a name="l00609"></a><span class="lineno"> 609</span>  }</div><div class="line"><a name="l00610"></a><span class="lineno"> 610</span> }</div><div class="line"><a name="l00611"></a><span class="lineno"> 611</span> </div><div class="line"><a name="l00612"></a><span class="lineno"><a class="line" href="a02246.html#a4aa9c0126e15827ea9c66319558d2fb9"> 612</a></span> <span class="keywordtype">float</span> <a class="code" href="a02246.html#a4aa9c0126e15827ea9c66319558d2fb9">EquationDetect::ComputeForegroundDensity</a>(<span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& tbox) {</div><div class="line"><a name="l00613"></a><span class="lineno"> 613</span>  Pix *pix_bi = <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02358.html#ae6daf71366bf37ae460f95c5d9cad11b">pix_binary</a>();</div><div class="line"><a name="l00614"></a><span class="lineno"> 614</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> pix_height = pixGetHeight(pix_bi);</div><div class="line"><a name="l00615"></a><span class="lineno"> 615</span>  Box* box = boxCreate(tbox.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>(), pix_height - tbox.<a class="code" href="a02610.html#a5dc64d0677b5d65385bc07a78cf49c4d">top</a>(),</div><div class="line"><a name="l00616"></a><span class="lineno"> 616</span>  tbox.<a class="code" href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">width</a>(), tbox.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>());</div><div class="line"><a name="l00617"></a><span class="lineno"> 617</span>  Pix *pix_sub = pixClipRectangle(pix_bi, box, <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00618"></a><span class="lineno"> 618</span>  l_float32 fract;</div><div class="line"><a name="l00619"></a><span class="lineno"> 619</span>  pixForegroundFraction(pix_sub, &fract);</div><div class="line"><a name="l00620"></a><span class="lineno"> 620</span>  pixDestroy(&pix_sub);</div><div class="line"><a name="l00621"></a><span class="lineno"> 621</span>  boxDestroy(&box);</div><div class="line"><a name="l00622"></a><span class="lineno"> 622</span> </div><div class="line"><a name="l00623"></a><span class="lineno"> 623</span>  <span class="keywordflow">return</span> fract;</div><div class="line"><a name="l00624"></a><span class="lineno"> 624</span> }</div><div class="line"><a name="l00625"></a><span class="lineno"> 625</span> </div><div class="line"><a name="l00626"></a><span class="lineno"><a class="line" href="a02246.html#aac03fc4552265dd3e79fae673fa63b88"> 626</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#aac03fc4552265dd3e79fae673fa63b88">EquationDetect::CheckSeedFgDensity</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> density_th,</div><div class="line"><a name="l00627"></a><span class="lineno"> 627</span>  <a class="code" href="a04570.html">ColPartition</a>* part) {</div><div class="line"><a name="l00628"></a><span class="lineno"> 628</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part);</div><div class="line"><a name="l00629"></a><span class="lineno"> 629</span> </div><div class="line"><a name="l00630"></a><span class="lineno"> 630</span>  <span class="comment">// Split part horizontall, and check for each sub part.</span></div><div class="line"><a name="l00631"></a><span class="lineno"> 631</span>  <a class="code" href="a02182.html">GenericVector<TBOX></a> sub_boxes;</div><div class="line"><a name="l00632"></a><span class="lineno"> 632</span>  <a class="code" href="a02246.html#a1ec8cc3dc57f53854d2190f112c00c85">SplitCPHorLite</a>(part, &sub_boxes);</div><div class="line"><a name="l00633"></a><span class="lineno"> 633</span>  <span class="keywordtype">float</span> parts_passed = 0.0;</div><div class="line"><a name="l00634"></a><span class="lineno"> 634</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < sub_boxes.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l00635"></a><span class="lineno"> 635</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> density = <a class="code" href="a02246.html#a4aa9c0126e15827ea9c66319558d2fb9">ComputeForegroundDensity</a>(sub_boxes[i]);</div><div class="line"><a name="l00636"></a><span class="lineno"> 636</span>  <span class="keywordflow">if</span> (density < density_th) {</div><div class="line"><a name="l00637"></a><span class="lineno"> 637</span>  parts_passed++;</div><div class="line"><a name="l00638"></a><span class="lineno"> 638</span>  }</div><div class="line"><a name="l00639"></a><span class="lineno"> 639</span>  }</div><div class="line"><a name="l00640"></a><span class="lineno"> 640</span> </div><div class="line"><a name="l00641"></a><span class="lineno"> 641</span>  <span class="comment">// If most sub parts passed, then we return true.</span></div><div class="line"><a name="l00642"></a><span class="lineno"> 642</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> kSeedPartRatioTh = 0.3;</div><div class="line"><a name="l00643"></a><span class="lineno"> 643</span>  <span class="keywordtype">bool</span> retval = (parts_passed / sub_boxes.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() >= kSeedPartRatioTh);</div><div class="line"><a name="l00644"></a><span class="lineno"> 644</span> </div><div class="line"><a name="l00645"></a><span class="lineno"> 645</span>  <span class="keywordflow">return</span> retval;</div><div class="line"><a name="l00646"></a><span class="lineno"> 646</span> }</div><div class="line"><a name="l00647"></a><span class="lineno"> 647</span> </div><div class="line"><a name="l00648"></a><span class="lineno"><a class="line" href="a02246.html#ad9ff76cd1e7f4e25c37da5b9eb04b94c"> 648</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ad9ff76cd1e7f4e25c37da5b9eb04b94c">EquationDetect::SplitCPHor</a>(<a class="code" href="a04570.html">ColPartition</a>* part,</div><div class="line"><a name="l00649"></a><span class="lineno"> 649</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a>* parts_splitted) {</div><div class="line"><a name="l00650"></a><span class="lineno"> 650</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part && parts_splitted);</div><div class="line"><a name="l00651"></a><span class="lineno"> 651</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#afe2aa83dbca82f86d2499c2adf6f394c">median_width</a>() == 0 || part-><a class="code" href="a04570.html#a2ad3b1e781a208614d52e263a28c1e00">boxes_count</a>() == 0) {</div><div class="line"><a name="l00652"></a><span class="lineno"> 652</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l00653"></a><span class="lineno"> 653</span>  }</div><div class="line"><a name="l00654"></a><span class="lineno"> 654</span> </div><div class="line"><a name="l00655"></a><span class="lineno"> 655</span>  <span class="comment">// Make a copy of part, and reset parts_splitted.</span></div><div class="line"><a name="l00656"></a><span class="lineno"> 656</span>  <a class="code" href="a04570.html">ColPartition</a>* right_part = part-><a class="code" href="a04570.html#a3077eb7392f7d2ab1de2f93579fda55d">CopyButDontOwnBlobs</a>();</div><div class="line"><a name="l00657"></a><span class="lineno"> 657</span>  parts_splitted-><a class="code" href="a02182.html#a98f62dccd75224a60437c2761bd215cd">delete_data_pointers</a>();</div><div class="line"><a name="l00658"></a><span class="lineno"> 658</span>  parts_splitted-><a class="code" href="a02182.html#a9cdbff49b186574b83e43afba606fdd9">clear</a>();</div><div class="line"><a name="l00659"></a><span class="lineno"> 659</span> </div><div class="line"><a name="l00660"></a><span class="lineno"> 660</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> kThreshold = part-><a class="code" href="a04570.html#afe2aa83dbca82f86d2499c2adf6f394c">median_width</a>() * 3.0;</div><div class="line"><a name="l00661"></a><span class="lineno"> 661</span>  <span class="keywordtype">bool</span> found_split = <span class="keyword">true</span>;</div><div class="line"><a name="l00662"></a><span class="lineno"> 662</span>  <span class="keywordflow">while</span> (found_split) {</div><div class="line"><a name="l00663"></a><span class="lineno"> 663</span>  found_split = <span class="keyword">false</span>;</div><div class="line"><a name="l00664"></a><span class="lineno"> 664</span>  BLOBNBOX_C_IT box_it(right_part-><a class="code" href="a04570.html#a3fc2dd797ede7a62546b2565811e9ce0">boxes</a>());</div><div class="line"><a name="l00665"></a><span class="lineno"> 665</span>  <span class="comment">// Blobs are sorted left side first. If blobs overlap,</span></div><div class="line"><a name="l00666"></a><span class="lineno"> 666</span>  <span class="comment">// the previous blob may have a "more right" right side.</span></div><div class="line"><a name="l00667"></a><span class="lineno"> 667</span>  <span class="comment">// Account for this by always keeping the largest "right"</span></div><div class="line"><a name="l00668"></a><span class="lineno"> 668</span>  <span class="comment">// so far.</span></div><div class="line"><a name="l00669"></a><span class="lineno"> 669</span>  <span class="keywordtype">int</span> previous_right = INT32_MIN;</div><div class="line"><a name="l00670"></a><span class="lineno"> 670</span> </div><div class="line"><a name="l00671"></a><span class="lineno"> 671</span>  <span class="comment">// Look for the next split in the partition.</span></div><div class="line"><a name="l00672"></a><span class="lineno"> 672</span>  <span class="keywordflow">for</span> (box_it.mark_cycle_pt(); !box_it.cycled_list(); box_it.forward()) {</div><div class="line"><a name="l00673"></a><span class="lineno"> 673</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& box = box_it.data()->bounding_box();</div><div class="line"><a name="l00674"></a><span class="lineno"> 674</span>  <span class="keywordflow">if</span> (previous_right != INT32_MIN &&</div><div class="line"><a name="l00675"></a><span class="lineno"> 675</span>  box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>() - previous_right > kThreshold) {</div><div class="line"><a name="l00676"></a><span class="lineno"> 676</span>  <span class="comment">// We have a split position. Split the partition in two pieces.</span></div><div class="line"><a name="l00677"></a><span class="lineno"> 677</span>  <span class="comment">// Insert the left piece in the grid and keep processing the right.</span></div><div class="line"><a name="l00678"></a><span class="lineno"> 678</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> mid_x = (box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>() + previous_right) / 2;</div><div class="line"><a name="l00679"></a><span class="lineno"> 679</span>  <a class="code" href="a04570.html">ColPartition</a>* left_part = right_part;</div><div class="line"><a name="l00680"></a><span class="lineno"> 680</span>  right_part = left_part-><a class="code" href="a04570.html#a33427fb9a563253c69e0806115fb2a4b">SplitAt</a>(mid_x);</div><div class="line"><a name="l00681"></a><span class="lineno"> 681</span> </div><div class="line"><a name="l00682"></a><span class="lineno"> 682</span>  parts_splitted-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(left_part);</div><div class="line"><a name="l00683"></a><span class="lineno"> 683</span>  left_part-><a class="code" href="a04570.html#aa348155cfa970382ea67c69ac2a95376">ComputeSpecialBlobsDensity</a>();</div><div class="line"><a name="l00684"></a><span class="lineno"> 684</span>  found_split = <span class="keyword">true</span>;</div><div class="line"><a name="l00685"></a><span class="lineno"> 685</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00686"></a><span class="lineno"> 686</span>  }</div><div class="line"><a name="l00687"></a><span class="lineno"> 687</span> </div><div class="line"><a name="l00688"></a><span class="lineno"> 688</span>  <span class="comment">// The right side of the previous blobs.</span></div><div class="line"><a name="l00689"></a><span class="lineno"> 689</span>  previous_right = std::max(previous_right, static_cast<int>(box.<a class="code" href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">right</a>()));</div><div class="line"><a name="l00690"></a><span class="lineno"> 690</span>  }</div><div class="line"><a name="l00691"></a><span class="lineno"> 691</span>  }</div><div class="line"><a name="l00692"></a><span class="lineno"> 692</span> </div><div class="line"><a name="l00693"></a><span class="lineno"> 693</span>  <span class="comment">// Add the last piece.</span></div><div class="line"><a name="l00694"></a><span class="lineno"> 694</span>  right_part-><a class="code" href="a04570.html#aa348155cfa970382ea67c69ac2a95376">ComputeSpecialBlobsDensity</a>();</div><div class="line"><a name="l00695"></a><span class="lineno"> 695</span>  parts_splitted-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(right_part);</div><div class="line"><a name="l00696"></a><span class="lineno"> 696</span> }</div><div class="line"><a name="l00697"></a><span class="lineno"> 697</span> </div><div class="line"><a name="l00698"></a><span class="lineno"><a class="line" href="a02246.html#a1ec8cc3dc57f53854d2190f112c00c85"> 698</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a1ec8cc3dc57f53854d2190f112c00c85">EquationDetect::SplitCPHorLite</a>(<a class="code" href="a04570.html">ColPartition</a>* part,</div><div class="line"><a name="l00699"></a><span class="lineno"> 699</span>  <a class="code" href="a02182.html">GenericVector<TBOX></a>* splitted_boxes) {</div><div class="line"><a name="l00700"></a><span class="lineno"> 700</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part && splitted_boxes);</div><div class="line"><a name="l00701"></a><span class="lineno"> 701</span>  splitted_boxes-><a class="code" href="a02182.html#a9cdbff49b186574b83e43afba606fdd9">clear</a>();</div><div class="line"><a name="l00702"></a><span class="lineno"> 702</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#afe2aa83dbca82f86d2499c2adf6f394c">median_width</a>() == 0) {</div><div class="line"><a name="l00703"></a><span class="lineno"> 703</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l00704"></a><span class="lineno"> 704</span>  }</div><div class="line"><a name="l00705"></a><span class="lineno"> 705</span> </div><div class="line"><a name="l00706"></a><span class="lineno"> 706</span>  <span class="keyword">const</span> <span class="keywordtype">double</span> kThreshold = part-><a class="code" href="a04570.html#afe2aa83dbca82f86d2499c2adf6f394c">median_width</a>() * 3.0;</div><div class="line"><a name="l00707"></a><span class="lineno"> 707</span> </div><div class="line"><a name="l00708"></a><span class="lineno"> 708</span>  <span class="comment">// Blobs are sorted left side first. If blobs overlap,</span></div><div class="line"><a name="l00709"></a><span class="lineno"> 709</span>  <span class="comment">// the previous blob may have a "more right" right side.</span></div><div class="line"><a name="l00710"></a><span class="lineno"> 710</span>  <span class="comment">// Account for this by always keeping the largest "right"</span></div><div class="line"><a name="l00711"></a><span class="lineno"> 711</span>  <span class="comment">// so far.</span></div><div class="line"><a name="l00712"></a><span class="lineno"> 712</span>  <a class="code" href="a02610.html">TBOX</a> union_box;</div><div class="line"><a name="l00713"></a><span class="lineno"> 713</span>  <span class="keywordtype">int</span> previous_right = INT32_MIN;</div><div class="line"><a name="l00714"></a><span class="lineno"> 714</span>  BLOBNBOX_C_IT box_it(part-><a class="code" href="a04570.html#a3fc2dd797ede7a62546b2565811e9ce0">boxes</a>());</div><div class="line"><a name="l00715"></a><span class="lineno"> 715</span>  <span class="keywordflow">for</span> (box_it.mark_cycle_pt(); !box_it.cycled_list(); box_it.forward()) {</div><div class="line"><a name="l00716"></a><span class="lineno"> 716</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& box = box_it.data()->bounding_box();</div><div class="line"><a name="l00717"></a><span class="lineno"> 717</span>  <span class="keywordflow">if</span> (previous_right != INT32_MIN &&</div><div class="line"><a name="l00718"></a><span class="lineno"> 718</span>  box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>() - previous_right > kThreshold) {</div><div class="line"><a name="l00719"></a><span class="lineno"> 719</span>  <span class="comment">// We have a split position.</span></div><div class="line"><a name="l00720"></a><span class="lineno"> 720</span>  splitted_boxes-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(union_box);</div><div class="line"><a name="l00721"></a><span class="lineno"> 721</span>  previous_right = INT32_MIN;</div><div class="line"><a name="l00722"></a><span class="lineno"> 722</span>  }</div><div class="line"><a name="l00723"></a><span class="lineno"> 723</span>  <span class="keywordflow">if</span> (previous_right == INT32_MIN) {</div><div class="line"><a name="l00724"></a><span class="lineno"> 724</span>  union_box = box;</div><div class="line"><a name="l00725"></a><span class="lineno"> 725</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00726"></a><span class="lineno"> 726</span>  union_box += box;</div><div class="line"><a name="l00727"></a><span class="lineno"> 727</span>  }</div><div class="line"><a name="l00728"></a><span class="lineno"> 728</span>  <span class="comment">// The right side of the previous blobs.</span></div><div class="line"><a name="l00729"></a><span class="lineno"> 729</span>  previous_right = std::max(previous_right, static_cast<int>(box.<a class="code" href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">right</a>()));</div><div class="line"><a name="l00730"></a><span class="lineno"> 730</span>  }</div><div class="line"><a name="l00731"></a><span class="lineno"> 731</span> </div><div class="line"><a name="l00732"></a><span class="lineno"> 732</span>  <span class="comment">// Add the last piece.</span></div><div class="line"><a name="l00733"></a><span class="lineno"> 733</span>  <span class="keywordflow">if</span> (previous_right != INT32_MIN) {</div><div class="line"><a name="l00734"></a><span class="lineno"> 734</span>  splitted_boxes-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(union_box);</div><div class="line"><a name="l00735"></a><span class="lineno"> 735</span>  }</div><div class="line"><a name="l00736"></a><span class="lineno"> 736</span> }</div><div class="line"><a name="l00737"></a><span class="lineno"> 737</span> </div><div class="line"><a name="l00738"></a><span class="lineno"><a class="line" href="a02246.html#a2a1d7cd57ac4ed59a38ffd3b476dd2bf"> 738</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#a2a1d7cd57ac4ed59a38ffd3b476dd2bf">EquationDetect::CheckForSeed2</a>(</div><div class="line"><a name="l00739"></a><span class="lineno"> 739</span>  <span class="keyword">const</span> <a class="code" href="a02182.html">GenericVector<int></a>& indented_texts_left,</div><div class="line"><a name="l00740"></a><span class="lineno"> 740</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> foreground_density_th,</div><div class="line"><a name="l00741"></a><span class="lineno"> 741</span>  <a class="code" href="a04570.html">ColPartition</a>* part) {</div><div class="line"><a name="l00742"></a><span class="lineno"> 742</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part);</div><div class="line"><a name="l00743"></a><span class="lineno"> 743</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& box = part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>();</div><div class="line"><a name="l00744"></a><span class="lineno"> 744</span> </div><div class="line"><a name="l00745"></a><span class="lineno"> 745</span>  <span class="comment">// Check if it is aligned with any indented_texts_left.</span></div><div class="line"><a name="l00746"></a><span class="lineno"> 746</span>  <span class="keywordflow">if</span> (!indented_texts_left.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>() &&</div><div class="line"><a name="l00747"></a><span class="lineno"> 747</span>  <a class="code" href="a02246.html#a8348581de747f0ddedd47c852b36a4ae">CountAlignment</a>(indented_texts_left, box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>()) >=</div><div class="line"><a name="l00748"></a><span class="lineno"> 748</span>  <a class="code" href="a01629.html#a1a5ac6fad51e61e88df309fb704d8ebc">kLeftIndentAlignmentCountTh</a>) {</div><div class="line"><a name="l00749"></a><span class="lineno"> 749</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00750"></a><span class="lineno"> 750</span>  }</div><div class="line"><a name="l00751"></a><span class="lineno"> 751</span> </div><div class="line"><a name="l00752"></a><span class="lineno"> 752</span>  <span class="comment">// Check the foreground density.</span></div><div class="line"><a name="l00753"></a><span class="lineno"> 753</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#a4aa9c0126e15827ea9c66319558d2fb9">ComputeForegroundDensity</a>(box) > foreground_density_th) {</div><div class="line"><a name="l00754"></a><span class="lineno"> 754</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00755"></a><span class="lineno"> 755</span>  }</div><div class="line"><a name="l00756"></a><span class="lineno"> 756</span> </div><div class="line"><a name="l00757"></a><span class="lineno"> 757</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00758"></a><span class="lineno"> 758</span> }</div><div class="line"><a name="l00759"></a><span class="lineno"> 759</span> </div><div class="line"><a name="l00760"></a><span class="lineno"><a class="line" href="a02246.html#a8348581de747f0ddedd47c852b36a4ae"> 760</a></span> <span class="keywordtype">int</span> <a class="code" href="a02246.html#a8348581de747f0ddedd47c852b36a4ae">EquationDetect::CountAlignment</a>(</div><div class="line"><a name="l00761"></a><span class="lineno"> 761</span>  <span class="keyword">const</span> <a class="code" href="a02182.html">GenericVector<int></a>& sorted_vec, <span class="keyword">const</span> <span class="keywordtype">int</span> val)<span class="keyword"> const </span>{</div><div class="line"><a name="l00762"></a><span class="lineno"> 762</span>  <span class="keywordflow">if</span> (sorted_vec.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>()) {</div><div class="line"><a name="l00763"></a><span class="lineno"> 763</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00764"></a><span class="lineno"> 764</span>  }</div><div class="line"><a name="l00765"></a><span class="lineno"> 765</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kDistTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(0.03 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>));</div><div class="line"><a name="l00766"></a><span class="lineno"> 766</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> pos = sorted_vec.<a class="code" href="a02182.html#ad561e19e75a0fb30f0118774d7fa5621">binary_search</a>(val);</div><div class="line"><a name="l00767"></a><span class="lineno"> 767</span>  <span class="keywordtype">int</span> <a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a> = 0;</div><div class="line"><a name="l00768"></a><span class="lineno"> 768</span> </div><div class="line"><a name="l00769"></a><span class="lineno"> 769</span>  <span class="comment">// Search left side.</span></div><div class="line"><a name="l00770"></a><span class="lineno"> 770</span>  <span class="keywordtype">int</span> index = pos;</div><div class="line"><a name="l00771"></a><span class="lineno"> 771</span>  <span class="keywordflow">while</span> (index >= 0 && abs(val - sorted_vec[index--]) < kDistTh) {</div><div class="line"><a name="l00772"></a><span class="lineno"> 772</span>  <a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a>++;</div><div class="line"><a name="l00773"></a><span class="lineno"> 773</span>  }</div><div class="line"><a name="l00774"></a><span class="lineno"> 774</span> </div><div class="line"><a name="l00775"></a><span class="lineno"> 775</span>  <span class="comment">// Search right side.</span></div><div class="line"><a name="l00776"></a><span class="lineno"> 776</span>  index = pos + 1;</div><div class="line"><a name="l00777"></a><span class="lineno"> 777</span>  <span class="keywordflow">while</span> (index < sorted_vec.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() && sorted_vec[index++] - val < kDistTh) {</div><div class="line"><a name="l00778"></a><span class="lineno"> 778</span>  <a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a>++;</div><div class="line"><a name="l00779"></a><span class="lineno"> 779</span>  }</div><div class="line"><a name="l00780"></a><span class="lineno"> 780</span> </div><div class="line"><a name="l00781"></a><span class="lineno"> 781</span>  <span class="keywordflow">return</span> <a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a>;</div><div class="line"><a name="l00782"></a><span class="lineno"> 782</span> }</div><div class="line"><a name="l00783"></a><span class="lineno"> 783</span> </div><div class="line"><a name="l00784"></a><span class="lineno"><a class="line" href="a02246.html#a89b2d841680f6f6207fc4f10b8d7839f"> 784</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a89b2d841680f6f6207fc4f10b8d7839f">EquationDetect::IdentifyInlineParts</a>() {</div><div class="line"><a name="l00785"></a><span class="lineno"> 785</span>  <a class="code" href="a02246.html#a8de69a1f250877609333539286e6914a">ComputeCPsSuperBBox</a>();</div><div class="line"><a name="l00786"></a><span class="lineno"> 786</span>  <a class="code" href="a02246.html#ae246fb4897d7e5181ff727874a9eb140">IdentifyInlinePartsHorizontal</a>();</div><div class="line"><a name="l00787"></a><span class="lineno"> 787</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> textparts_linespacing = <a class="code" href="a02246.html#a096b2bb7f8f59484ec2043d92c3f1eec">EstimateTextPartLineSpacing</a>();</div><div class="line"><a name="l00788"></a><span class="lineno"> 788</span>  <a class="code" href="a02246.html#a657f367e87724bfab6359c42f10fad66">IdentifyInlinePartsVertical</a>(<span class="keyword">true</span>, textparts_linespacing);</div><div class="line"><a name="l00789"></a><span class="lineno"> 789</span>  <a class="code" href="a02246.html#a657f367e87724bfab6359c42f10fad66">IdentifyInlinePartsVertical</a>(<span class="keyword">false</span>, textparts_linespacing);</div><div class="line"><a name="l00790"></a><span class="lineno"> 790</span> }</div><div class="line"><a name="l00791"></a><span class="lineno"> 791</span> </div><div class="line"><a name="l00792"></a><span class="lineno"><a class="line" href="a02246.html#a8de69a1f250877609333539286e6914a"> 792</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a8de69a1f250877609333539286e6914a">EquationDetect::ComputeCPsSuperBBox</a>() {</div><div class="line"><a name="l00793"></a><span class="lineno"> 793</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> gsearch(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l00794"></a><span class="lineno"> 794</span>  <a class="code" href="a04570.html">ColPartition</a> *part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00795"></a><span class="lineno"> 795</span>  gsearch.<a class="code" href="a04502.html#ad7f7e99bcda5e0daeb682b772e445f60">StartFullSearch</a>();</div><div class="line"><a name="l00796"></a><span class="lineno"> 796</span>  <span class="keyword">delete</span> <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a>;</div><div class="line"><a name="l00797"></a><span class="lineno"> 797</span>  <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a> = <span class="keyword">new</span> <a class="code" href="a02610.html">TBOX</a>();</div><div class="line"><a name="l00798"></a><span class="lineno"> 798</span>  <span class="keywordflow">while</span> ((part = gsearch.<a class="code" href="a04502.html#ae9cd15b1815e744caf0650320aecfc2c">NextFullSearch</a>()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00799"></a><span class="lineno"> 799</span>  (*cps_super_bbox_) += part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>();</div><div class="line"><a name="l00800"></a><span class="lineno"> 800</span>  }</div><div class="line"><a name="l00801"></a><span class="lineno"> 801</span> }</div><div class="line"><a name="l00802"></a><span class="lineno"> 802</span> </div><div class="line"><a name="l00803"></a><span class="lineno"><a class="line" href="a02246.html#ae246fb4897d7e5181ff727874a9eb140"> 803</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ae246fb4897d7e5181ff727874a9eb140">EquationDetect::IdentifyInlinePartsHorizontal</a>() {</div><div class="line"><a name="l00804"></a><span class="lineno"> 804</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(<a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a>);</div><div class="line"><a name="l00805"></a><span class="lineno"> 805</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> new_seeds;</div><div class="line"><a name="l00806"></a><span class="lineno"> 806</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kMarginDiffTh = <a class="code" href="a00527.html#ab60e4f82956a1f5fdb54d0d8303e95b7">IntCastRounded</a>(</div><div class="line"><a name="l00807"></a><span class="lineno"> 807</span>  0.5 * <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02358.html#aef3ac5f0035b4a75b470e96d0cab103a">source_resolution</a>());</div><div class="line"><a name="l00808"></a><span class="lineno"> 808</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kGapTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(</div><div class="line"><a name="l00809"></a><span class="lineno"> 809</span>  1.0 * <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02358.html#aef3ac5f0035b4a75b470e96d0cab103a">source_resolution</a>()));</div><div class="line"><a name="l00810"></a><span class="lineno"> 810</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l00811"></a><span class="lineno"> 811</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.SetUniqueMode(<span class="keyword">true</span>);</div><div class="line"><a name="l00812"></a><span class="lineno"> 812</span>  <span class="comment">// The center x coordinate of the cp_super_bbox_.</span></div><div class="line"><a name="l00813"></a><span class="lineno"> 813</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> cps_cx = <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a>-><a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>() + <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a>-><a class="code" href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">width</a>() / 2;</div><div class="line"><a name="l00814"></a><span class="lineno"> 814</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.size(); ++i) {</div><div class="line"><a name="l00815"></a><span class="lineno"> 815</span>  <a class="code" href="a04570.html">ColPartition</a>* part = <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>[i];</div><div class="line"><a name="l00816"></a><span class="lineno"> 816</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l00817"></a><span class="lineno"> 817</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> left_margin = part_box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>() - <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a>-><a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>(),</div><div class="line"><a name="l00818"></a><span class="lineno"> 818</span>  right_margin = <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a>-><a class="code" href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">right</a>() - part_box.right();</div><div class="line"><a name="l00819"></a><span class="lineno"> 819</span>  <span class="keywordtype">bool</span> right_to_left;</div><div class="line"><a name="l00820"></a><span class="lineno"> 820</span>  <span class="keywordflow">if</span> (left_margin + kMarginDiffTh < right_margin &&</div><div class="line"><a name="l00821"></a><span class="lineno"> 821</span>  left_margin < kMarginDiffTh) {</div><div class="line"><a name="l00822"></a><span class="lineno"> 822</span>  <span class="comment">// part is left aligned, so we search if it has any right neighbor.</span></div><div class="line"><a name="l00823"></a><span class="lineno"> 823</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.StartSideSearch(</div><div class="line"><a name="l00824"></a><span class="lineno"> 824</span>  part_box.right(), part_box.top(), part_box.bottom());</div><div class="line"><a name="l00825"></a><span class="lineno"> 825</span>  right_to_left = <span class="keyword">false</span>;</div><div class="line"><a name="l00826"></a><span class="lineno"> 826</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (left_margin > cps_cx) {</div><div class="line"><a name="l00827"></a><span class="lineno"> 827</span>  <span class="comment">// part locates on the right half on image, so search if it has any left</span></div><div class="line"><a name="l00828"></a><span class="lineno"> 828</span>  <span class="comment">// neighbor.</span></div><div class="line"><a name="l00829"></a><span class="lineno"> 829</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.StartSideSearch(</div><div class="line"><a name="l00830"></a><span class="lineno"> 830</span>  part_box.left(), part_box.top(), part_box.bottom());</div><div class="line"><a name="l00831"></a><span class="lineno"> 831</span>  right_to_left = <span class="keyword">true</span>;</div><div class="line"><a name="l00832"></a><span class="lineno"> 832</span>  } <span class="keywordflow">else</span> { <span class="comment">// part is not an inline equation.</span></div><div class="line"><a name="l00833"></a><span class="lineno"> 833</span>  new_seeds.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l00834"></a><span class="lineno"> 834</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00835"></a><span class="lineno"> 835</span>  }</div><div class="line"><a name="l00836"></a><span class="lineno"> 836</span>  <a class="code" href="a04570.html">ColPartition</a>* neighbor = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00837"></a><span class="lineno"> 837</span>  <span class="keywordtype">bool</span> side_neighbor_found = <span class="keyword">false</span>;</div><div class="line"><a name="l00838"></a><span class="lineno"> 838</span>  <span class="keywordflow">while</span> ((neighbor = <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.NextSideSearch(right_to_left)) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00839"></a><span class="lineno"> 839</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& neighbor_box(neighbor-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l00840"></a><span class="lineno"> 840</span>  <span class="keywordflow">if</span> (!<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(neighbor-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>()) ||</div><div class="line"><a name="l00841"></a><span class="lineno"> 841</span>  part_box.x_gap(neighbor_box) > kGapTh ||</div><div class="line"><a name="l00842"></a><span class="lineno"> 842</span>  !part_box.major_y_overlap(neighbor_box) ||</div><div class="line"><a name="l00843"></a><span class="lineno"> 843</span>  part_box.major_x_overlap(neighbor_box)) {</div><div class="line"><a name="l00844"></a><span class="lineno"> 844</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00845"></a><span class="lineno"> 845</span>  }</div><div class="line"><a name="l00846"></a><span class="lineno"> 846</span>  <span class="comment">// We have found one. Set the side_neighbor_found flag.</span></div><div class="line"><a name="l00847"></a><span class="lineno"> 847</span>  side_neighbor_found = <span class="keyword">true</span>;</div><div class="line"><a name="l00848"></a><span class="lineno"> 848</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00849"></a><span class="lineno"> 849</span>  }</div><div class="line"><a name="l00850"></a><span class="lineno"> 850</span>  <span class="keywordflow">if</span> (!side_neighbor_found) { <span class="comment">// Mark part as PT_INLINE_EQUATION.</span></div><div class="line"><a name="l00851"></a><span class="lineno"> 851</span>  part-><a class="code" href="a04570.html#a9fcf07be83840289187d6358ee752a46">set_type</a>(<a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faa52ce81f771512916e01215965910fc6">PT_INLINE_EQUATION</a>);</div><div class="line"><a name="l00852"></a><span class="lineno"> 852</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00853"></a><span class="lineno"> 853</span>  <span class="comment">// Check the geometric feature of neighbor.</span></div><div class="line"><a name="l00854"></a><span class="lineno"> 854</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& neighbor_box(neighbor-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l00855"></a><span class="lineno"> 855</span>  <span class="keywordflow">if</span> (neighbor_box.width() > part_box.width() &&</div><div class="line"><a name="l00856"></a><span class="lineno"> 856</span>  neighbor-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() != <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>) { <span class="comment">// Mark as PT_INLINE_EQUATION.</span></div><div class="line"><a name="l00857"></a><span class="lineno"> 857</span>  part-><a class="code" href="a04570.html#a9fcf07be83840289187d6358ee752a46">set_type</a>(<a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faa52ce81f771512916e01215965910fc6">PT_INLINE_EQUATION</a>);</div><div class="line"><a name="l00858"></a><span class="lineno"> 858</span>  } <span class="keywordflow">else</span> { <span class="comment">// part is not an inline equation type.</span></div><div class="line"><a name="l00859"></a><span class="lineno"> 859</span>  new_seeds.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l00860"></a><span class="lineno"> 860</span>  }</div><div class="line"><a name="l00861"></a><span class="lineno"> 861</span>  }</div><div class="line"><a name="l00862"></a><span class="lineno"> 862</span>  }</div><div class="line"><a name="l00863"></a><span class="lineno"> 863</span> </div><div class="line"><a name="l00864"></a><span class="lineno"> 864</span>  <span class="comment">// Reset the cp_seeds_ using the new_seeds.</span></div><div class="line"><a name="l00865"></a><span class="lineno"> 865</span>  <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a> = new_seeds;</div><div class="line"><a name="l00866"></a><span class="lineno"> 866</span> }</div><div class="line"><a name="l00867"></a><span class="lineno"> 867</span> </div><div class="line"><a name="l00868"></a><span class="lineno"><a class="line" href="a02246.html#a096b2bb7f8f59484ec2043d92c3f1eec"> 868</a></span> <span class="keywordtype">int</span> <a class="code" href="a02246.html#a096b2bb7f8f59484ec2043d92c3f1eec">EquationDetect::EstimateTextPartLineSpacing</a>() {</div><div class="line"><a name="l00869"></a><span class="lineno"> 869</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> gsearch(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l00870"></a><span class="lineno"> 870</span> </div><div class="line"><a name="l00871"></a><span class="lineno"> 871</span>  <span class="comment">// Get the y gap between text partitions;</span></div><div class="line"><a name="l00872"></a><span class="lineno"> 872</span>  <a class="code" href="a04570.html">ColPartition</a> *current = <span class="keyword">nullptr</span>, *prev = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00873"></a><span class="lineno"> 873</span>  gsearch.<a class="code" href="a04502.html#ad7f7e99bcda5e0daeb682b772e445f60">StartFullSearch</a>();</div><div class="line"><a name="l00874"></a><span class="lineno"> 874</span>  <a class="code" href="a02182.html">GenericVector<int></a> ygaps;</div><div class="line"><a name="l00875"></a><span class="lineno"> 875</span>  <span class="keywordflow">while</span> ((current = gsearch.<a class="code" href="a04502.html#ae9cd15b1815e744caf0650320aecfc2c">NextFullSearch</a>()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00876"></a><span class="lineno"> 876</span>  <span class="keywordflow">if</span> (!<a class="code" href="a00380.html#a49b7c03fb4e55b82a8fd22b7c6094082">PTIsTextType</a>(current-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>())) {</div><div class="line"><a name="l00877"></a><span class="lineno"> 877</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00878"></a><span class="lineno"> 878</span>  }</div><div class="line"><a name="l00879"></a><span class="lineno"> 879</span>  <span class="keywordflow">if</span> (prev != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00880"></a><span class="lineno"> 880</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a> &current_box = current-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>();</div><div class="line"><a name="l00881"></a><span class="lineno"> 881</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a> &prev_box = prev->bounding_box();</div><div class="line"><a name="l00882"></a><span class="lineno"> 882</span>  <span class="comment">// prev and current should be x major overlap and non y overlap.</span></div><div class="line"><a name="l00883"></a><span class="lineno"> 883</span>  <span class="keywordflow">if</span> (current_box.<a class="code" href="a02610.html#ade947e3871fa316e3e0b0864905c2997">major_x_overlap</a>(prev_box) &&</div><div class="line"><a name="l00884"></a><span class="lineno"> 884</span>  !current_box.<a class="code" href="a02610.html#a8b532906f18f4c55055f47ec6b843608">y_overlap</a>(prev_box)) {</div><div class="line"><a name="l00885"></a><span class="lineno"> 885</span>  <span class="keywordtype">int</span> gap = current_box.<a class="code" href="a02610.html#a8f6f816c4e4d792863563d2d4368db8d">y_gap</a>(prev_box);</div><div class="line"><a name="l00886"></a><span class="lineno"> 886</span>  <span class="keywordflow">if</span> (gap < std::min(current_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>(), prev_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>())) {</div><div class="line"><a name="l00887"></a><span class="lineno"> 887</span>  <span class="comment">// The gap should be smaller than the height of the bounding boxes.</span></div><div class="line"><a name="l00888"></a><span class="lineno"> 888</span>  ygaps.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(gap);</div><div class="line"><a name="l00889"></a><span class="lineno"> 889</span>  }</div><div class="line"><a name="l00890"></a><span class="lineno"> 890</span>  }</div><div class="line"><a name="l00891"></a><span class="lineno"> 891</span>  }</div><div class="line"><a name="l00892"></a><span class="lineno"> 892</span>  prev = current;</div><div class="line"><a name="l00893"></a><span class="lineno"> 893</span>  }</div><div class="line"><a name="l00894"></a><span class="lineno"> 894</span> </div><div class="line"><a name="l00895"></a><span class="lineno"> 895</span>  <span class="keywordflow">if</span> (ygaps.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() < 8) { <span class="comment">// We do not have enough data.</span></div><div class="line"><a name="l00896"></a><span class="lineno"> 896</span>  <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00897"></a><span class="lineno"> 897</span>  }</div><div class="line"><a name="l00898"></a><span class="lineno"> 898</span> </div><div class="line"><a name="l00899"></a><span class="lineno"> 899</span>  <span class="comment">// Compute the line spacing from ygaps: use the mean of the first half.</span></div><div class="line"><a name="l00900"></a><span class="lineno"> 900</span>  ygaps.<a class="code" href="a02182.html#a999bbd8ff336c81fe1198ea714c7936d">sort</a>();</div><div class="line"><a name="l00901"></a><span class="lineno"> 901</span>  <span class="keywordtype">int</span> spacing = 0, <a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a>;</div><div class="line"><a name="l00902"></a><span class="lineno"> 902</span>  <span class="keywordflow">for</span> (<a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a> = 0; <a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a> < ygaps.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() / 2; <a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a>++) {</div><div class="line"><a name="l00903"></a><span class="lineno"> 903</span>  spacing += ygaps[<a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a>];</div><div class="line"><a name="l00904"></a><span class="lineno"> 904</span>  }</div><div class="line"><a name="l00905"></a><span class="lineno"> 905</span>  <span class="keywordflow">return</span> spacing / <a class="code" href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a>;</div><div class="line"><a name="l00906"></a><span class="lineno"> 906</span> }</div><div class="line"><a name="l00907"></a><span class="lineno"> 907</span> </div><div class="line"><a name="l00908"></a><span class="lineno"><a class="line" href="a02246.html#a657f367e87724bfab6359c42f10fad66"> 908</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a657f367e87724bfab6359c42f10fad66">EquationDetect::IdentifyInlinePartsVertical</a>(</div><div class="line"><a name="l00909"></a><span class="lineno"> 909</span>  <span class="keyword">const</span> <span class="keywordtype">bool</span> top_to_bottom, <span class="keyword">const</span> <span class="keywordtype">int</span> textparts_linespacing) {</div><div class="line"><a name="l00910"></a><span class="lineno"> 910</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.empty()) {</div><div class="line"><a name="l00911"></a><span class="lineno"> 911</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l00912"></a><span class="lineno"> 912</span>  }</div><div class="line"><a name="l00913"></a><span class="lineno"> 913</span> </div><div class="line"><a name="l00914"></a><span class="lineno"> 914</span>  <span class="comment">// Sort cp_seeds_.</span></div><div class="line"><a name="l00915"></a><span class="lineno"> 915</span>  <span class="keywordflow">if</span> (top_to_bottom) { <span class="comment">// From top to bottom.</span></div><div class="line"><a name="l00916"></a><span class="lineno"> 916</span>  <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.sort(&SortCPByTopReverse);</div><div class="line"><a name="l00917"></a><span class="lineno"> 917</span>  } <span class="keywordflow">else</span> { <span class="comment">// From bottom to top.</span></div><div class="line"><a name="l00918"></a><span class="lineno"> 918</span>  <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.sort(&SortCPByBottom);</div><div class="line"><a name="l00919"></a><span class="lineno"> 919</span>  }</div><div class="line"><a name="l00920"></a><span class="lineno"> 920</span> </div><div class="line"><a name="l00921"></a><span class="lineno"> 921</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> new_seeds;</div><div class="line"><a name="l00922"></a><span class="lineno"> 922</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.size(); ++i) {</div><div class="line"><a name="l00923"></a><span class="lineno"> 923</span>  <a class="code" href="a04570.html">ColPartition</a>* part = <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>[i];</div><div class="line"><a name="l00924"></a><span class="lineno"> 924</span>  <span class="comment">// If we sort cp_seeds_ from top to bottom, then for each cp_seeds_, we look</span></div><div class="line"><a name="l00925"></a><span class="lineno"> 925</span>  <span class="comment">// for its top neighbors, so that if two/more inline regions are connected</span></div><div class="line"><a name="l00926"></a><span class="lineno"> 926</span>  <span class="comment">// to each other, then we will identify the top one, and then use it to</span></div><div class="line"><a name="l00927"></a><span class="lineno"> 927</span>  <span class="comment">// identify the bottom one.</span></div><div class="line"><a name="l00928"></a><span class="lineno"> 928</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#a9f0be32790e5915d579cd1898530fb6b">IsInline</a>(!top_to_bottom, textparts_linespacing, part)) {</div><div class="line"><a name="l00929"></a><span class="lineno"> 929</span>  part-><a class="code" href="a04570.html#a9fcf07be83840289187d6358ee752a46">set_type</a>(<a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faa52ce81f771512916e01215965910fc6">PT_INLINE_EQUATION</a>);</div><div class="line"><a name="l00930"></a><span class="lineno"> 930</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00931"></a><span class="lineno"> 931</span>  new_seeds.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l00932"></a><span class="lineno"> 932</span>  }</div><div class="line"><a name="l00933"></a><span class="lineno"> 933</span>  }</div><div class="line"><a name="l00934"></a><span class="lineno"> 934</span>  <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a> = new_seeds;</div><div class="line"><a name="l00935"></a><span class="lineno"> 935</span> }</div><div class="line"><a name="l00936"></a><span class="lineno"> 936</span> </div><div class="line"><a name="l00937"></a><span class="lineno"><a class="line" href="a02246.html#a9f0be32790e5915d579cd1898530fb6b"> 937</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#a9f0be32790e5915d579cd1898530fb6b">EquationDetect::IsInline</a>(<span class="keyword">const</span> <span class="keywordtype">bool</span> search_bottom,</div><div class="line"><a name="l00938"></a><span class="lineno"> 938</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> textparts_linespacing,</div><div class="line"><a name="l00939"></a><span class="lineno"> 939</span>  <a class="code" href="a04570.html">ColPartition</a>* part) {</div><div class="line"><a name="l00940"></a><span class="lineno"> 940</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00941"></a><span class="lineno"> 941</span>  <span class="comment">// Look for its nearest vertical neighbor that hardly overlaps in y but</span></div><div class="line"><a name="l00942"></a><span class="lineno"> 942</span>  <span class="comment">// largely overlaps in x.</span></div><div class="line"><a name="l00943"></a><span class="lineno"> 943</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l00944"></a><span class="lineno"> 944</span>  <a class="code" href="a04570.html">ColPartition</a> *neighbor = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00945"></a><span class="lineno"> 945</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l00946"></a><span class="lineno"> 946</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> kYGapRatioTh = 1.0;</div><div class="line"><a name="l00947"></a><span class="lineno"> 947</span> </div><div class="line"><a name="l00948"></a><span class="lineno"> 948</span>  <span class="keywordflow">if</span> (search_bottom) {</div><div class="line"><a name="l00949"></a><span class="lineno"> 949</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.StartVerticalSearch(part_box.left(), part_box.right(),</div><div class="line"><a name="l00950"></a><span class="lineno"> 950</span>  part_box.bottom());</div><div class="line"><a name="l00951"></a><span class="lineno"> 951</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00952"></a><span class="lineno"> 952</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.StartVerticalSearch(part_box.left(), part_box.right(),</div><div class="line"><a name="l00953"></a><span class="lineno"> 953</span>  part_box.top());</div><div class="line"><a name="l00954"></a><span class="lineno"> 954</span>  }</div><div class="line"><a name="l00955"></a><span class="lineno"> 955</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.SetUniqueMode(<span class="keyword">true</span>);</div><div class="line"><a name="l00956"></a><span class="lineno"> 956</span>  <span class="keywordflow">while</span> ((neighbor = <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.NextVerticalSearch(search_bottom)) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l00957"></a><span class="lineno"> 957</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& neighbor_box(neighbor-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l00958"></a><span class="lineno"> 958</span>  <span class="keywordflow">if</span> (part_box.y_gap(neighbor_box) > kYGapRatioTh *</div><div class="line"><a name="l00959"></a><span class="lineno"> 959</span>  std::min(part_box.height(), neighbor_box.height())) {</div><div class="line"><a name="l00960"></a><span class="lineno"> 960</span>  <span class="comment">// Finished searching.</span></div><div class="line"><a name="l00961"></a><span class="lineno"> 961</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00962"></a><span class="lineno"> 962</span>  }</div><div class="line"><a name="l00963"></a><span class="lineno"> 963</span>  <span class="keywordflow">if</span> (!<a class="code" href="a00380.html#a49b7c03fb4e55b82a8fd22b7c6094082">PTIsTextType</a>(neighbor-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>())) {</div><div class="line"><a name="l00964"></a><span class="lineno"> 964</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00965"></a><span class="lineno"> 965</span>  }</div><div class="line"><a name="l00966"></a><span class="lineno"> 966</span> </div><div class="line"><a name="l00967"></a><span class="lineno"> 967</span>  <span class="comment">// Check if neighbor and part is inline similar.</span></div><div class="line"><a name="l00968"></a><span class="lineno"> 968</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> kHeightRatioTh = 0.5;</div><div class="line"><a name="l00969"></a><span class="lineno"> 969</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kYGapTh = textparts_linespacing > 0 ?</div><div class="line"><a name="l00970"></a><span class="lineno"> 970</span>  textparts_linespacing + <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(0.02 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>)):</div><div class="line"><a name="l00971"></a><span class="lineno"> 971</span>  static_cast<int>(roundf(0.05 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>)); <span class="comment">// Default value.</span></div><div class="line"><a name="l00972"></a><span class="lineno"> 972</span>  <span class="keywordflow">if</span> (part_box.x_overlap(neighbor_box) && <span class="comment">// Location feature.</span></div><div class="line"><a name="l00973"></a><span class="lineno"> 973</span>  part_box.y_gap(neighbor_box) <= kYGapTh && <span class="comment">// Line spacing.</span></div><div class="line"><a name="l00974"></a><span class="lineno"> 974</span>  <span class="comment">// Geo feature.</span></div><div class="line"><a name="l00975"></a><span class="lineno"> 975</span>  <span class="keyword">static_cast<</span><span class="keywordtype">float</span><span class="keyword">></span>(std::min(part_box.height(), neighbor_box.height())) /</div><div class="line"><a name="l00976"></a><span class="lineno"> 976</span>  std::max(part_box.height(), neighbor_box.height()) > kHeightRatioTh) {</div><div class="line"><a name="l00977"></a><span class="lineno"> 977</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00978"></a><span class="lineno"> 978</span>  }</div><div class="line"><a name="l00979"></a><span class="lineno"> 979</span>  }</div><div class="line"><a name="l00980"></a><span class="lineno"> 980</span> </div><div class="line"><a name="l00981"></a><span class="lineno"> 981</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00982"></a><span class="lineno"> 982</span> }</div><div class="line"><a name="l00983"></a><span class="lineno"> 983</span> </div><div class="line"><a name="l00984"></a><span class="lineno"><a class="line" href="a02246.html#a14f4d2d35ed292b40ce57b028d7e124a"> 984</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#a14f4d2d35ed292b40ce57b028d7e124a">EquationDetect::CheckSeedBlobsCount</a>(<a class="code" href="a04570.html">ColPartition</a>* part) {</div><div class="line"><a name="l00985"></a><span class="lineno"> 985</span>  <span class="keywordflow">if</span> (!part) {</div><div class="line"><a name="l00986"></a><span class="lineno"> 986</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00987"></a><span class="lineno"> 987</span>  }</div><div class="line"><a name="l00988"></a><span class="lineno"> 988</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kSeedMathBlobsCount = 2;</div><div class="line"><a name="l00989"></a><span class="lineno"> 989</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kSeedMathDigitBlobsCount = 5;</div><div class="line"><a name="l00990"></a><span class="lineno"> 990</span> </div><div class="line"><a name="l00991"></a><span class="lineno"> 991</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> blobs = part-><a class="code" href="a04570.html#a2ad3b1e781a208614d52e263a28c1e00">boxes_count</a>(),</div><div class="line"><a name="l00992"></a><span class="lineno"> 992</span>  math_blobs = part-><a class="code" href="a04570.html#a2a9ba24fa7f6735045a09857d664136f">SpecialBlobsCount</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca356056d522254adc40c8acdf14f19c4d">BSTT_MATH</a>),</div><div class="line"><a name="l00993"></a><span class="lineno"> 993</span>  digit_blobs = part-><a class="code" href="a04570.html#a2a9ba24fa7f6735045a09857d664136f">SpecialBlobsCount</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8caaf28e2df284d1c1c8caf262b5fcdb3f4">BSTT_DIGIT</a>);</div><div class="line"><a name="l00994"></a><span class="lineno"> 994</span>  <span class="keywordflow">if</span> (blobs < <a class="code" href="a01629.html#a113f000461790e1cd1c397f382814da5">kSeedBlobsCountTh</a> || math_blobs <= kSeedMathBlobsCount ||</div><div class="line"><a name="l00995"></a><span class="lineno"> 995</span>  math_blobs + digit_blobs <= kSeedMathDigitBlobsCount) {</div><div class="line"><a name="l00996"></a><span class="lineno"> 996</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00997"></a><span class="lineno"> 997</span>  }</div><div class="line"><a name="l00998"></a><span class="lineno"> 998</span> </div><div class="line"><a name="l00999"></a><span class="lineno"> 999</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l01000"></a><span class="lineno"> 1000</span> }</div><div class="line"><a name="l01001"></a><span class="lineno"> 1001</span> </div><div class="line"><a name="l01002"></a><span class="lineno"><a class="line" href="a02246.html#a056b756d6ebd931501b3488b2b526336"> 1002</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#a056b756d6ebd931501b3488b2b526336">EquationDetect::CheckSeedDensity</a>(</div><div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> math_density_high,</div><div class="line"><a name="l01004"></a><span class="lineno"> 1004</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> math_density_low,</div><div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>  <span class="keyword">const</span> <a class="code" href="a04570.html">ColPartition</a>* part)<span class="keyword"> const </span>{</div><div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part);</div><div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>  <span class="keywordtype">float</span> math_digit_density = part-><a class="code" href="a04570.html#a15d65b1f982ad6eab996c44e846528fe">SpecialBlobsDensity</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca356056d522254adc40c8acdf14f19c4d">BSTT_MATH</a>)</div><div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>  + part-><a class="code" href="a04570.html#a15d65b1f982ad6eab996c44e846528fe">SpecialBlobsDensity</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8caaf28e2df284d1c1c8caf262b5fcdb3f4">BSTT_DIGIT</a>);</div><div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>  <span class="keywordtype">float</span> italic_density = part-><a class="code" href="a04570.html#a15d65b1f982ad6eab996c44e846528fe">SpecialBlobsDensity</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca9f7c059031ba5f95a4e0f43bac16a33a">BSTT_ITALIC</a>);</div><div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>  <span class="keywordflow">if</span> (math_digit_density > math_density_high) {</div><div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l01012"></a><span class="lineno"> 1012</span>  }</div><div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>  <span class="keywordflow">if</span> (math_digit_density + italic_density > <a class="code" href="a01629.html#ad64e658be002902d7a5b0dd98ab0fe35">kMathItalicDensityTh</a> &&</div><div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>  math_digit_density > math_density_low) {</div><div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>  }</div><div class="line"><a name="l01017"></a><span class="lineno"> 1017</span> </div><div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l01019"></a><span class="lineno"> 1019</span> }</div><div class="line"><a name="l01020"></a><span class="lineno"> 1020</span> </div><div class="line"><a name="l01021"></a><span class="lineno"><a class="line" href="a02246.html#a35912b69ed5ffa28d88ed53ba9f060d3"> 1021</a></span> <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223">EquationDetect::IndentType</a> <a class="code" href="a02246.html#a35912b69ed5ffa28d88ed53ba9f060d3">EquationDetect::IsIndented</a>(<a class="code" href="a04570.html">ColPartition</a>* part) {</div><div class="line"><a name="l01022"></a><span class="lineno"> 1022</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part);</div><div class="line"><a name="l01023"></a><span class="lineno"> 1023</span> </div><div class="line"><a name="l01024"></a><span class="lineno"> 1024</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l01025"></a><span class="lineno"> 1025</span>  <a class="code" href="a04570.html">ColPartition</a> *neighbor = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l01026"></a><span class="lineno"> 1026</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l01027"></a><span class="lineno"> 1027</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kXGapTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(0.5 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>));</div><div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kRadiusTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(3.0 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>));</div><div class="line"><a name="l01029"></a><span class="lineno"> 1029</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kYGapTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(0.5 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>));</div><div class="line"><a name="l01030"></a><span class="lineno"> 1030</span> </div><div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>  <span class="comment">// Here we use a simple approximation algorithm: from the center of part, We</span></div><div class="line"><a name="l01032"></a><span class="lineno"> 1032</span>  <span class="comment">// perform the radius search, and check if we can find a neighboring partition</span></div><div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>  <span class="comment">// that locates on the top/bottom left of part.</span></div><div class="line"><a name="l01034"></a><span class="lineno"> 1034</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.StartRadSearch((part_box.left() + part_box.right()) / 2,</div><div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>  (part_box.top() + part_box.bottom()) / 2, kRadiusTh);</div><div class="line"><a name="l01036"></a><span class="lineno"> 1036</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.SetUniqueMode(<span class="keyword">true</span>);</div><div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>  <span class="keywordtype">bool</span> left_indented = <span class="keyword">false</span>, right_indented = <span class="keyword">false</span>;</div><div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>  <span class="keywordflow">while</span> ((neighbor = <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.NextRadSearch()) != <span class="keyword">nullptr</span> &&</div><div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>  (!left_indented || !right_indented)) {</div><div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>  <span class="keywordflow">if</span> (neighbor == part) {</div><div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>  }</div><div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& neighbor_box(neighbor-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l01044"></a><span class="lineno"> 1044</span> </div><div class="line"><a name="l01045"></a><span class="lineno"> 1045</span>  <span class="keywordflow">if</span> (part_box.major_y_overlap(neighbor_box) &&</div><div class="line"><a name="l01046"></a><span class="lineno"> 1046</span>  part_box.x_gap(neighbor_box) < kXGapTh) {</div><div class="line"><a name="l01047"></a><span class="lineno"> 1047</span>  <span class="comment">// When this happens, it is likely part is a fragment of an</span></div><div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>  <span class="comment">// over-segmented colpartition. So we return false.</span></div><div class="line"><a name="l01049"></a><span class="lineno"> 1049</span>  <span class="keywordflow">return</span> <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a0b833974e34cfce11e7bb182afd5c43c">NO_INDENT</a>;</div><div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>  }</div><div class="line"><a name="l01051"></a><span class="lineno"> 1051</span> </div><div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>  <span class="keywordflow">if</span> (!<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(neighbor-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>())) {</div><div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01054"></a><span class="lineno"> 1054</span>  }</div><div class="line"><a name="l01055"></a><span class="lineno"> 1055</span> </div><div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>  <span class="comment">// The neighbor should be above/below part, and overlap in x direction.</span></div><div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>  <span class="keywordflow">if</span> (!part_box.x_overlap(neighbor_box) || part_box.y_overlap(neighbor_box)) {</div><div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>  }</div><div class="line"><a name="l01060"></a><span class="lineno"> 1060</span> </div><div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>  <span class="keywordflow">if</span> (part_box.y_gap(neighbor_box) < kYGapTh) {</div><div class="line"><a name="l01062"></a><span class="lineno"> 1062</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> left_gap = part_box.left() - neighbor_box.left();</div><div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> right_gap = neighbor_box.right() - part_box.right();</div><div class="line"><a name="l01064"></a><span class="lineno"> 1064</span>  <span class="keywordflow">if</span> (left_gap > kXGapTh) {</div><div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>  left_indented = <span class="keyword">true</span>;</div><div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>  }</div><div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>  <span class="keywordflow">if</span> (right_gap > kXGapTh) {</div><div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>  right_indented = <span class="keyword">true</span>;</div><div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>  }</div><div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>  }</div><div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>  }</div><div class="line"><a name="l01072"></a><span class="lineno"> 1072</span> </div><div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>  <span class="keywordflow">if</span> (left_indented && right_indented) {</div><div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>  <span class="keywordflow">return</span> <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a4c2d65f544868a206cf72cd4928c8d06">BOTH_INDENT</a>;</div><div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>  }</div><div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>  <span class="keywordflow">if</span> (left_indented) {</div><div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>  <span class="keywordflow">return</span> <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223aab75a5b0799710a14abdda1687c1ae0e">LEFT_INDENT</a>;</div><div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>  }</div><div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>  <span class="keywordflow">if</span> (right_indented) {</div><div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>  <span class="keywordflow">return</span> <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a8b060953ddfce6e934e4346ba630606b">RIGHT_INDENT</a>;</div><div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>  }</div><div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>  <span class="keywordflow">return</span> <a class="code" href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a0b833974e34cfce11e7bb182afd5c43c">NO_INDENT</a>;</div><div class="line"><a name="l01083"></a><span class="lineno"> 1083</span> }</div><div class="line"><a name="l01084"></a><span class="lineno"> 1084</span> </div><div class="line"><a name="l01085"></a><span class="lineno"><a class="line" href="a02246.html#a76bc8a18a94fc5f89f6d4d073ba0c9bf"> 1085</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#a76bc8a18a94fc5f89f6d4d073ba0c9bf">EquationDetect::ExpandSeed</a>(<a class="code" href="a04570.html">ColPartition</a>* seed) {</div><div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>  <span class="keywordflow">if</span> (seed == <span class="keyword">nullptr</span> || <span class="comment">// This seed has been absorbed by other seeds.</span></div><div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>  seed-><a class="code" href="a04570.html#a75d93ef0688e5d2e6272dba4c5b72cee">IsVerticalType</a>()) { <span class="comment">// We skip vertical type right now.</span></div><div class="line"><a name="l01088"></a><span class="lineno"> 1088</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>  }</div><div class="line"><a name="l01090"></a><span class="lineno"> 1090</span> </div><div class="line"><a name="l01091"></a><span class="lineno"> 1091</span>  <span class="comment">// Expand in four directions.</span></div><div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> parts_to_merge;</div><div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>  <a class="code" href="a02246.html#aa01a56f6dae2e52de475be85ac4eabfd">ExpandSeedHorizontal</a>(<span class="keyword">true</span>, seed, &parts_to_merge);</div><div class="line"><a name="l01094"></a><span class="lineno"> 1094</span>  <a class="code" href="a02246.html#aa01a56f6dae2e52de475be85ac4eabfd">ExpandSeedHorizontal</a>(<span class="keyword">false</span>, seed, &parts_to_merge);</div><div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>  <a class="code" href="a02246.html#ab65b124e364901a9d93869afc923255f">ExpandSeedVertical</a>(<span class="keyword">true</span>, seed, &parts_to_merge);</div><div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>  <a class="code" href="a02246.html#ab65b124e364901a9d93869afc923255f">ExpandSeedVertical</a>(<span class="keyword">false</span>, seed, &parts_to_merge);</div><div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>  <a class="code" href="a02246.html#ace94a05a89afb074b106c444584254d6">SearchByOverlap</a>(seed, &parts_to_merge);</div><div class="line"><a name="l01098"></a><span class="lineno"> 1098</span> </div><div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>  <span class="keywordflow">if</span> (parts_to_merge.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>()) { <span class="comment">// We don't find any partition to merge.</span></div><div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>  }</div><div class="line"><a name="l01102"></a><span class="lineno"> 1102</span> </div><div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>  <span class="comment">// Merge all partitions in parts_to_merge with seed. We first remove seed</span></div><div class="line"><a name="l01104"></a><span class="lineno"> 1104</span>  <span class="comment">// from part_grid_ as its bounding box is going to expand. Then we add it</span></div><div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>  <span class="comment">// back after it aborbs all parts_to_merge parititions.</span></div><div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>  <a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>-><a class="code" href="a04514.html#adc713153c1282d8727f85ee6d38d7d31">RemoveBBox</a>(seed);</div><div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < parts_to_merge.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>  <a class="code" href="a04570.html">ColPartition</a>* part = parts_to_merge[i];</div><div class="line"><a name="l01109"></a><span class="lineno"> 1109</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>) {</div><div class="line"><a name="l01110"></a><span class="lineno"> 1110</span>  <span class="comment">// If part is in cp_seeds_, then we mark it as nullptr so that we won't</span></div><div class="line"><a name="l01111"></a><span class="lineno"> 1111</span>  <span class="comment">// process it again.</span></div><div class="line"><a name="l01112"></a><span class="lineno"> 1112</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>.size(); ++j) {</div><div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>  <span class="keywordflow">if</span> (part == <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>[j]) {</div><div class="line"><a name="l01114"></a><span class="lineno"> 1114</span>  <a class="code" href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">cp_seeds_</a>[j] = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>  }</div><div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>  }</div><div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>  }</div><div class="line"><a name="l01119"></a><span class="lineno"> 1119</span> </div><div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>  <span class="comment">// part has already been removed from part_grid_ in function</span></div><div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>  <span class="comment">// ExpandSeedHorizontal/ExpandSeedVertical.</span></div><div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>  seed-><a class="code" href="a04570.html#aedb906fb73709c79d702f0f95a85b300">Absorb</a>(part, <span class="keyword">nullptr</span>);</div><div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>  }</div><div class="line"><a name="l01124"></a><span class="lineno"> 1124</span> </div><div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l01126"></a><span class="lineno"> 1126</span> }</div><div class="line"><a name="l01127"></a><span class="lineno"> 1127</span> </div><div class="line"><a name="l01128"></a><span class="lineno"><a class="line" href="a02246.html#aa01a56f6dae2e52de475be85ac4eabfd"> 1128</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#aa01a56f6dae2e52de475be85ac4eabfd">EquationDetect::ExpandSeedHorizontal</a>(</div><div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>  <span class="keyword">const</span> <span class="keywordtype">bool</span> search_left,</div><div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>  <a class="code" href="a04570.html">ColPartition</a>* seed,</div><div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a>* parts_to_merge) {</div><div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(seed != <span class="keyword">nullptr</span> && parts_to_merge != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> kYOverlapTh = 0.6;</div><div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kXGapTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(0.2 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>));</div><div class="line"><a name="l01135"></a><span class="lineno"> 1135</span> </div><div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l01137"></a><span class="lineno"> 1137</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& seed_box(seed-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> x = search_left ? seed_box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>() : seed_box.right();</div><div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.StartSideSearch(x, seed_box.bottom(), seed_box.top());</div><div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.SetUniqueMode(<span class="keyword">true</span>);</div><div class="line"><a name="l01141"></a><span class="lineno"> 1141</span> </div><div class="line"><a name="l01142"></a><span class="lineno"> 1142</span>  <span class="comment">// Search iteratively.</span></div><div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>  <a class="code" href="a04570.html">ColPartition</a> *part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l01144"></a><span class="lineno"> 1144</span>  <span class="keywordflow">while</span> ((part = <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.NextSideSearch(search_left)) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>  <span class="keywordflow">if</span> (part == seed) {</div><div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>  }</div><div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>  <span class="keywordflow">if</span> (part_box.x_gap(seed_box) > kXGapTh) { <span class="comment">// Out of scope.</span></div><div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01151"></a><span class="lineno"> 1151</span>  }</div><div class="line"><a name="l01152"></a><span class="lineno"> 1152</span> </div><div class="line"><a name="l01153"></a><span class="lineno"> 1153</span>  <span class="comment">// Check part location.</span></div><div class="line"><a name="l01154"></a><span class="lineno"> 1154</span>  <span class="keywordflow">if</span> ((part_box.left() >= seed_box.left() && search_left) ||</div><div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>  (part_box.right() <= seed_box.right() && !search_left)) {</div><div class="line"><a name="l01156"></a><span class="lineno"> 1156</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>  }</div><div class="line"><a name="l01158"></a><span class="lineno"> 1158</span> </div><div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() != <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>) { <span class="comment">// Non-equation type.</span></div><div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>  <span class="comment">// Skip PT_LINLINE_EQUATION and non text type.</span></div><div class="line"><a name="l01161"></a><span class="lineno"> 1161</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faa52ce81f771512916e01215965910fc6">PT_INLINE_EQUATION</a> ||</div><div class="line"><a name="l01162"></a><span class="lineno"> 1162</span>  (!<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>()) &&</div><div class="line"><a name="l01163"></a><span class="lineno"> 1163</span>  part-><a class="code" href="a04570.html#a5ce26bd79f510a828e566d37a3abd8de">blob_type</a>() != <a class="code" href="a00224.html#aebfaf711760a99b60c297d1d619df575a56cc149e97b34634dd39babda79ea17d">BRT_HLINE</a>)) {</div><div class="line"><a name="l01164"></a><span class="lineno"> 1164</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01165"></a><span class="lineno"> 1165</span>  }</div><div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>  <span class="comment">// For other types, it should be the near small neighbor of seed.</span></div><div class="line"><a name="l01167"></a><span class="lineno"> 1167</span>  <span class="keywordflow">if</span> (!<a class="code" href="a02246.html#a612dd0f3c9191b1614d62e2c6f758cda">IsNearSmallNeighbor</a>(seed_box, part_box) ||</div><div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>  !<a class="code" href="a02246.html#a2a4aa2332c4dcd111ab373696d6e0558">CheckSeedNeighborDensity</a>(part)) {</div><div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>  }</div><div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>  } <span class="keywordflow">else</span> { <span class="comment">// Equation type, check the y overlap.</span></div><div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>  <span class="keywordflow">if</span> (part_box.y_overlap_fraction(seed_box) < kYOverlapTh &&</div><div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>  seed_box.y_overlap_fraction(part_box) < kYOverlapTh) {</div><div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>  }</div><div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>  }</div><div class="line"><a name="l01177"></a><span class="lineno"> 1177</span> </div><div class="line"><a name="l01178"></a><span class="lineno"> 1178</span>  <span class="comment">// Passed the check, delete it from search and add into parts_to_merge.</span></div><div class="line"><a name="l01179"></a><span class="lineno"> 1179</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.RemoveBBox();</div><div class="line"><a name="l01180"></a><span class="lineno"> 1180</span>  parts_to_merge-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>  }</div><div class="line"><a name="l01182"></a><span class="lineno"> 1182</span> }</div><div class="line"><a name="l01183"></a><span class="lineno"> 1183</span> </div><div class="line"><a name="l01184"></a><span class="lineno"><a class="line" href="a02246.html#ab65b124e364901a9d93869afc923255f"> 1184</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ab65b124e364901a9d93869afc923255f">EquationDetect::ExpandSeedVertical</a>(</div><div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>  <span class="keyword">const</span> <span class="keywordtype">bool</span> search_bottom,</div><div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>  <a class="code" href="a04570.html">ColPartition</a>* seed,</div><div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a>* parts_to_merge) {</div><div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(seed != <span class="keyword">nullptr</span> && parts_to_merge != <span class="keyword">nullptr</span> &&</div><div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>  <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a> != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l01190"></a><span class="lineno"> 1190</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> kXOverlapTh = 0.4;</div><div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kYGapTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(0.2 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>));</div><div class="line"><a name="l01192"></a><span class="lineno"> 1192</span> </div><div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& seed_box(seed-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> y = search_bottom ? seed_box.<a class="code" href="a02610.html#a9fee4521e71300975cb34ebb21e3fca5">bottom</a>() : seed_box.top();</div><div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.StartVerticalSearch(</div><div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>  <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a>-><a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>(), <a class="code" href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">cps_super_bbox_</a>-><a class="code" href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">right</a>(), y);</div><div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.SetUniqueMode(<span class="keyword">true</span>);</div><div class="line"><a name="l01199"></a><span class="lineno"> 1199</span> </div><div class="line"><a name="l01200"></a><span class="lineno"> 1200</span>  <span class="comment">// Search iteratively.</span></div><div class="line"><a name="l01201"></a><span class="lineno"> 1201</span>  <a class="code" href="a04570.html">ColPartition</a> *part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l01202"></a><span class="lineno"> 1202</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> parts;</div><div class="line"><a name="l01203"></a><span class="lineno"> 1203</span>  <span class="keywordtype">int</span> skipped_min_top = std::numeric_limits<int>::max(), skipped_max_bottom = -1;</div><div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>  <span class="keywordflow">while</span> ((part = <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.NextVerticalSearch(search_bottom)) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l01205"></a><span class="lineno"> 1205</span>  <span class="keywordflow">if</span> (part == seed) {</div><div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>  }</div><div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l01209"></a><span class="lineno"> 1209</span> </div><div class="line"><a name="l01210"></a><span class="lineno"> 1210</span>  <span class="keywordflow">if</span> (part_box.y_gap(seed_box) > kYGapTh) { <span class="comment">// Out of scope.</span></div><div class="line"><a name="l01211"></a><span class="lineno"> 1211</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01212"></a><span class="lineno"> 1212</span>  }</div><div class="line"><a name="l01213"></a><span class="lineno"> 1213</span> </div><div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>  <span class="comment">// Check part location.</span></div><div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>  <span class="keywordflow">if</span> ((part_box.bottom() >= seed_box.bottom() && search_bottom) ||</div><div class="line"><a name="l01216"></a><span class="lineno"> 1216</span>  (part_box.top() <= seed_box.top() && !search_bottom)) {</div><div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>  }</div><div class="line"><a name="l01219"></a><span class="lineno"> 1219</span> </div><div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>  <span class="keywordtype">bool</span> skip_part = <span class="keyword">false</span>;</div><div class="line"><a name="l01221"></a><span class="lineno"> 1221</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() != <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>) { <span class="comment">// Non-equation type.</span></div><div class="line"><a name="l01222"></a><span class="lineno"> 1222</span>  <span class="comment">// Skip PT_LINLINE_EQUATION and non text type.</span></div><div class="line"><a name="l01223"></a><span class="lineno"> 1223</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faa52ce81f771512916e01215965910fc6">PT_INLINE_EQUATION</a> ||</div><div class="line"><a name="l01224"></a><span class="lineno"> 1224</span>  (!<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>()) &&</div><div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>  part-><a class="code" href="a04570.html#a5ce26bd79f510a828e566d37a3abd8de">blob_type</a>() != <a class="code" href="a00224.html#aebfaf711760a99b60c297d1d619df575a56cc149e97b34634dd39babda79ea17d">BRT_HLINE</a>)) {</div><div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>  skip_part = <span class="keyword">true</span>;</div><div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a class="code" href="a02246.html#a612dd0f3c9191b1614d62e2c6f758cda">IsNearSmallNeighbor</a>(seed_box, part_box) ||</div><div class="line"><a name="l01228"></a><span class="lineno"> 1228</span>  !<a class="code" href="a02246.html#a2a4aa2332c4dcd111ab373696d6e0558">CheckSeedNeighborDensity</a>(part)) {</div><div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>  <span class="comment">// For other types, it should be the near small neighbor of seed.</span></div><div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>  skip_part = <span class="keyword">true</span>;</div><div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>  }</div><div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>  } <span class="keywordflow">else</span> { <span class="comment">// Equation type, check the x overlap.</span></div><div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>  <span class="keywordflow">if</span> (part_box.x_overlap_fraction(seed_box) < kXOverlapTh &&</div><div class="line"><a name="l01234"></a><span class="lineno"> 1234</span>  seed_box.x_overlap_fraction(part_box) < kXOverlapTh) {</div><div class="line"><a name="l01235"></a><span class="lineno"> 1235</span>  skip_part = <span class="keyword">true</span>;</div><div class="line"><a name="l01236"></a><span class="lineno"> 1236</span>  }</div><div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>  }</div><div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>  <span class="keywordflow">if</span> (skip_part) {</div><div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() != <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>) {</div><div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>  <span class="keywordflow">if</span> (skipped_min_top > part_box.top()) {</div><div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>  skipped_min_top = part_box.<a class="code" href="a02610.html#a5dc64d0677b5d65385bc07a78cf49c4d">top</a>();</div><div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>  }</div><div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>  <span class="keywordflow">if</span> (skipped_max_bottom < part_box.bottom()) {</div><div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>  skipped_max_bottom = part_box.bottom();</div><div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>  }</div><div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>  }</div><div class="line"><a name="l01247"></a><span class="lineno"> 1247</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01248"></a><span class="lineno"> 1248</span>  parts.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l01249"></a><span class="lineno"> 1249</span>  }</div><div class="line"><a name="l01250"></a><span class="lineno"> 1250</span>  }</div><div class="line"><a name="l01251"></a><span class="lineno"> 1251</span> </div><div class="line"><a name="l01252"></a><span class="lineno"> 1252</span>  <span class="comment">// For every part in parts, we need verify it is not above skipped_min_top</span></div><div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>  <span class="comment">// when search top, or not below skipped_max_bottom when search bottom. I.e.,</span></div><div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>  <span class="comment">// we will skip a part if it looks like:</span></div><div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>  <span class="comment">// search bottom | search top</span></div><div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>  <span class="comment">// seed: ****************** | part: **********</span></div><div class="line"><a name="l01257"></a><span class="lineno"> 1257</span>  <span class="comment">// skipped: xxx | skipped: xxx</span></div><div class="line"><a name="l01258"></a><span class="lineno"> 1258</span>  <span class="comment">// part: ********** | seed: ***********</span></div><div class="line"><a name="l01259"></a><span class="lineno"> 1259</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < parts.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); i++) {</div><div class="line"><a name="l01260"></a><span class="lineno"> 1260</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(parts[i]->bounding_box());</div><div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>  <span class="keywordflow">if</span> ((search_bottom && part_box.<a class="code" href="a02610.html#a5dc64d0677b5d65385bc07a78cf49c4d">top</a>() <= skipped_max_bottom) ||</div><div class="line"><a name="l01262"></a><span class="lineno"> 1262</span>  (!search_bottom && part_box.<a class="code" href="a02610.html#a9fee4521e71300975cb34ebb21e3fca5">bottom</a>() >= skipped_min_top)) {</div><div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>  }</div><div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>  <span class="comment">// Add parts[i] into parts_to_merge, and delete it from part_grid_.</span></div><div class="line"><a name="l01266"></a><span class="lineno"> 1266</span>  parts_to_merge-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(parts[i]);</div><div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>  <a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>-><a class="code" href="a04514.html#adc713153c1282d8727f85ee6d38d7d31">RemoveBBox</a>(parts[i]);</div><div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>  }</div><div class="line"><a name="l01269"></a><span class="lineno"> 1269</span> }</div><div class="line"><a name="l01270"></a><span class="lineno"> 1270</span> </div><div class="line"><a name="l01271"></a><span class="lineno"><a class="line" href="a02246.html#a612dd0f3c9191b1614d62e2c6f758cda"> 1271</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#a612dd0f3c9191b1614d62e2c6f758cda">EquationDetect::IsNearSmallNeighbor</a>(<span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& seed_box,</div><div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box)<span class="keyword"> const </span>{</div><div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kXGapTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(0.25 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>));</div><div class="line"><a name="l01274"></a><span class="lineno"> 1274</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kYGapTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(0.05 * <a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a>));</div><div class="line"><a name="l01275"></a><span class="lineno"> 1275</span> </div><div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>  <span class="comment">// Check geometric feature.</span></div><div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>  <span class="keywordflow">if</span> (part_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>() > seed_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>() ||</div><div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>  part_box.<a class="code" href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">width</a>() > seed_box.<a class="code" href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">width</a>()) {</div><div class="line"><a name="l01279"></a><span class="lineno"> 1279</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l01280"></a><span class="lineno"> 1280</span>  }</div><div class="line"><a name="l01281"></a><span class="lineno"> 1281</span> </div><div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>  <span class="comment">// Check overlap and distance.</span></div><div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>  <span class="keywordflow">if</span> ((!part_box.<a class="code" href="a02610.html#ade947e3871fa316e3e0b0864905c2997">major_x_overlap</a>(seed_box) ||</div><div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>  part_box.<a class="code" href="a02610.html#a8f6f816c4e4d792863563d2d4368db8d">y_gap</a>(seed_box) > kYGapTh) &&</div><div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>  (!part_box.<a class="code" href="a02610.html#aeb70c6954b557eda9f21eaa74dcc2928">major_y_overlap</a>(seed_box) ||</div><div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>  part_box.<a class="code" href="a02610.html#aee399b6542ff4856b2ea343bf202d2a3">x_gap</a>(seed_box) > kXGapTh)) {</div><div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>  }</div><div class="line"><a name="l01289"></a><span class="lineno"> 1289</span> </div><div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l01291"></a><span class="lineno"> 1291</span> }</div><div class="line"><a name="l01292"></a><span class="lineno"> 1292</span> </div><div class="line"><a name="l01293"></a><span class="lineno"><a class="line" href="a02246.html#a2a4aa2332c4dcd111ab373696d6e0558"> 1293</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#a2a4aa2332c4dcd111ab373696d6e0558">EquationDetect::CheckSeedNeighborDensity</a>(<span class="keyword">const</span> <a class="code" href="a04570.html">ColPartition</a>* part)<span class="keyword"> const </span>{</div><div class="line"><a name="l01294"></a><span class="lineno"> 1294</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part);</div><div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2ad3b1e781a208614d52e263a28c1e00">boxes_count</a>() < <a class="code" href="a01629.html#a113f000461790e1cd1c397f382814da5">kSeedBlobsCountTh</a>) {</div><div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>  <span class="comment">// Too few blobs, skip the check.</span></div><div class="line"><a name="l01297"></a><span class="lineno"> 1297</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>  }</div><div class="line"><a name="l01299"></a><span class="lineno"> 1299</span> </div><div class="line"><a name="l01300"></a><span class="lineno"> 1300</span>  <span class="comment">// We check the math blobs density and the unclear blobs density.</span></div><div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a15d65b1f982ad6eab996c44e846528fe">SpecialBlobsDensity</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca356056d522254adc40c8acdf14f19c4d">BSTT_MATH</a>) +</div><div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>  part-><a class="code" href="a04570.html#a15d65b1f982ad6eab996c44e846528fe">SpecialBlobsDensity</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8caaf28e2df284d1c1c8caf262b5fcdb3f4">BSTT_DIGIT</a>) > <a class="code" href="a01629.html#ad996502770c51cc260e4d66db9543bcc">kMathDigitDensityTh1</a> ||</div><div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>  part-><a class="code" href="a04570.html#a15d65b1f982ad6eab996c44e846528fe">SpecialBlobsDensity</a>(<a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8ca604529fa299b8dcc81b0ac07ebb2c9b7">BSTT_UNCLEAR</a>) > <a class="code" href="a01629.html#a07a51423879204a025d373c6ae40fba5">kUnclearDensityTh</a>) {</div><div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>  }</div><div class="line"><a name="l01306"></a><span class="lineno"> 1306</span> </div><div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l01308"></a><span class="lineno"> 1308</span> }</div><div class="line"><a name="l01309"></a><span class="lineno"> 1309</span> </div><div class="line"><a name="l01310"></a><span class="lineno"><a class="line" href="a02246.html#a0bb5b44fbab44c93cb338eed35b4ef4a"> 1310</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a0bb5b44fbab44c93cb338eed35b4ef4a">EquationDetect::ProcessMathBlockSatelliteParts</a>() {</div><div class="line"><a name="l01311"></a><span class="lineno"> 1311</span>  <span class="comment">// Iterate over part_grid_, and find all parts that are text type but not</span></div><div class="line"><a name="l01312"></a><span class="lineno"> 1312</span>  <span class="comment">// equation type.</span></div><div class="line"><a name="l01313"></a><span class="lineno"> 1313</span>  <a class="code" href="a04570.html">ColPartition</a> *part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> text_parts;</div><div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> gsearch(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>  gsearch.<a class="code" href="a04502.html#ad7f7e99bcda5e0daeb682b772e445f60">StartFullSearch</a>();</div><div class="line"><a name="l01317"></a><span class="lineno"> 1317</span>  <span class="keywordflow">while</span> ((part = gsearch.<a class="code" href="a04502.html#ae9cd15b1815e744caf0650320aecfc2c">NextFullSearch</a>()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faaa63d8d8a99ddc2b3957f8e8787b4eca">PT_FLOWING_TEXT</a> || part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fa47f25d4065407dd98db92554ca54468b">PT_HEADING_TEXT</a>) {</div><div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>  text_parts.<a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(part);</div><div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>  }</div><div class="line"><a name="l01321"></a><span class="lineno"> 1321</span>  }</div><div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>  <span class="keywordflow">if</span> (text_parts.<a class="code" href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">empty</a>()) {</div><div class="line"><a name="l01323"></a><span class="lineno"> 1323</span>  <span class="keywordflow">return</span>;</div><div class="line"><a name="l01324"></a><span class="lineno"> 1324</span>  }</div><div class="line"><a name="l01325"></a><span class="lineno"> 1325</span> </div><div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>  <span class="comment">// Compute the medium height of the text_parts.</span></div><div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>  text_parts.<a class="code" href="a02182.html#a999bbd8ff336c81fe1198ea714c7936d">sort</a>(&SortCPByHeight);</div><div class="line"><a name="l01328"></a><span class="lineno"> 1328</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& text_box = text_parts[text_parts.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() / 2]->bounding_box();</div><div class="line"><a name="l01329"></a><span class="lineno"> 1329</span>  <span class="keywordtype">int</span> med_height = text_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>();</div><div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>  <span class="keywordflow">if</span> (text_parts.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() % 2 == 0 && text_parts.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() > 1) {</div><div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& text_box =</div><div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>  text_parts[text_parts.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>() / 2 - 1]->bounding_box();</div><div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>  med_height = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(</div><div class="line"><a name="l01334"></a><span class="lineno"> 1334</span>  0.5 * (text_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>() + med_height)));</div><div class="line"><a name="l01335"></a><span class="lineno"> 1335</span>  }</div><div class="line"><a name="l01336"></a><span class="lineno"> 1336</span> </div><div class="line"><a name="l01337"></a><span class="lineno"> 1337</span>  <span class="comment">// Iterate every text_parts and check if it is a math block satellite.</span></div><div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < text_parts.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++i) {</div><div class="line"><a name="l01339"></a><span class="lineno"> 1339</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& text_box(text_parts[i]->bounding_box());</div><div class="line"><a name="l01340"></a><span class="lineno"> 1340</span>  <span class="keywordflow">if</span> (text_box.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>() > med_height) {</div><div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>  }</div><div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>  <a class="code" href="a02182.html">GenericVector<ColPartition*></a> math_blocks;</div><div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>  <span class="keywordflow">if</span> (!<a class="code" href="a02246.html#a1c99268537c018c0622559c2d988b600">IsMathBlockSatellite</a>(text_parts[i], &math_blocks)) {</div><div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01346"></a><span class="lineno"> 1346</span>  }</div><div class="line"><a name="l01347"></a><span class="lineno"> 1347</span> </div><div class="line"><a name="l01348"></a><span class="lineno"> 1348</span>  <span class="comment">// Found. merge text_parts[i] with math_blocks.</span></div><div class="line"><a name="l01349"></a><span class="lineno"> 1349</span>  <a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>-><a class="code" href="a04514.html#adc713153c1282d8727f85ee6d38d7d31">RemoveBBox</a>(text_parts[i]);</div><div class="line"><a name="l01350"></a><span class="lineno"> 1350</span>  text_parts[i]->set_type(<a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>);</div><div class="line"><a name="l01351"></a><span class="lineno"> 1351</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < math_blocks.<a class="code" href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">size</a>(); ++j) {</div><div class="line"><a name="l01352"></a><span class="lineno"> 1352</span>  <a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>-><a class="code" href="a04514.html#adc713153c1282d8727f85ee6d38d7d31">RemoveBBox</a>(math_blocks[j]);</div><div class="line"><a name="l01353"></a><span class="lineno"> 1353</span>  text_parts[i]->Absorb(math_blocks[j], <span class="keyword">nullptr</span>);</div><div class="line"><a name="l01354"></a><span class="lineno"> 1354</span>  }</div><div class="line"><a name="l01355"></a><span class="lineno"> 1355</span>  <a class="code" href="a02246.html#a5f75b1dad656abfdb1a10eddeb8e65de">InsertPartAfterAbsorb</a>(text_parts[i]);</div><div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>  }</div><div class="line"><a name="l01357"></a><span class="lineno"> 1357</span> }</div><div class="line"><a name="l01358"></a><span class="lineno"> 1358</span> </div><div class="line"><a name="l01359"></a><span class="lineno"><a class="line" href="a02246.html#a1c99268537c018c0622559c2d988b600"> 1359</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#a1c99268537c018c0622559c2d988b600">EquationDetect::IsMathBlockSatellite</a>(</div><div class="line"><a name="l01360"></a><span class="lineno"> 1360</span>  <a class="code" href="a04570.html">ColPartition</a>* part, <a class="code" href="a02182.html">GenericVector<ColPartition*></a>* math_blocks) {</div><div class="line"><a name="l01361"></a><span class="lineno"> 1361</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part != <span class="keyword">nullptr</span> && math_blocks != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l01362"></a><span class="lineno"> 1362</span>  math_blocks-><a class="code" href="a02182.html#a9cdbff49b186574b83e43afba606fdd9">clear</a>();</div><div class="line"><a name="l01363"></a><span class="lineno"> 1363</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l01364"></a><span class="lineno"> 1364</span>  <span class="comment">// Find the top/bottom nearest neighbor of part.</span></div><div class="line"><a name="l01365"></a><span class="lineno"> 1365</span>  <a class="code" href="a04570.html">ColPartition</a> *neighbors[2];</div><div class="line"><a name="l01366"></a><span class="lineno"> 1366</span>  <span class="keywordtype">int</span> y_gaps[2] = {std::numeric_limits<int>::max(), std::numeric_limits<int>::max()};</div><div class="line"><a name="l01367"></a><span class="lineno"> 1367</span>  <span class="comment">// The horizontal boundary of the neighbors.</span></div><div class="line"><a name="l01368"></a><span class="lineno"> 1368</span>  <span class="keywordtype">int</span> neighbors_left = std::numeric_limits<int>::max(), neighbors_right = 0;</div><div class="line"><a name="l01369"></a><span class="lineno"> 1369</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < 2; ++i) {</div><div class="line"><a name="l01370"></a><span class="lineno"> 1370</span>  neighbors[i] = <a class="code" href="a02246.html#a60bd749e3e2b016058ba4ece1e1dc80c">SearchNNVertical</a>(i != 0, part);</div><div class="line"><a name="l01371"></a><span class="lineno"> 1371</span>  <span class="keywordflow">if</span> (neighbors[i]) {</div><div class="line"><a name="l01372"></a><span class="lineno"> 1372</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& neighbor_box = neighbors[i]->bounding_box();</div><div class="line"><a name="l01373"></a><span class="lineno"> 1373</span>  y_gaps[i] = neighbor_box.<a class="code" href="a02610.html#a8f6f816c4e4d792863563d2d4368db8d">y_gap</a>(part_box);</div><div class="line"><a name="l01374"></a><span class="lineno"> 1374</span>  <span class="keywordflow">if</span> (neighbor_box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>() < neighbors_left) {</div><div class="line"><a name="l01375"></a><span class="lineno"> 1375</span>  neighbors_left = neighbor_box.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>();</div><div class="line"><a name="l01376"></a><span class="lineno"> 1376</span>  }</div><div class="line"><a name="l01377"></a><span class="lineno"> 1377</span>  <span class="keywordflow">if</span> (neighbor_box.<a class="code" href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">right</a>() > neighbors_right) {</div><div class="line"><a name="l01378"></a><span class="lineno"> 1378</span>  neighbors_right = neighbor_box.<a class="code" href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">right</a>();</div><div class="line"><a name="l01379"></a><span class="lineno"> 1379</span>  }</div><div class="line"><a name="l01380"></a><span class="lineno"> 1380</span>  }</div><div class="line"><a name="l01381"></a><span class="lineno"> 1381</span>  }</div><div class="line"><a name="l01382"></a><span class="lineno"> 1382</span>  <span class="keywordflow">if</span> (neighbors[0] == neighbors[1]) {</div><div class="line"><a name="l01383"></a><span class="lineno"> 1383</span>  <span class="comment">// This happens when part is inside neighbor.</span></div><div class="line"><a name="l01384"></a><span class="lineno"> 1384</span>  neighbors[1] = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l01385"></a><span class="lineno"> 1385</span>  y_gaps[1] = std::numeric_limits<int>::max();</div><div class="line"><a name="l01386"></a><span class="lineno"> 1386</span>  }</div><div class="line"><a name="l01387"></a><span class="lineno"> 1387</span> </div><div class="line"><a name="l01388"></a><span class="lineno"> 1388</span>  <span class="comment">// Check if part is within [neighbors_left, neighbors_right].</span></div><div class="line"><a name="l01389"></a><span class="lineno"> 1389</span>  <span class="keywordflow">if</span> (part_box.left() < neighbors_left || part_box.right() > neighbors_right) {</div><div class="line"><a name="l01390"></a><span class="lineno"> 1390</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l01391"></a><span class="lineno"> 1391</span>  }</div><div class="line"><a name="l01392"></a><span class="lineno"> 1392</span> </div><div class="line"><a name="l01393"></a><span class="lineno"> 1393</span>  <span class="comment">// Get the index of the near one in neighbors.</span></div><div class="line"><a name="l01394"></a><span class="lineno"> 1394</span>  <span class="keywordtype">int</span> index = y_gaps[0] < y_gaps[1] ? 0 : 1;</div><div class="line"><a name="l01395"></a><span class="lineno"> 1395</span> </div><div class="line"><a name="l01396"></a><span class="lineno"> 1396</span>  <span class="comment">// Check the near one.</span></div><div class="line"><a name="l01397"></a><span class="lineno"> 1397</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#a2e0946b3dfee7b6dee5c38c591e34270">IsNearMathNeighbor</a>(y_gaps[index], neighbors[index])) {</div><div class="line"><a name="l01398"></a><span class="lineno"> 1398</span>  math_blocks-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(neighbors[index]);</div><div class="line"><a name="l01399"></a><span class="lineno"> 1399</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01400"></a><span class="lineno"> 1400</span>  <span class="comment">// If the near one failed the check, then we skip checking the far one.</span></div><div class="line"><a name="l01401"></a><span class="lineno"> 1401</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l01402"></a><span class="lineno"> 1402</span>  }</div><div class="line"><a name="l01403"></a><span class="lineno"> 1403</span> </div><div class="line"><a name="l01404"></a><span class="lineno"> 1404</span>  <span class="comment">// Check the far one.</span></div><div class="line"><a name="l01405"></a><span class="lineno"> 1405</span>  index = 1 - index;</div><div class="line"><a name="l01406"></a><span class="lineno"> 1406</span>  <span class="keywordflow">if</span> (<a class="code" href="a02246.html#a2e0946b3dfee7b6dee5c38c591e34270">IsNearMathNeighbor</a>(y_gaps[index], neighbors[index])) {</div><div class="line"><a name="l01407"></a><span class="lineno"> 1407</span>  math_blocks-><a class="code" href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">push_back</a>(neighbors[index]);</div><div class="line"><a name="l01408"></a><span class="lineno"> 1408</span>  }</div><div class="line"><a name="l01409"></a><span class="lineno"> 1409</span> </div><div class="line"><a name="l01410"></a><span class="lineno"> 1410</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l01411"></a><span class="lineno"> 1411</span> }</div><div class="line"><a name="l01412"></a><span class="lineno"> 1412</span> </div><div class="line"><a name="l01413"></a><span class="lineno"><a class="line" href="a02246.html#a60bd749e3e2b016058ba4ece1e1dc80c"> 1413</a></span> <a class="code" href="a04570.html">ColPartition</a>* <a class="code" href="a02246.html#a60bd749e3e2b016058ba4ece1e1dc80c">EquationDetect::SearchNNVertical</a>(</div><div class="line"><a name="l01414"></a><span class="lineno"> 1414</span>  <span class="keyword">const</span> <span class="keywordtype">bool</span> search_bottom, <span class="keyword">const</span> <a class="code" href="a04570.html">ColPartition</a>* part) {</div><div class="line"><a name="l01415"></a><span class="lineno"> 1415</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part);</div><div class="line"><a name="l01416"></a><span class="lineno"> 1416</span>  <a class="code" href="a04570.html">ColPartition</a> *nearest_neighbor = <span class="keyword">nullptr</span>, *neighbor = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l01417"></a><span class="lineno"> 1417</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kYGapTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(<a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a> * 0.5));</div><div class="line"><a name="l01418"></a><span class="lineno"> 1418</span> </div><div class="line"><a name="l01419"></a><span class="lineno"> 1419</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l01420"></a><span class="lineno"> 1420</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.SetUniqueMode(<span class="keyword">true</span>);</div><div class="line"><a name="l01421"></a><span class="lineno"> 1421</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& part_box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l01422"></a><span class="lineno"> 1422</span>  <span class="keywordtype">int</span> y = search_bottom ? part_box.<a class="code" href="a02610.html#a9fee4521e71300975cb34ebb21e3fca5">bottom</a>() : part_box.top();</div><div class="line"><a name="l01423"></a><span class="lineno"> 1423</span>  <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.StartVerticalSearch(part_box.left(), part_box.right(), y);</div><div class="line"><a name="l01424"></a><span class="lineno"> 1424</span>  <span class="keywordtype">int</span> min_y_gap = std::numeric_limits<int>::max();</div><div class="line"><a name="l01425"></a><span class="lineno"> 1425</span>  <span class="keywordflow">while</span> ((neighbor = <a class="code" href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a>.NextVerticalSearch(search_bottom)) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l01426"></a><span class="lineno"> 1426</span>  <span class="keywordflow">if</span> (neighbor == part || !<a class="code" href="a01629.html#a1aff6897e170c358d7672413b3c221de">IsTextOrEquationType</a>(neighbor->type())) {</div><div class="line"><a name="l01427"></a><span class="lineno"> 1427</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01428"></a><span class="lineno"> 1428</span>  }</div><div class="line"><a name="l01429"></a><span class="lineno"> 1429</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& neighbor_box(neighbor->bounding_box());</div><div class="line"><a name="l01430"></a><span class="lineno"> 1430</span>  <span class="keywordtype">int</span> y_gap = neighbor_box.<a class="code" href="a02610.html#a8f6f816c4e4d792863563d2d4368db8d">y_gap</a>(part_box);</div><div class="line"><a name="l01431"></a><span class="lineno"> 1431</span>  <span class="keywordflow">if</span> (y_gap > kYGapTh) { <span class="comment">// Out of scope.</span></div><div class="line"><a name="l01432"></a><span class="lineno"> 1432</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l01433"></a><span class="lineno"> 1433</span>  }</div><div class="line"><a name="l01434"></a><span class="lineno"> 1434</span>  <span class="keywordflow">if</span> (!neighbor_box.major_x_overlap(part_box) ||</div><div class="line"><a name="l01435"></a><span class="lineno"> 1435</span>  (search_bottom && neighbor_box.bottom() > part_box.bottom()) ||</div><div class="line"><a name="l01436"></a><span class="lineno"> 1436</span>  (!search_bottom && neighbor_box.top() < part_box.top())) {</div><div class="line"><a name="l01437"></a><span class="lineno"> 1437</span>  <span class="keywordflow">continue</span>;</div><div class="line"><a name="l01438"></a><span class="lineno"> 1438</span>  }</div><div class="line"><a name="l01439"></a><span class="lineno"> 1439</span>  <span class="keywordflow">if</span> (y_gap < min_y_gap) {</div><div class="line"><a name="l01440"></a><span class="lineno"> 1440</span>  min_y_gap = y_gap;</div><div class="line"><a name="l01441"></a><span class="lineno"> 1441</span>  nearest_neighbor = neighbor;</div><div class="line"><a name="l01442"></a><span class="lineno"> 1442</span>  }</div><div class="line"><a name="l01443"></a><span class="lineno"> 1443</span>  }</div><div class="line"><a name="l01444"></a><span class="lineno"> 1444</span> </div><div class="line"><a name="l01445"></a><span class="lineno"> 1445</span>  <span class="keywordflow">return</span> nearest_neighbor;</div><div class="line"><a name="l01446"></a><span class="lineno"> 1446</span> }</div><div class="line"><a name="l01447"></a><span class="lineno"> 1447</span> </div><div class="line"><a name="l01448"></a><span class="lineno"><a class="line" href="a02246.html#a2e0946b3dfee7b6dee5c38c591e34270"> 1448</a></span> <span class="keywordtype">bool</span> <a class="code" href="a02246.html#a2e0946b3dfee7b6dee5c38c591e34270">EquationDetect::IsNearMathNeighbor</a>(</div><div class="line"><a name="l01449"></a><span class="lineno"> 1449</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> y_gap, <span class="keyword">const</span> <a class="code" href="a04570.html">ColPartition</a> *neighbor)<span class="keyword"> const </span>{</div><div class="line"><a name="l01450"></a><span class="lineno"> 1450</span>  <span class="keywordflow">if</span> (!neighbor) {</div><div class="line"><a name="l01451"></a><span class="lineno"> 1451</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l01452"></a><span class="lineno"> 1452</span>  }</div><div class="line"><a name="l01453"></a><span class="lineno"> 1453</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> kYGapTh = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(roundf(<a class="code" href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">resolution_</a> * 0.1));</div><div class="line"><a name="l01454"></a><span class="lineno"> 1454</span>  <span class="keywordflow">return</span> neighbor-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a> && y_gap <= kYGapTh;</div><div class="line"><a name="l01455"></a><span class="lineno"> 1455</span> }</div><div class="line"><a name="l01456"></a><span class="lineno"> 1456</span> </div><div class="line"><a name="l01457"></a><span class="lineno"><a class="line" href="a02246.html#a0c05543fe14374e0ecbbcd40568ef318"> 1457</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a0c05543fe14374e0ecbbcd40568ef318">EquationDetect::GetOutputTiffName</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* name,</div><div class="line"><a name="l01458"></a><span class="lineno"> 1458</span>  <a class="code" href="a02834.html">STRING</a>* image_name)<span class="keyword"> const </span>{</div><div class="line"><a name="l01459"></a><span class="lineno"> 1459</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(image_name && name);</div><div class="line"><a name="l01460"></a><span class="lineno"> 1460</span>  <span class="keywordtype">char</span> page[50];</div><div class="line"><a name="l01461"></a><span class="lineno"> 1461</span>  snprintf(page, <span class="keyword">sizeof</span>(page), <span class="stringliteral">"%04d"</span>, <a class="code" href="a02246.html#aec76c4ef860f40ec042c65ea1340fc31">page_count_</a>);</div><div class="line"><a name="l01462"></a><span class="lineno"> 1462</span>  *image_name = <a class="code" href="a02834.html">STRING</a>(<a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02666.html#a83b53925c7f421533b5f382c9a36ab1d">imagebasename</a>) + page + name + <span class="stringliteral">".tif"</span>;</div><div class="line"><a name="l01463"></a><span class="lineno"> 1463</span> }</div><div class="line"><a name="l01464"></a><span class="lineno"> 1464</span> </div><div class="line"><a name="l01465"></a><span class="lineno"><a class="line" href="a02246.html#a56443e2bab5cd7a0376dbd8e05fe7bdd"> 1465</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#a56443e2bab5cd7a0376dbd8e05fe7bdd">EquationDetect::PaintSpecialTexts</a>(<span class="keyword">const</span> <a class="code" href="a02834.html">STRING</a>& outfile)<span class="keyword"> const </span>{</div><div class="line"><a name="l01466"></a><span class="lineno"> 1466</span>  Pix *pix = <span class="keyword">nullptr</span>, *pixBi = <a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02358.html#ae6daf71366bf37ae460f95c5d9cad11b">pix_binary</a>();</div><div class="line"><a name="l01467"></a><span class="lineno"> 1467</span>  pix = pixConvertTo32(pixBi);</div><div class="line"><a name="l01468"></a><span class="lineno"> 1468</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> gsearch(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l01469"></a><span class="lineno"> 1469</span>  <a class="code" href="a04570.html">ColPartition</a>* part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l01470"></a><span class="lineno"> 1470</span>  gsearch.<a class="code" href="a04502.html#ad7f7e99bcda5e0daeb682b772e445f60">StartFullSearch</a>();</div><div class="line"><a name="l01471"></a><span class="lineno"> 1471</span>  <span class="keywordflow">while</span> ((part = gsearch.<a class="code" href="a04502.html#ae9cd15b1815e744caf0650320aecfc2c">NextFullSearch</a>()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l01472"></a><span class="lineno"> 1472</span>  BLOBNBOX_C_IT blob_it(part-><a class="code" href="a04570.html#a3fc2dd797ede7a62546b2565811e9ce0">boxes</a>());</div><div class="line"><a name="l01473"></a><span class="lineno"> 1473</span>  <span class="keywordflow">for</span> (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {</div><div class="line"><a name="l01474"></a><span class="lineno"> 1474</span>  <a class="code" href="a04594.html#a135d1cd23d326e3e8f64e7e3255e8e0d">RenderSpecialText</a>(pix, blob_it.data());</div><div class="line"><a name="l01475"></a><span class="lineno"> 1475</span>  }</div><div class="line"><a name="l01476"></a><span class="lineno"> 1476</span>  }</div><div class="line"><a name="l01477"></a><span class="lineno"> 1477</span> </div><div class="line"><a name="l01478"></a><span class="lineno"> 1478</span>  pixWrite(outfile.<a class="code" href="a02834.html#abf0a7b3c6ae39a46e5441f28f61de5de">string</a>(), pix, IFF_TIFF_LZW);</div><div class="line"><a name="l01479"></a><span class="lineno"> 1479</span>  pixDestroy(&pix);</div><div class="line"><a name="l01480"></a><span class="lineno"> 1480</span> }</div><div class="line"><a name="l01481"></a><span class="lineno"> 1481</span> </div><div class="line"><a name="l01482"></a><span class="lineno"><a class="line" href="a02246.html#ada4df5ef0eee657cfeb7524205ce878a"> 1482</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ada4df5ef0eee657cfeb7524205ce878a">EquationDetect::PaintColParts</a>(<span class="keyword">const</span> <a class="code" href="a02834.html">STRING</a>& outfile)<span class="keyword"> const </span>{</div><div class="line"><a name="l01483"></a><span class="lineno"> 1483</span>  Pix *pix = pixConvertTo32(<a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02358.html#aec5d4e081fee6da40258b0b074342205">BestPix</a>());</div><div class="line"><a name="l01484"></a><span class="lineno"> 1484</span>  <a class="code" href="a04502.html">ColPartitionGridSearch</a> gsearch(<a class="code" href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">part_grid_</a>);</div><div class="line"><a name="l01485"></a><span class="lineno"> 1485</span>  gsearch.StartFullSearch();</div><div class="line"><a name="l01486"></a><span class="lineno"> 1486</span>  <a class="code" href="a04570.html">ColPartition</a>* part = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l01487"></a><span class="lineno"> 1487</span>  <span class="keywordflow">while</span> ((part = gsearch.NextFullSearch()) != <span class="keyword">nullptr</span>) {</div><div class="line"><a name="l01488"></a><span class="lineno"> 1488</span>  <span class="keyword">const</span> <a class="code" href="a02610.html">TBOX</a>& tbox = part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>();</div><div class="line"><a name="l01489"></a><span class="lineno"> 1489</span>  Box *box = boxCreate(tbox.<a class="code" href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">left</a>(), pixGetHeight(pix) - tbox.<a class="code" href="a02610.html#a5dc64d0677b5d65385bc07a78cf49c4d">top</a>(),</div><div class="line"><a name="l01490"></a><span class="lineno"> 1490</span>  tbox.<a class="code" href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">width</a>(), tbox.<a class="code" href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">height</a>());</div><div class="line"><a name="l01491"></a><span class="lineno"> 1491</span>  <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a>) {</div><div class="line"><a name="l01492"></a><span class="lineno"> 1492</span>  pixRenderBoxArb(pix, box, 5, 255, 0, 0);</div><div class="line"><a name="l01493"></a><span class="lineno"> 1493</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (part-><a class="code" href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">type</a>() == <a class="code" href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faa52ce81f771512916e01215965910fc6">PT_INLINE_EQUATION</a>) {</div><div class="line"><a name="l01494"></a><span class="lineno"> 1494</span>  pixRenderBoxArb(pix, box, 5, 0, 255, 0);</div><div class="line"><a name="l01495"></a><span class="lineno"> 1495</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l01496"></a><span class="lineno"> 1496</span>  pixRenderBoxArb(pix, box, 5, 0, 0, 255);</div><div class="line"><a name="l01497"></a><span class="lineno"> 1497</span>  }</div><div class="line"><a name="l01498"></a><span class="lineno"> 1498</span>  boxDestroy(&box);</div><div class="line"><a name="l01499"></a><span class="lineno"> 1499</span>  }</div><div class="line"><a name="l01500"></a><span class="lineno"> 1500</span> </div><div class="line"><a name="l01501"></a><span class="lineno"> 1501</span>  pixWrite(outfile.<a class="code" href="a02834.html#abf0a7b3c6ae39a46e5441f28f61de5de">string</a>(), pix, IFF_TIFF_LZW);</div><div class="line"><a name="l01502"></a><span class="lineno"> 1502</span>  pixDestroy(&pix);</div><div class="line"><a name="l01503"></a><span class="lineno"> 1503</span> }</div><div class="line"><a name="l01504"></a><span class="lineno"> 1504</span> </div><div class="line"><a name="l01505"></a><span class="lineno"><a class="line" href="a02246.html#ad7ae4f58197c854689b69df45e77352d"> 1505</a></span> <span class="keywordtype">void</span> <a class="code" href="a02246.html#ad7ae4f58197c854689b69df45e77352d">EquationDetect::PrintSpecialBlobsDensity</a>(<span class="keyword">const</span> <a class="code" href="a04570.html">ColPartition</a>* part)<span class="keyword"> const </span>{</div><div class="line"><a name="l01506"></a><span class="lineno"> 1506</span>  <a class="code" href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a>(part);</div><div class="line"><a name="l01507"></a><span class="lineno"> 1507</span>  <a class="code" href="a02610.html">TBOX</a> box(part-><a class="code" href="a04570.html#ace1af5fcf071bd32673ae20f85514809">bounding_box</a>());</div><div class="line"><a name="l01508"></a><span class="lineno"> 1508</span>  <span class="keywordtype">int</span> h = pixGetHeight(<a class="code" href="a02246.html#ac9825c046385d42504424a69d3b56177">lang_tesseract_</a>-><a class="code" href="a02358.html#aec5d4e081fee6da40258b0b074342205">BestPix</a>());</div><div class="line"><a name="l01509"></a><span class="lineno"> 1509</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"Printing special blobs density values for ColParition (t=%d,b=%d) "</span>,</div><div class="line"><a name="l01510"></a><span class="lineno"> 1510</span>  h - box.top(), h - box.bottom());</div><div class="line"><a name="l01511"></a><span class="lineno"> 1511</span>  box.print();</div><div class="line"><a name="l01512"></a><span class="lineno"> 1512</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"blobs count = %d, density = "</span>, part-><a class="code" href="a04570.html#a2ad3b1e781a208614d52e263a28c1e00">boxes_count</a>());</div><div class="line"><a name="l01513"></a><span class="lineno"> 1513</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8caceba184627df3dabc8f3e3f2867c4eff">BSTT_COUNT</a>; ++i) {</div><div class="line"><a name="l01514"></a><span class="lineno"> 1514</span>  <a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8c">BlobSpecialTextType</a> type = <span class="keyword">static_cast<</span><a class="code" href="a00224.html#a75b089d27e1df813fed544e0c131df8c">BlobSpecialTextType</a><span class="keyword">></span>(i);</div><div class="line"><a name="l01515"></a><span class="lineno"> 1515</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"%d:%f "</span>, i, part-><a class="code" href="a04570.html#a15d65b1f982ad6eab996c44e846528fe">SpecialBlobsDensity</a>(type));</div><div class="line"><a name="l01516"></a><span class="lineno"> 1516</span>  }</div><div class="line"><a name="l01517"></a><span class="lineno"> 1517</span>  <a class="code" href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a>(<span class="stringliteral">"\n"</span>);</div><div class="line"><a name="l01518"></a><span class="lineno"> 1518</span> }</div><div class="line"><a name="l01519"></a><span class="lineno"> 1519</span> </div><div class="line"><a name="l01520"></a><span class="lineno"> 1520</span> } <span class="comment">// namespace tesseract</span></div><div class="ttc" id="a04502_html_ae43afa517cd9b682f10ca1d54dad4ab0"><div class="ttname"><a href="a04502.html#ae43afa517cd9b682f10ca1d54dad4ab0">tesseract::GridSearch::RepositionIterator</a></div><div class="ttdeci">void RepositionIterator()</div><div class="ttdef"><b>Definition:</b> <a href="a01091_source.html#l00894">bbgrid.h:894</a></div></div>
<div class="ttc" id="a00224_html_a75b089d27e1df813fed544e0c131df8ca1e2ca6a59ce1487c101d4605eab44b7a"><div class="ttname"><a href="a00224.html#a75b089d27e1df813fed544e0c131df8ca1e2ca6a59ce1487c101d4605eab44b7a">BSTT_NONE</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00098">blobbox.h:98</a></div></div>
<div class="ttc" id="a00083_html_ab3821a15abf7ddbf050f01af5138a7ec"><div class="ttname"><a href="a00083.html#ab3821a15abf7ddbf050f01af5138a7ec">equationdetect_save_bi_image</a></div><div class="ttdeci">bool equationdetect_save_bi_image</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00046">equationdetect.cpp:46</a></div></div>
<div class="ttc" id="a02610_html_aeb70c6954b557eda9f21eaa74dcc2928"><div class="ttname"><a href="a02610.html#aeb70c6954b557eda9f21eaa74dcc2928">TBOX::major_y_overlap</a></div><div class="ttdeci">bool major_y_overlap(const TBOX &box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00439">rect.h:439</a></div></div>
<div class="ttc" id="a02246_html_a8348581de747f0ddedd47c852b36a4ae"><div class="ttname"><a href="a02246.html#a8348581de747f0ddedd47c852b36a4ae">tesseract::EquationDetect::CountAlignment</a></div><div class="ttdeci">int CountAlignment(const GenericVector< int > &sorted_vec, const int val) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00760">equationdetect.cpp:760</a></div></div>
<div class="ttc" id="a02246_html_ad9ff76cd1e7f4e25c37da5b9eb04b94c"><div class="ttname"><a href="a02246.html#ad9ff76cd1e7f4e25c37da5b9eb04b94c">tesseract::EquationDetect::SplitCPHor</a></div><div class="ttdeci">void SplitCPHor(ColPartition *part, GenericVector< ColPartition *> *parts_splitted)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00648">equationdetect.cpp:648</a></div></div>
<div class="ttc" id="a04502_html"><div class="ttname"><a href="a04502.html">tesseract::GridSearch</a></div><div class="ttdef"><b>Definition:</b> <a href="a01091_source.html#l00049">bbgrid.h:49</a></div></div>
<div class="ttc" id="a02602_html_a32e1cb6ffd5a422c29da3557d826fa3c"><div class="ttname"><a href="a02602.html#a32e1cb6ffd5a422c29da3557d826fa3c">BLOB_CHOICE::certainty</a></div><div class="ttdeci">float certainty() const</div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00083">ratngs.h:83</a></div></div>
<div class="ttc" id="a00605_html_afedceee7ea132dae3d224db2cf8b5618"><div class="ttname"><a href="a00605.html#afedceee7ea132dae3d224db2cf8b5618">UNICHAR_ID</a></div><div class="ttdeci">int UNICHAR_ID</div><div class="ttdef"><b>Definition:</b> <a href="a00605_source.html#l00035">unichar.h:35</a></div></div>
<div class="ttc" id="a02398_html_a7b6051e1c1934265a91e1ee864bd5164"><div class="ttname"><a href="a02398.html#a7b6051e1c1934265a91e1ee864bd5164">TBLOB::PolygonalCopy</a></div><div class="ttdeci">static TBLOB * PolygonalCopy(bool allow_detailed_fx, C_BLOB *src)</div><div class="ttdef"><b>Definition:</b> <a href="a00227_source.html#l00337">blobs.cpp:337</a></div></div>
<div class="ttc" id="a02246_html_a89b2d841680f6f6207fc4f10b8d7839f"><div class="ttname"><a href="a02246.html#a89b2d841680f6f6207fc4f10b8d7839f">tesseract::EquationDetect::IdentifyInlineParts</a></div><div class="ttdeci">void IdentifyInlineParts()</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00784">equationdetect.cpp:784</a></div></div>
<div class="ttc" id="a02182_html_a20cfad5c58c50cb85a9529d8ddbd96af"><div class="ttname"><a href="a02182.html#a20cfad5c58c50cb85a9529d8ddbd96af">GenericVector::size</a></div><div class="ttdeci">int size() const</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00071">genericvector.h:71</a></div></div>
<div class="ttc" id="a03950_html_a4b8a480ae40b5ead314b25f95a5dc490"><div class="ttname"><a href="a03950.html#a4b8a480ae40b5ead314b25f95a5dc490">UNICHARSET::get_ispunctuation</a></div><div class="ttdeci">bool get_ispunctuation(UNICHAR_ID unichar_id) const</div><div class="ttdef"><b>Definition:</b> <a href="a00623_source.html#l00514">unicharset.h:514</a></div></div>
<div class="ttc" id="a02246_html_a0c05543fe14374e0ecbbcd40568ef318"><div class="ttname"><a href="a02246.html#a0c05543fe14374e0ecbbcd40568ef318">tesseract::EquationDetect::GetOutputTiffName</a></div><div class="ttdeci">void GetOutputTiffName(const char *name, STRING *image_name) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01457">equationdetect.cpp:1457</a></div></div>
<div class="ttc" id="a01629_html_a8a161b61eb46383ddad93473fb3d8749"><div class="ttname"><a href="a01629.html#a8a161b61eb46383ddad93473fb3d8749">tesseract::IsRightIndented</a></div><div class="ttdeci">bool IsRightIndented(const EquationDetect::IndentType type)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00098">equationdetect.cpp:98</a></div></div>
<div class="ttc" id="a00191_html"><div class="ttname"><a href="a00191.html">tesseractclass.h</a></div></div>
<div class="ttc" id="a00557_html_a442e7f541a050acf5ebda026db177877"><div class="ttname"><a href="a00557.html#a442e7f541a050acf5ebda026db177877">BOOL_VAR</a></div><div class="ttdeci">#define BOOL_VAR(name, val, comment)</div><div class="ttdef"><b>Definition:</b> <a href="a00557_source.html#l00279">params.h:279</a></div></div>
<div class="ttc" id="a02602_html"><div class="ttname"><a href="a02602.html">BLOB_CHOICE</a></div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00049">ratngs.h:49</a></div></div>
<div class="ttc" id="a00527_html"><div class="ttname"><a href="a00527.html">helpers.h</a></div></div>
<div class="ttc" id="a02246_html_ab4f5bf2daf3f1ab5332c879ef98e5008"><div class="ttname"><a href="a02246.html#ab4f5bf2daf3f1ab5332c879ef98e5008">tesseract::EquationDetect::IdentifyBlobsToSkip</a></div><div class="ttdeci">void IdentifyBlobsToSkip(ColPartition *part)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00311">equationdetect.cpp:311</a></div></div>
<div class="ttc" id="a03998_html_a746dbbd1c99e99f3d213077cceedf80e"><div class="ttname"><a href="a03998.html#a746dbbd1c99e99f3d213077cceedf80e">tesseract::Classify::tess_cn_matching</a></div><div class="ttdeci">bool tess_cn_matching</div><div class="ttdef"><b>Definition:</b> <a href="a00659_source.html#l00448">classify.h:448</a></div></div>
<div class="ttc" id="a02246_html_a4aa9c0126e15827ea9c66319558d2fb9"><div class="ttname"><a href="a02246.html#a4aa9c0126e15827ea9c66319558d2fb9">tesseract::EquationDetect::ComputeForegroundDensity</a></div><div class="ttdeci">float ComputeForegroundDensity(const TBOX &tbox)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00612">equationdetect.cpp:612</a></div></div>
<div class="ttc" id="a02182_html_a999bbd8ff336c81fe1198ea714c7936d"><div class="ttname"><a href="a02182.html#a999bbd8ff336c81fe1198ea714c7936d">GenericVector::sort</a></div><div class="ttdeci">void sort()</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l01065">genericvector.h:1065</a></div></div>
<div class="ttc" id="a00401_html"><div class="ttname"><a href="a00401.html">ratngs.h</a></div></div>
<div class="ttc" id="a04502_html_ae9cd15b1815e744caf0650320aecfc2c"><div class="ttname"><a href="a04502.html#ae9cd15b1815e744caf0650320aecfc2c">tesseract::GridSearch::NextFullSearch</a></div><div class="ttdeci">BBC * NextFullSearch()</div><div class="ttdef"><b>Definition:</b> <a href="a01091_source.html#l00677">bbgrid.h:677</a></div></div>
<div class="ttc" id="a03998_html_a62597f182a5e23c3b8a030c06e699e99"><div class="ttname"><a href="a03998.html#a62597f182a5e23c3b8a030c06e699e99">tesseract::Classify::get_fontinfo_table</a></div><div class="ttdeci">UnicityTable< FontInfo > & get_fontinfo_table()</div><div class="ttdef"><b>Definition:</b> <a href="a00659_source.html#l00386">classify.h:386</a></div></div>
<div class="ttc" id="a02246_html_a8af35d2174dc3814a0e895115b4b4223a4c2d65f544868a206cf72cd4928c8d06"><div class="ttname"><a href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a4c2d65f544868a206cf72cd4928c8d06">tesseract::EquationDetect::BOTH_INDENT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00049">equationdetect.h:49</a></div></div>
<div class="ttc" id="a02610_html_a8f6f816c4e4d792863563d2d4368db8d"><div class="ttname"><a href="a02610.html#a8f6f816c4e4d792863563d2d4368db8d">TBOX::y_gap</a></div><div class="ttdeci">int y_gap(const TBOX &box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00233">rect.h:233</a></div></div>
<div class="ttc" id="a04570_html_afe2aa83dbca82f86d2499c2adf6f394c"><div class="ttname"><a href="a04570.html#afe2aa83dbca82f86d2499c2adf6f394c">tesseract::ColPartition::median_width</a></div><div class="ttdeci">int median_width() const</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00143">colpartition.h:143</a></div></div>
<div class="ttc" id="a00659_html"><div class="ttname"><a href="a00659.html">classify.h</a></div></div>
<div class="ttc" id="a02834_html_abf0a7b3c6ae39a46e5441f28f61de5de"><div class="ttname"><a href="a02834.html#abf0a7b3c6ae39a46e5441f28f61de5de">STRING::string</a></div><div class="ttdeci">const char * string() const</div><div class="ttdef"><b>Definition:</b> <a href="a00581_source.html#l00196">strngs.cpp:196</a></div></div>
<div class="ttc" id="a00878_html_acd4ea858d7133e40518e0832ff9d94b2"><div class="ttname"><a href="a00878.html#acd4ea858d7133e40518e0832ff9d94b2">count</a></div><div class="ttdeci">int count(LIST var_list)</div><div class="ttdef"><b>Definition:</b> <a href="a00878_source.html#l00098">oldlist.cpp:98</a></div></div>
<div class="ttc" id="a03998_html_ab39a42222f621c9a5f1bd1b31db3a930"><div class="ttname"><a href="a03998.html#ab39a42222f621c9a5f1bd1b31db3a930">tesseract::Classify::AdaptiveClassifier</a></div><div class="ttdeci">void AdaptiveClassifier(TBLOB *Blob, BLOB_CHOICE_LIST *Choices)</div><div class="ttdef"><b>Definition:</b> <a href="a00647_source.html#l00192">adaptmatch.cpp:192</a></div></div>
<div class="ttc" id="a02246_html_af6d40cc16252ebeba9458c3d5946b5f9"><div class="ttname"><a href="a02246.html#af6d40cc16252ebeba9458c3d5946b5f9">tesseract::EquationDetect::LabelSpecialText</a></div><div class="ttdeci">int LabelSpecialText(TO_BLOCK *to_block)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00132">equationdetect.cpp:132</a></div></div>
<div class="ttc" id="a04570_html_a5ce26bd79f510a828e566d37a3abd8de"><div class="ttname"><a href="a04570.html#a5ce26bd79f510a828e566d37a3abd8de">tesseract::ColPartition::blob_type</a></div><div class="ttdeci">BlobRegionType blob_type() const</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00149">colpartition.h:149</a></div></div>
<div class="ttc" id="a00224_html_a75b089d27e1df813fed544e0c131df8ca604529fa299b8dcc81b0ac07ebb2c9b7"><div class="ttname"><a href="a00224.html#a75b089d27e1df813fed544e0c131df8ca604529fa299b8dcc81b0ac07ebb2c9b7">BSTT_UNCLEAR</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00102">blobbox.h:102</a></div></div>
<div class="ttc" id="a00224_html_aebfaf711760a99b60c297d1d619df575a56cc149e97b34634dd39babda79ea17d"><div class="ttname"><a href="a00224.html#aebfaf711760a99b60c297d1d619df575a56cc149e97b34634dd39babda79ea17d">BRT_HLINE</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00075">blobbox.h:75</a></div></div>
<div class="ttc" id="a02666_html_a83b53925c7f421533b5f382c9a36ab1d"><div class="ttname"><a href="a02666.html#a83b53925c7f421533b5f382c9a36ab1d">tesseract::CCUtil::imagebasename</a></div><div class="ttdeci">STRING imagebasename</div><div class="ttdef"><b>Definition:</b> <a href="a00476_source.html#l00065">ccutil.h:65</a></div></div>
<div class="ttc" id="a00083_html_a5c4a2fdf13d6975e77cffaa102f74b37"><div class="ttname"><a href="a00083.html#a5c4a2fdf13d6975e77cffaa102f74b37">equationdetect_save_seed_image</a></div><div class="ttdeci">bool equationdetect_save_seed_image</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00048">equationdetect.cpp:48</a></div></div>
<div class="ttc" id="a01139_html"><div class="ttname"><a href="a01139.html">colpartitionset.h</a></div></div>
<div class="ttc" id="a01091_html"><div class="ttname"><a href="a01091.html">bbgrid.h</a></div></div>
<div class="ttc" id="a02246_html_aded5530c6cdae80194a4ec70104d9889"><div class="ttname"><a href="a02246.html#aded5530c6cdae80194a4ec70104d9889">tesseract::EquationDetect::SetLangTesseract</a></div><div class="ttdeci">void SetLangTesseract(Tesseract *lang_tesseract)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00124">equationdetect.cpp:124</a></div></div>
<div class="ttc" id="a00224_html_aebfaf711760a99b60c297d1d619df575"><div class="ttname"><a href="a00224.html#aebfaf711760a99b60c297d1d619df575">BlobRegionType</a></div><div class="ttdeci">BlobRegionType</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00073">blobbox.h:73</a></div></div>
<div class="ttc" id="a02246_html_a9f0be32790e5915d579cd1898530fb6b"><div class="ttname"><a href="a02246.html#a9f0be32790e5915d579cd1898530fb6b">tesseract::EquationDetect::IsInline</a></div><div class="ttdeci">bool IsInline(const bool search_bottom, const int textPartsLineSpacing, ColPartition *part)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00937">equationdetect.cpp:937</a></div></div>
<div class="ttc" id="a00014_html_a02cfd8369d5ad8c70a8b90c0f40d677fa47f25d4065407dd98db92554ca54468b"><div class="ttname"><a href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fa47f25d4065407dd98db92554ca54468b">PT_HEADING_TEXT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00014_source.html#l00099">capi.h:99</a></div></div>
<div class="ttc" id="a02610_html"><div class="ttname"><a href="a02610.html">TBOX</a></div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00034">rect.h:34</a></div></div>
<div class="ttc" id="a00224_html_a75b089d27e1df813fed544e0c131df8ca356056d522254adc40c8acdf14f19c4d"><div class="ttname"><a href="a00224.html#a75b089d27e1df813fed544e0c131df8ca356056d522254adc40c8acdf14f19c4d">BSTT_MATH</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00101">blobbox.h:101</a></div></div>
<div class="ttc" id="a01127_html"><div class="ttname"><a href="a01127.html">colpartition.h</a></div></div>
<div class="ttc" id="a02246_html_ac9825c046385d42504424a69d3b56177"><div class="ttname"><a href="a02246.html#ac9825c046385d42504424a69d3b56177">tesseract::EquationDetect::lang_tesseract_</a></div><div class="ttdeci">Tesseract * lang_tesseract_</div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00248">equationdetect.h:248</a></div></div>
<div class="ttc" id="a00083_html_a6a58c01b3dc1775eb9566e7151be8389"><div class="ttname"><a href="a00083.html#a6a58c01b3dc1775eb9566e7151be8389">equationdetect_save_spt_image</a></div><div class="ttdeci">bool equationdetect_save_spt_image</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00047">equationdetect.cpp:47</a></div></div>
<div class="ttc" id="a02246_html_a2a1d7cd57ac4ed59a38ffd3b476dd2bf"><div class="ttname"><a href="a02246.html#a2a1d7cd57ac4ed59a38ffd3b476dd2bf">tesseract::EquationDetect::CheckForSeed2</a></div><div class="ttdeci">bool CheckForSeed2(const GenericVector< int > &indented_texts_left, const float foreground_density_th, ColPartition *part)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00738">equationdetect.cpp:738</a></div></div>
<div class="ttc" id="a00314_html_af974e6755e636c8bc7cbe57e3bcbdd73"><div class="ttname"><a href="a00314.html#af974e6755e636c8bc7cbe57e3bcbdd73">kBlnXHeight</a></div><div class="ttdeci">const int kBlnXHeight</div><div class="ttdef"><b>Definition:</b> <a href="a00314_source.html#l00024">normalis.h:24</a></div></div>
<div class="ttc" id="a00380_html_a03566528a98c079dafeebf00502f2b60"><div class="ttname"><a href="a00380.html#a03566528a98c079dafeebf00502f2b60">PolyBlockType</a></div><div class="ttdeci">PolyBlockType</div><div class="ttdef"><b>Definition:</b> <a href="a00380_source.html#l00053">publictypes.h:53</a></div></div>
<div class="ttc" id="a02246_html_a0bb5b44fbab44c93cb338eed35b4ef4a"><div class="ttname"><a href="a02246.html#a0bb5b44fbab44c93cb338eed35b4ef4a">tesseract::EquationDetect::ProcessMathBlockSatelliteParts</a></div><div class="ttdeci">void ProcessMathBlockSatelliteParts()</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01310">equationdetect.cpp:1310</a></div></div>
<div class="ttc" id="a04594_html_a135d1cd23d326e3e8f64e7e3255e8e0d"><div class="ttname"><a href="a04594.html#a135d1cd23d326e3e8f64e7e3255e8e0d">tesseract::EquationDetectBase::RenderSpecialText</a></div><div class="ttdeci">static void RenderSpecialText(Pix *pix, BLOBNBOX *blob)</div><div class="ttdef"><b>Definition:</b> <a href="a01172_source.html#l00031">equationdetectbase.cpp:31</a></div></div>
<div class="ttc" id="a03950_html_aeb2253dcb5f01c81fcba5f4af417eadf"><div class="ttname"><a href="a03950.html#aeb2253dcb5f01c81fcba5f4af417eadf">UNICHARSET::unichar_to_id</a></div><div class="ttdeci">UNICHAR_ID unichar_to_id(const char *const unichar_repr) const</div><div class="ttdef"><b>Definition:</b> <a href="a00620_source.html#l00209">unicharset.cpp:209</a></div></div>
<div class="ttc" id="a00014_html_a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45"><div class="ttname"><a href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677fadfde914b43bcf45b29f149fa4415bf45">PT_EQUATION</a></div><div class="ttdef"><b>Definition:</b> <a href="a00014_source.html#l00099">capi.h:99</a></div></div>
<div class="ttc" id="a02610_html_aee399b6542ff4856b2ea343bf202d2a3"><div class="ttname"><a href="a02610.html#aee399b6542ff4856b2ea343bf202d2a3">TBOX::x_gap</a></div><div class="ttdeci">int x_gap(const TBOX &box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00225">rect.h:225</a></div></div>
<div class="ttc" id="a02246_html_ae97d45cf4e1e79c132831151d66fb662"><div class="ttname"><a href="a02246.html#ae97d45cf4e1e79c132831151d66fb662">tesseract::EquationDetect::resolution_</a></div><div class="ttdeci">int resolution_</div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00266">equationdetect.h:266</a></div></div>
<div class="ttc" id="a04570_html_a15d65b1f982ad6eab996c44e846528fe"><div class="ttname"><a href="a04570.html#a15d65b1f982ad6eab996c44e846528fe">tesseract::ColPartition::SpecialBlobsDensity</a></div><div class="ttdeci">float SpecialBlobsDensity(const BlobSpecialTextType type) const</div><div class="ttdef"><b>Definition:</b> <a href="a01124_source.html#l00566">colpartition.cpp:566</a></div></div>
<div class="ttc" id="a00314_html_abe10ce41bf7240ae8a053dea471d6ed5"><div class="ttname"><a href="a00314.html#abe10ce41bf7240ae8a053dea471d6ed5">kBlnBaselineOffset</a></div><div class="ttdeci">const int kBlnBaselineOffset</div><div class="ttdef"><b>Definition:</b> <a href="a00314_source.html#l00025">normalis.h:25</a></div></div>
<div class="ttc" id="a01629_html_a113f000461790e1cd1c397f382814da5"><div class="ttname"><a href="a01629.html#a113f000461790e1cd1c397f382814da5">tesseract::kSeedBlobsCountTh</a></div><div class="ttdeci">const int kSeedBlobsCountTh</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00085">equationdetect.cpp:85</a></div></div>
<div class="ttc" id="a00224_html_aa72f1499398e9694bf46752e1cc895e1"><div class="ttname"><a href="a00224.html#aa72f1499398e9694bf46752e1cc895e1">BlobTextFlowType</a></div><div class="ttdeci">BlobTextFlowType</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00115">blobbox.h:115</a></div></div>
<div class="ttc" id="a04570_html_abfa13ecb273fa29166a663daf82a2254"><div class="ttname"><a href="a04570.html#abfa13ecb273fa29166a663daf82a2254">tesseract::ColPartition::SetBlobTypes</a></div><div class="ttdeci">void SetBlobTypes()</div><div class="ttdef"><b>Definition:</b> <a href="a01124_source.html#l01276">colpartition.cpp:1276</a></div></div>
<div class="ttc" id="a00224_html_a75b089d27e1df813fed544e0c131df8c"><div class="ttname"><a href="a00224.html#a75b089d27e1df813fed544e0c131df8c">BlobSpecialTextType</a></div><div class="ttdeci">BlobSpecialTextType</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00097">blobbox.h:97</a></div></div>
<div class="ttc" id="a02246_html_a8af35d2174dc3814a0e895115b4b4223aab75a5b0799710a14abdda1687c1ae0e"><div class="ttname"><a href="a02246.html#a8af35d2174dc3814a0e895115b4b4223aab75a5b0799710a14abdda1687c1ae0e">tesseract::EquationDetect::LEFT_INDENT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00047">equationdetect.h:47</a></div></div>
<div class="ttc" id="a03950_html_a620c3ec802c8ddf9401a6940f542618e"><div class="ttname"><a href="a03950.html#a620c3ec802c8ddf9401a6940f542618e">UNICHARSET::get_isalpha</a></div><div class="ttdeci">bool get_isalpha(UNICHAR_ID unichar_id) const</div><div class="ttdef"><b>Definition:</b> <a href="a00623_source.html#l00486">unicharset.h:486</a></div></div>
<div class="ttc" id="a02246_html_a2e0946b3dfee7b6dee5c38c591e34270"><div class="ttname"><a href="a02246.html#a2e0946b3dfee7b6dee5c38c591e34270">tesseract::EquationDetect::IsNearMathNeighbor</a></div><div class="ttdeci">bool IsNearMathNeighbor(const int y_gap, const ColPartition *neighbor) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01448">equationdetect.cpp:1448</a></div></div>
<div class="ttc" id="a02246_html_ace94a05a89afb074b106c444584254d6"><div class="ttname"><a href="a02246.html#ace94a05a89afb074b106c444584254d6">tesseract::EquationDetect::SearchByOverlap</a></div><div class="ttdeci">void SearchByOverlap(ColPartition *seed, GenericVector< ColPartition *> *parts_overlap)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00464">equationdetect.cpp:464</a></div></div>
<div class="ttc" id="a02246_html_a1e62860539cd17573c8f8d8aaf4a07e2"><div class="ttname"><a href="a02246.html#a1e62860539cd17573c8f8d8aaf4a07e2">tesseract::EquationDetect::SetResolution</a></div><div class="ttdeci">void SetResolution(const int resolution)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00128">equationdetect.cpp:128</a></div></div>
<div class="ttc" id="a04570_html_aedb906fb73709c79d702f0f95a85b300"><div class="ttname"><a href="a04570.html#aedb906fb73709c79d702f0f95a85b300">tesseract::ColPartition::Absorb</a></div><div class="ttdeci">void Absorb(ColPartition *other, WidthCallback *cb)</div><div class="ttdef"><b>Definition:</b> <a href="a01124_source.html#l00648">colpartition.cpp:648</a></div></div>
<div class="ttc" id="a02246_html_a60bd749e3e2b016058ba4ece1e1dc80c"><div class="ttname"><a href="a02246.html#a60bd749e3e2b016058ba4ece1e1dc80c">tesseract::EquationDetect::SearchNNVertical</a></div><div class="ttdeci">ColPartition * SearchNNVertical(const bool search_bottom, const ColPartition *part)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01413">equationdetect.cpp:1413</a></div></div>
<div class="ttc" id="a01629_html_a1aff6897e170c358d7672413b3c221de"><div class="ttname"><a href="a01629.html#a1aff6897e170c358d7672413b3c221de">tesseract::IsTextOrEquationType</a></div><div class="ttdeci">bool IsTextOrEquationType(PolyBlockType type)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00089">equationdetect.cpp:89</a></div></div>
<div class="ttc" id="a02246_html_a8de69a1f250877609333539286e6914a"><div class="ttname"><a href="a02246.html#a8de69a1f250877609333539286e6914a">tesseract::EquationDetect::ComputeCPsSuperBBox</a></div><div class="ttdeci">void ComputeCPsSuperBBox()</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00792">equationdetect.cpp:792</a></div></div>
<div class="ttc" id="a02602_html_a8f65937e4611000f52b89235dcc28d7f"><div class="ttname"><a href="a02602.html#a8f65937e4611000f52b89235dcc28d7f">BLOB_CHOICE::fontinfo_id</a></div><div class="ttdeci">int16_t fontinfo_id() const</div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00086">ratngs.h:86</a></div></div>
<div class="ttc" id="a03950_html"><div class="ttname"><a href="a03950.html">UNICHARSET</a></div><div class="ttdef"><b>Definition:</b> <a href="a00623_source.html#l00146">unicharset.h:146</a></div></div>
<div class="ttc" id="a02358_html_aec5d4e081fee6da40258b0b074342205"><div class="ttname"><a href="a02358.html#aec5d4e081fee6da40258b0b074342205">tesseract::Tesseract::BestPix</a></div><div class="ttdeci">Pix * BestPix() const</div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l00229">tesseractclass.h:229</a></div></div>
<div class="ttc" id="a02610_html_a4eadffcf205164157624bc934adcd144"><div class="ttname"><a href="a02610.html#a4eadffcf205164157624bc934adcd144">TBOX::x_overlap_fraction</a></div><div class="ttdeci">double x_overlap_fraction(const TBOX &box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00457">rect.h:457</a></div></div>
<div class="ttc" id="a02246_html_aec76c4ef860f40ec042c65ea1340fc31"><div class="ttname"><a href="a02246.html#aec76c4ef860f40ec042c65ea1340fc31">tesseract::EquationDetect::page_count_</a></div><div class="ttdeci">int page_count_</div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00269">equationdetect.h:269</a></div></div>
<div class="ttc" id="a02246_html_a35912b69ed5ffa28d88ed53ba9f060d3"><div class="ttname"><a href="a02246.html#a35912b69ed5ffa28d88ed53ba9f060d3">tesseract::EquationDetect::IsIndented</a></div><div class="ttdeci">IndentType IsIndented(ColPartition *part)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01021">equationdetect.cpp:1021</a></div></div>
<div class="ttc" id="a03998_html_a406c1644ce61dfb376ae9975f89c54ba"><div class="ttname"><a href="a03998.html#a406c1644ce61dfb376ae9975f89c54ba">tesseract::Classify::classify_class_pruner_multiplier</a></div><div class="ttdeci">int classify_class_pruner_multiplier</div><div class="ttdef"><b>Definition:</b> <a href="a00659_source.html#l00506">classify.h:506</a></div></div>
<div class="ttc" id="a04570_html_a3fc2dd797ede7a62546b2565811e9ce0"><div class="ttname"><a href="a04570.html#a3fc2dd797ede7a62546b2565811e9ce0">tesseract::ColPartition::boxes</a></div><div class="ttdeci">BLOBNBOX_CLIST * boxes()</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00188">colpartition.h:188</a></div></div>
<div class="ttc" id="a02182_html_a9cdbff49b186574b83e43afba606fdd9"><div class="ttname"><a href="a02182.html#a9cdbff49b186574b83e43afba606fdd9">GenericVector::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00868">genericvector.h:868</a></div></div>
<div class="ttc" id="a02610_html_a70ef69630cbdc605b7b7d5434549d38c"><div class="ttname"><a href="a02610.html#a70ef69630cbdc605b7b7d5434549d38c">TBOX::width</a></div><div class="ttdeci">int16_t width() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00115">rect.h:115</a></div></div>
<div class="ttc" id="a04570_html_a67554d4553f198980b504091557442c7"><div class="ttname"><a href="a04570.html#a67554d4553f198980b504091557442c7">tesseract::ColPartition::set_blob_type</a></div><div class="ttdeci">void set_blob_type(BlobRegionType t)</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00152">colpartition.h:152</a></div></div>
<div class="ttc" id="a04570_html_aff449be10b9bb6e480b65cd1042e38e4"><div class="ttname"><a href="a04570.html#aff449be10b9bb6e480b65cd1042e38e4">tesseract::ColPartition::set_flow</a></div><div class="ttdeci">void set_flow(BlobTextFlowType f)</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00158">colpartition.h:158</a></div></div>
<div class="ttc" id="a02358_html_a1267fb55994276b60fa5f5a34f508135"><div class="ttname"><a href="a02358.html#a1267fb55994276b60fa5f5a34f508135">tesseract::Tesseract::init_tesseract</a></div><div class="ttdeci">int init_tesseract(const char *arg0, const char *textbase, const char *language, OcrEngineMode oem, char **configs, int configs_size, const GenericVector< STRING > *vars_vec, const GenericVector< STRING > *vars_values, bool set_only_init_params, TessdataManager *mgr)</div><div class="ttdef"><b>Definition:</b> <a href="a00182_source.html#l00296">tessedit.cpp:296</a></div></div>
<div class="ttc" id="a02246_html_a39c1397a958168add27d1a4bbc3ff916"><div class="ttname"><a href="a02246.html#a39c1397a958168add27d1a4bbc3ff916">tesseract::EquationDetect::IdentifySeedParts</a></div><div class="ttdeci">void IdentifySeedParts()</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00540">equationdetect.cpp:540</a></div></div>
<div class="ttc" id="a02610_html_a8e9dce0d30d2213598cd4befe0028c99"><div class="ttname"><a href="a02610.html#a8e9dce0d30d2213598cd4befe0028c99">TBOX::left</a></div><div class="ttdeci">int16_t left() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00072">rect.h:72</a></div></div>
<div class="ttc" id="a02246_html_a488adea749ff34ca6f2efc000c82001d"><div class="ttname"><a href="a02246.html#a488adea749ff34ca6f2efc000c82001d">tesseract::EquationDetect::EstimateTypeForUnichar</a></div><div class="ttdeci">BlobSpecialTextType EstimateTypeForUnichar(const UNICHARSET &unicharset, const UNICHAR_ID id) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00225">equationdetect.cpp:225</a></div></div>
<div class="ttc" id="a04570_html"><div class="ttname"><a href="a04570.html">tesseract::ColPartition</a></div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00068">colpartition.h:68</a></div></div>
<div class="ttc" id="a02610_html_a5dc64d0677b5d65385bc07a78cf49c4d"><div class="ttname"><a href="a02610.html#a5dc64d0677b5d65385bc07a78cf49c4d">TBOX::top</a></div><div class="ttdeci">int16_t top() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00058">rect.h:58</a></div></div>
<div class="ttc" id="a01629_html_a2a82022958d051af0fb624095c3ada00"><div class="ttname"><a href="a01629.html#a2a82022958d051af0fb624095c3ada00">tesseract::kMathDigitDensityTh2</a></div><div class="ttdeci">const float kMathDigitDensityTh2</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00082">equationdetect.cpp:82</a></div></div>
<div class="ttc" id="a03950_html_a98079b3ce062183388c653eee9838e3c"><div class="ttname"><a href="a03950.html#a98079b3ce062183388c653eee9838e3c">UNICHARSET::get_isdigit</a></div><div class="ttdeci">bool get_isdigit(UNICHAR_ID unichar_id) const</div><div class="ttdef"><b>Definition:</b> <a href="a00623_source.html#l00507">unicharset.h:507</a></div></div>
<div class="ttc" id="a02382_html"><div class="ttname"><a href="a02382.html">TO_BLOCK</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00705">blobbox.h:705</a></div></div>
<div class="ttc" id="a02182_html"><div class="ttname"><a href="a02182.html">GenericVector</a></div><div class="ttdef"><b>Definition:</b> <a href="a00008_source.html#l00037">baseapi.h:37</a></div></div>
<div class="ttc" id="a02246_html_a657f367e87724bfab6359c42f10fad66"><div class="ttname"><a href="a02246.html#a657f367e87724bfab6359c42f10fad66">tesseract::EquationDetect::IdentifyInlinePartsVertical</a></div><div class="ttdeci">void IdentifyInlinePartsVertical(const bool top_to_bottom, const int textPartsLineSpacing)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00908">equationdetect.cpp:908</a></div></div>
<div class="ttc" id="a02246_html_a4a19110ed5696ad383849388f1d7cb6f"><div class="ttname"><a href="a02246.html#a4a19110ed5696ad383849388f1d7cb6f">tesseract::EquationDetect::equ_tesseract_</a></div><div class="ttdeci">Tesseract equ_tesseract_</div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00244">equationdetect.h:244</a></div></div>
<div class="ttc" id="a02182_html_a8c261f66a24da67aac1acca7aa8f650a"><div class="ttname"><a href="a02182.html#a8c261f66a24da67aac1acca7aa8f650a">GenericVector::bool_binary_search</a></div><div class="ttdeci">bool bool_binary_search(const T &target) const</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00238">genericvector.h:238</a></div></div>
<div class="ttc" id="a00224_html_a75b089d27e1df813fed544e0c131df8caaf28e2df284d1c1c8caf262b5fcdb3f4"><div class="ttname"><a href="a00224.html#a75b089d27e1df813fed544e0c131df8caaf28e2df284d1c1c8caf262b5fcdb3f4">BSTT_DIGIT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00100">blobbox.h:100</a></div></div>
<div class="ttc" id="a03998_html_a85fcc9966cddbc38adf1014dd0cd778c"><div class="ttname"><a href="a03998.html#a85fcc9966cddbc38adf1014dd0cd778c">tesseract::Classify::tess_bn_matching</a></div><div class="ttdeci">bool tess_bn_matching</div><div class="ttdef"><b>Definition:</b> <a href="a00659_source.html#l00449">classify.h:449</a></div></div>
<div class="ttc" id="a02666_html_a69c5179ac5f10a24f3f97e16ca09460f"><div class="ttname"><a href="a02666.html#a69c5179ac5f10a24f3f97e16ca09460f">tesseract::CCUtil::unicharset</a></div><div class="ttdeci">UNICHARSET unicharset</div><div class="ttdef"><b>Definition:</b> <a href="a00476_source.html#l00068">ccutil.h:68</a></div></div>
<div class="ttc" id="a02398_html_a6aef0201c756ed33e68a94abc8ac2b8e"><div class="ttname"><a href="a02398.html#a6aef0201c756ed33e68a94abc8ac2b8e">TBLOB::Normalize</a></div><div class="ttdeci">void Normalize(const BLOCK *block, const FCOORD *rotation, const DENORM *predecessor, float x_origin, float y_origin, float x_scale, float y_scale, float final_xshift, float final_yshift, bool inverse, Pix *pix)</div><div class="ttdef"><b>Definition:</b> <a href="a00227_source.html#l00407">blobs.cpp:407</a></div></div>
<div class="ttc" id="a04570_html_a33427fb9a563253c69e0806115fb2a4b"><div class="ttname"><a href="a04570.html#a33427fb9a563253c69e0806115fb2a4b">tesseract::ColPartition::SplitAt</a></div><div class="ttdeci">ColPartition * SplitAt(int split_x)</div><div class="ttdef"><b>Definition:</b> <a href="a01124_source.html#l00833">colpartition.cpp:833</a></div></div>
<div class="ttc" id="a02246_html_ada4df5ef0eee657cfeb7524205ce878a"><div class="ttname"><a href="a02246.html#ada4df5ef0eee657cfeb7524205ce878a">tesseract::EquationDetect::PaintColParts</a></div><div class="ttdeci">void PaintColParts(const STRING &outfile) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01482">equationdetect.cpp:1482</a></div></div>
<div class="ttc" id="a00224_html_a75b089d27e1df813fed544e0c131df8ca6fac1a2510eab4553549833d5d1afdc0"><div class="ttname"><a href="a00224.html#a75b089d27e1df813fed544e0c131df8ca6fac1a2510eab4553549833d5d1afdc0">BSTT_SKIP</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00103">blobbox.h:103</a></div></div>
<div class="ttc" id="a02358_html_aef3ac5f0035b4a75b470e96d0cab103a"><div class="ttname"><a href="a02358.html#aef3ac5f0035b4a75b470e96d0cab103a">tesseract::Tesseract::source_resolution</a></div><div class="ttdeci">int source_resolution() const</div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l00241">tesseractclass.h:241</a></div></div>
<div class="ttc" id="a04514_html_adc713153c1282d8727f85ee6d38d7d31"><div class="ttname"><a href="a04514.html#adc713153c1282d8727f85ee6d38d7d31">tesseract::BBGrid::RemoveBBox</a></div><div class="ttdeci">void RemoveBBox(BBC *bbox)</div><div class="ttdef"><b>Definition:</b> <a href="a01091_source.html#l00535">bbgrid.h:535</a></div></div>
<div class="ttc" id="a02246_html_aac03fc4552265dd3e79fae673fa63b88"><div class="ttname"><a href="a02246.html#aac03fc4552265dd3e79fae673fa63b88">tesseract::EquationDetect::CheckSeedFgDensity</a></div><div class="ttdeci">bool CheckSeedFgDensity(const float density_th, ColPartition *part)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00626">equationdetect.cpp:626</a></div></div>
<div class="ttc" id="a02610_html_ade947e3871fa316e3e0b0864905c2997"><div class="ttname"><a href="a02610.html#ade947e3871fa316e3e0b0864905c2997">TBOX::major_x_overlap</a></div><div class="ttdeci">bool major_x_overlap(const TBOX &box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00412">rect.h:412</a></div></div>
<div class="ttc" id="a02374_html_ab8e7a33dc069de65fa4b6d0cab61d0c1"><div class="ttname"><a href="a02374.html#ab8e7a33dc069de65fa4b6d0cab61d0c1">BLOBNBOX::joined_to_prev</a></div><div class="ttdeci">bool joined_to_prev() const</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00257">blobbox.h:257</a></div></div>
<div class="ttc" id="a00527_html_ab60e4f82956a1f5fdb54d0d8303e95b7"><div class="ttname"><a href="a00527.html#ab60e4f82956a1f5fdb54d0d8303e95b7">IntCastRounded</a></div><div class="ttdeci">int IntCastRounded(double x)</div><div class="ttdef"><b>Definition:</b> <a href="a00527_source.html#l00168">helpers.h:168</a></div></div>
<div class="ttc" id="a02246_html_ae246fb4897d7e5181ff727874a9eb140"><div class="ttname"><a href="a02246.html#ae246fb4897d7e5181ff727874a9eb140">tesseract::EquationDetect::IdentifyInlinePartsHorizontal</a></div><div class="ttdeci">void IdentifyInlinePartsHorizontal()</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00803">equationdetect.cpp:803</a></div></div>
<div class="ttc" id="a02246_html_aa6dfc694549236e0be87efd3d2c8d17f"><div class="ttname"><a href="a02246.html#aa6dfc694549236e0be87efd3d2c8d17f">tesseract::EquationDetect::cps_super_bbox_</a></div><div class="ttdeci">TBOX * cps_super_bbox_</div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00260">equationdetect.h:260</a></div></div>
<div class="ttc" id="a04514_html_a7b379525e3d60c68e583352ae4b8a750"><div class="ttname"><a href="a04514.html#a7b379525e3d60c68e583352ae4b8a750">tesseract::BBGrid::InsertBBox</a></div><div class="ttdeci">void InsertBBox(bool h_spread, bool v_spread, BBC *bbox)</div><div class="ttdef"><b>Definition:</b> <a href="a01091_source.html#l00488">bbgrid.h:488</a></div></div>
<div class="ttc" id="a00878_html_a1d8af9328f064a9df6d6f88336dd054e"><div class="ttname"><a href="a00878.html#a1d8af9328f064a9df6d6f88336dd054e">search</a></div><div class="ttdeci">LIST search(LIST list, void *key, int_compare is_equal)</div><div class="ttdef"><b>Definition:</b> <a href="a00878_source.html#l00366">oldlist.cpp:366</a></div></div>
<div class="ttc" id="a02358_html_ae6daf71366bf37ae460f95c5d9cad11b"><div class="ttname"><a href="a02358.html#ae6daf71366bf37ae460f95c5d9cad11b">tesseract::Tesseract::pix_binary</a></div><div class="ttdeci">Pix * pix_binary() const</div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l00201">tesseractclass.h:201</a></div></div>
<div class="ttc" id="a02374_html_a79b752b4d1c29649d56006acb960aa13"><div class="ttname"><a href="a02374.html#a79b752b4d1c29649d56006acb960aa13">BLOBNBOX::special_text_type</a></div><div class="ttdeci">BlobSpecialTextType special_text_type() const</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00290">blobbox.h:290</a></div></div>
<div class="ttc" id="a00224_html_a75b089d27e1df813fed544e0c131df8caceba184627df3dabc8f3e3f2867c4eff"><div class="ttname"><a href="a00224.html#a75b089d27e1df813fed544e0c131df8caceba184627df3dabc8f3e3f2867c4eff">BSTT_COUNT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00104">blobbox.h:104</a></div></div>
<div class="ttc" id="a02182_html_a172c4aa23ba397e24319ae095281cbcc"><div class="ttname"><a href="a02182.html#a172c4aa23ba397e24319ae095281cbcc">GenericVector::empty</a></div><div class="ttdeci">bool empty() const</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00090">genericvector.h:90</a></div></div>
<div class="ttc" id="a04570_html_a3077eb7392f7d2ab1de2f93579fda55d"><div class="ttname"><a href="a04570.html#a3077eb7392f7d2ab1de2f93579fda55d">tesseract::ColPartition::CopyButDontOwnBlobs</a></div><div class="ttdeci">ColPartition * CopyButDontOwnBlobs()</div><div class="ttdef"><b>Definition:</b> <a href="a01124_source.html#l01769">colpartition.cpp:1769</a></div></div>
<div class="ttc" id="a00596_html_a0c2bcd4462ec67ab0971b34a0f610f55"><div class="ttname"><a href="a00596.html#a0c2bcd4462ec67ab0971b34a0f610f55">tprintf</a></div><div class="ttdeci">DLLSYM void tprintf(const char *format,...)</div><div class="ttdef"><b>Definition:</b> <a href="a00596_source.html#l00037">tprintf.cpp:37</a></div></div>
<div class="ttc" id="a02398_html_a56599f0cc0c2eb73d9c5fd490f03fc56"><div class="ttname"><a href="a02398.html#a56599f0cc0c2eb73d9c5fd490f03fc56">TBLOB::bounding_box</a></div><div class="ttdeci">TBOX bounding_box() const</div><div class="ttdef"><b>Definition:</b> <a href="a00227_source.html#l00478">blobs.cpp:478</a></div></div>
<div class="ttc" id="a02246_html_a800a94628a99a8f3e054619e170d7fbb"><div class="ttname"><a href="a02246.html#a800a94628a99a8f3e054619e170d7fbb">tesseract::EquationDetect::FindEquationParts</a></div><div class="ttdeci">int FindEquationParts(ColPartitionGrid *part_grid, ColPartitionSet **best_columns)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00359">equationdetect.cpp:359</a></div></div>
<div class="ttc" id="a02246_html_a76bc8a18a94fc5f89f6d4d073ba0c9bf"><div class="ttname"><a href="a02246.html#a76bc8a18a94fc5f89f6d4d073ba0c9bf">tesseract::EquationDetect::ExpandSeed</a></div><div class="ttdeci">bool ExpandSeed(ColPartition *seed)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01085">equationdetect.cpp:1085</a></div></div>
<div class="ttc" id="a02246_html_a5f75b1dad656abfdb1a10eddeb8e65de"><div class="ttname"><a href="a02246.html#a5f75b1dad656abfdb1a10eddeb8e65de">tesseract::EquationDetect::InsertPartAfterAbsorb</a></div><div class="ttdeci">void InsertPartAfterAbsorb(ColPartition *part)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00513">equationdetect.cpp:513</a></div></div>
<div class="ttc" id="a04506_html_ade0cdea2e618882c670c7077257a7609"><div class="ttname"><a href="a04506.html#ade0cdea2e618882c670c7077257a7609">tesseract::GridBase::GridCoords</a></div><div class="ttdeci">void GridCoords(int x, int y, int *grid_x, int *grid_y) const</div><div class="ttdef"><b>Definition:</b> <a href="a01088_source.html#l00053">bbgrid.cpp:53</a></div></div>
<div class="ttc" id="a02246_html_a4798ba96020b3ce55050b66dd3c72fe0"><div class="ttname"><a href="a02246.html#a4798ba96020b3ce55050b66dd3c72fe0">tesseract::EquationDetect::part_grid_</a></div><div class="ttdeci">ColPartitionGrid * part_grid_</div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00252">equationdetect.h:252</a></div></div>
<div class="ttc" id="a01629_html"><div class="ttname"><a href="a01629.html">tesseract</a></div><div class="ttdef"><b>Definition:</b> <a href="a00005_source.html#l00094">baseapi.cpp:94</a></div></div>
<div class="ttc" id="a00083_html_ad6fcc8bf72a1d8f1162e2dfb30d30d2f"><div class="ttname"><a href="a00083.html#ad6fcc8bf72a1d8f1162e2dfb30d30d2f">equationdetect_save_merged_image</a></div><div class="ttdeci">bool equationdetect_save_merged_image</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00049">equationdetect.cpp:49</a></div></div>
<div class="ttc" id="a02182_html_a0dc89fe2a365b04a61017f9d78c1a303"><div class="ttname"><a href="a02182.html#a0dc89fe2a365b04a61017f9d78c1a303">GenericVector::push_back</a></div><div class="ttdeci">int push_back(T object)</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00799">genericvector.h:799</a></div></div>
<div class="ttc" id="a02358_html"><div class="ttname"><a href="a02358.html">tesseract::Tesseract</a></div><div class="ttdef"><b>Definition:</b> <a href="a00191_source.html#l00173">tesseractclass.h:173</a></div></div>
<div class="ttc" id="a02246_html_ad41af69ecd3e0227bbe5b4714c429666"><div class="ttname"><a href="a02246.html#ad41af69ecd3e0227bbe5b4714c429666">tesseract::EquationDetect::cp_seeds_</a></div><div class="ttdeci">GenericVector< ColPartition * > cp_seeds_</div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00263">equationdetect.h:263</a></div></div>
<div class="ttc" id="a04570_html_a0f844b22a8ef8024a2c7eb9eed7523f3"><div class="ttname"><a href="a04570.html#a0f844b22a8ef8024a2c7eb9eed7523f3">tesseract::ColPartition::flow</a></div><div class="ttdeci">BlobTextFlowType flow() const</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00155">colpartition.h:155</a></div></div>
<div class="ttc" id="a00014_html_a02cfd8369d5ad8c70a8b90c0f40d677faaa63d8d8a99ddc2b3957f8e8787b4eca"><div class="ttname"><a href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faaa63d8d8a99ddc2b3957f8e8787b4eca">PT_FLOWING_TEXT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00014_source.html#l00099">capi.h:99</a></div></div>
<div class="ttc" id="a04570_html_ace1af5fcf071bd32673ae20f85514809"><div class="ttname"><a href="a04570.html#ace1af5fcf071bd32673ae20f85514809">tesseract::ColPartition::bounding_box</a></div><div class="ttdeci">const TBOX & bounding_box() const</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00110">colpartition.h:110</a></div></div>
<div class="ttc" id="a03998_html_acab8de2f560b04b48191f60099e4244b"><div class="ttname"><a href="a03998.html#acab8de2f560b04b48191f60099e4244b">tesseract::Classify::classify_integer_matcher_multiplier</a></div><div class="ttdeci">int classify_integer_matcher_multiplier</div><div class="ttdef"><b>Definition:</b> <a href="a00659_source.html#l00510">classify.h:510</a></div></div>
<div class="ttc" id="a02834_html"><div class="ttname"><a href="a02834.html">STRING</a></div><div class="ttdef"><b>Definition:</b> <a href="a00584_source.html#l00045">strngs.h:45</a></div></div>
<div class="ttc" id="a02634_html"><div class="ttname"><a href="a02634.html">C_BLOB</a></div><div class="ttdef"><b>Definition:</b> <a href="a00437_source.html#l00037">stepblob.h:37</a></div></div>
<div class="ttc" id="a00086_html"><div class="ttname"><a href="a00086.html">equationdetect.h</a></div></div>
<div class="ttc" id="a04578_html"><div class="ttname"><a href="a04578.html">tesseract::ColPartitionSet</a></div><div class="ttdef"><b>Definition:</b> <a href="a01139_source.html#l00040">colpartitionset.h:40</a></div></div>
<div class="ttc" id="a04570_html_a2a9ba24fa7f6735045a09857d664136f"><div class="ttname"><a href="a04570.html#a2a9ba24fa7f6735045a09857d664136f">tesseract::ColPartition::SpecialBlobsCount</a></div><div class="ttdeci">int SpecialBlobsCount(const BlobSpecialTextType type)</div><div class="ttdef"><b>Definition:</b> <a href="a01124_source.html#l00571">colpartition.cpp:571</a></div></div>
<div class="ttc" id="a02834_html_ac8c4ceca1e688adcdf188aef108dc18b"><div class="ttname"><a href="a02834.html#ac8c4ceca1e688adcdf188aef108dc18b">STRING::contains</a></div><div class="ttdeci">bool contains(const char c) const</div><div class="ttdef"><b>Definition:</b> <a href="a00581_source.html#l00187">strngs.cpp:187</a></div></div>
<div class="ttc" id="a02246_html_ad26e2adac7587d71b2a9394a4b8897a6"><div class="ttname"><a href="a02246.html#ad26e2adac7587d71b2a9394a4b8897a6">tesseract::EquationDetect::MergePartsByLocation</a></div><div class="ttdeci">void MergePartsByLocation()</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00425">equationdetect.cpp:425</a></div></div>
<div class="ttc" id="a02246_html_a8af35d2174dc3814a0e895115b4b4223a8b060953ddfce6e934e4346ba630606b"><div class="ttname"><a href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a8b060953ddfce6e934e4346ba630606b">tesseract::EquationDetect::RIGHT_INDENT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00048">equationdetect.h:48</a></div></div>
<div class="ttc" id="a02610_html_a8b532906f18f4c55055f47ec6b843608"><div class="ttname"><a href="a02610.html#a8b532906f18f4c55055f47ec6b843608">TBOX::y_overlap</a></div><div class="ttdeci">bool y_overlap(const TBOX &box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00428">rect.h:428</a></div></div>
<div class="ttc" id="a02246_html_a14f4d2d35ed292b40ce57b028d7e124a"><div class="ttname"><a href="a02246.html#a14f4d2d35ed292b40ce57b028d7e124a">tesseract::EquationDetect::CheckSeedBlobsCount</a></div><div class="ttdeci">bool CheckSeedBlobsCount(ColPartition *part)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00984">equationdetect.cpp:984</a></div></div>
<div class="ttc" id="a04570_html_acf8233abc2eb9a0b9cc6f258ddd1d04d"><div class="ttname"><a href="a04570.html#acf8233abc2eb9a0b9cc6f258ddd1d04d">tesseract::ColPartition::SetPartitionType</a></div><div class="ttdeci">void SetPartitionType(int resolution, ColPartitionSet *columns)</div><div class="ttdef"><b>Definition:</b> <a href="a01124_source.html#l00983">colpartition.cpp:983</a></div></div>
<div class="ttc" id="a02246_html_a1c99268537c018c0622559c2d988b600"><div class="ttname"><a href="a02246.html#a1c99268537c018c0622559c2d988b600">tesseract::EquationDetect::IsMathBlockSatellite</a></div><div class="ttdeci">bool IsMathBlockSatellite(ColPartition *part, GenericVector< ColPartition *> *math_blocks)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01359">equationdetect.cpp:1359</a></div></div>
<div class="ttc" id="a03950_html_aa19fb595808fe4688c580334937dfa45"><div class="ttname"><a href="a03950.html#aa19fb595808fe4688c580334937dfa45">UNICHARSET::id_to_unichar</a></div><div class="ttdeci">const char * id_to_unichar(UNICHAR_ID id) const</div><div class="ttdef"><b>Definition:</b> <a href="a00620_source.html#l00290">unicharset.cpp:290</a></div></div>
<div class="ttc" id="a02246_html_ab65b124e364901a9d93869afc923255f"><div class="ttname"><a href="a02246.html#ab65b124e364901a9d93869afc923255f">tesseract::EquationDetect::ExpandSeedVertical</a></div><div class="ttdeci">void ExpandSeedVertical(const bool search_bottom, ColPartition *seed, GenericVector< ColPartition *> *parts_to_merge)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01184">equationdetect.cpp:1184</a></div></div>
<div class="ttc" id="a02182_html_a98f62dccd75224a60437c2761bd215cd"><div class="ttname"><a href="a02182.html#a98f62dccd75224a60437c2761bd215cd">GenericVector::delete_data_pointers</a></div><div class="ttdeci">void delete_data_pointers()</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00884">genericvector.h:884</a></div></div>
<div class="ttc" id="a02246_html_a09236e0cf2e96fd341927a9dbb822f95"><div class="ttname"><a href="a02246.html#a09236e0cf2e96fd341927a9dbb822f95">tesseract::EquationDetect::~EquationDetect</a></div><div class="ttdeci">~EquationDetect()</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00122">equationdetect.cpp:122</a></div></div>
<div class="ttc" id="a00380_html_a49b7c03fb4e55b82a8fd22b7c6094082"><div class="ttname"><a href="a00380.html#a49b7c03fb4e55b82a8fd22b7c6094082">PTIsTextType</a></div><div class="ttdeci">bool PTIsTextType(PolyBlockType type)</div><div class="ttdef"><b>Definition:</b> <a href="a00380_source.html#l00082">publictypes.h:82</a></div></div>
<div class="ttc" id="a02182_html_ad561e19e75a0fb30f0118774d7fa5621"><div class="ttname"><a href="a02182.html#ad561e19e75a0fb30f0118774d7fa5621">GenericVector::binary_search</a></div><div class="ttdeci">int binary_search(const T &target) const</div><div class="ttdef"><b>Definition:</b> <a href="a00518_source.html#l00250">genericvector.h:250</a></div></div>
<div class="ttc" id="a02374_html_acc27a54c9735f05e9152ba5f1c1a8261"><div class="ttname"><a href="a02374.html#acc27a54c9735f05e9152ba5f1c1a8261">BLOBNBOX::bounding_box</a></div><div class="ttdeci">const TBOX & bounding_box() const</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00231">blobbox.h:231</a></div></div>
<div class="ttc" id="a02246_html_a2a4aa2332c4dcd111ab373696d6e0558"><div class="ttname"><a href="a02246.html#a2a4aa2332c4dcd111ab373696d6e0558">tesseract::EquationDetect::CheckSeedNeighborDensity</a></div><div class="ttdeci">bool CheckSeedNeighborDensity(const ColPartition *part) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01293">equationdetect.cpp:1293</a></div></div>
<div class="ttc" id="a04570_html_a75d93ef0688e5d2e6272dba4c5b72cee"><div class="ttname"><a href="a04570.html#a75d93ef0688e5d2e6272dba4c5b72cee">tesseract::ColPartition::IsVerticalType</a></div><div class="ttdeci">bool IsVerticalType() const</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00442">colpartition.h:442</a></div></div>
<div class="ttc" id="a02246_html_a1ec8cc3dc57f53854d2190f112c00c85"><div class="ttname"><a href="a02246.html#a1ec8cc3dc57f53854d2190f112c00c85">tesseract::EquationDetect::SplitCPHorLite</a></div><div class="ttdeci">void SplitCPHorLite(ColPartition *part, GenericVector< TBOX > *splitted_boxes)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00698">equationdetect.cpp:698</a></div></div>
<div class="ttc" id="a02246_html_a056b756d6ebd931501b3488b2b526336"><div class="ttname"><a href="a02246.html#a056b756d6ebd931501b3488b2b526336">tesseract::EquationDetect::CheckSeedDensity</a></div><div class="ttdeci">bool CheckSeedDensity(const float math_density_high, const float math_density_low, const ColPartition *part) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01002">equationdetect.cpp:1002</a></div></div>
<div class="ttc" id="a02610_html_af74fa3bf628c9426cd6f1141a87dc2e0"><div class="ttname"><a href="a02610.html#af74fa3bf628c9426cd6f1141a87dc2e0">TBOX::right</a></div><div class="ttdeci">int16_t right() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00079">rect.h:79</a></div></div>
<div class="ttc" id="a02382_html_a5dd67c54162a6b60b0fd11500d4a3025"><div class="ttname"><a href="a02382.html#a5dd67c54162a6b60b0fd11500d4a3025">TO_BLOCK::blobs</a></div><div class="ttdeci">BLOBNBOX_LIST blobs</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00785">blobbox.h:785</a></div></div>
<div class="ttc" id="a01629_html_ad64e658be002902d7a5b0dd98ab0fe35"><div class="ttname"><a href="a01629.html#ad64e658be002902d7a5b0dd98ab0fe35">tesseract::kMathItalicDensityTh</a></div><div class="ttdeci">const float kMathItalicDensityTh</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00083">equationdetect.cpp:83</a></div></div>
<div class="ttc" id="a02246_html_ae00172a9d9483ef7a204f2316e4d7f96"><div class="ttname"><a href="a02246.html#ae00172a9d9483ef7a204f2316e4d7f96">tesseract::EquationDetect::IdentifySpecialText</a></div><div class="ttdeci">void IdentifySpecialText()</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00259">equationdetect.cpp:259</a></div></div>
<div class="ttc" id="a04570_html_aa348155cfa970382ea67c69ac2a95376"><div class="ttname"><a href="a04570.html#aa348155cfa970382ea67c69ac2a95376">tesseract::ColPartition::ComputeSpecialBlobsDensity</a></div><div class="ttdeci">void ComputeSpecialBlobsDensity()</div><div class="ttdef"><b>Definition:</b> <a href="a01124_source.html#l00592">colpartition.cpp:592</a></div></div>
<div class="ttc" id="a02382_html_aafe2a9baa69300ee71da42e6dc18cfee"><div class="ttname"><a href="a02382.html#aafe2a9baa69300ee71da42e6dc18cfee">TO_BLOCK::large_blobs</a></div><div class="ttdeci">BLOBNBOX_LIST large_blobs</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00789">blobbox.h:789</a></div></div>
<div class="ttc" id="a02246_html_a56443e2bab5cd7a0376dbd8e05fe7bdd"><div class="ttname"><a href="a02246.html#a56443e2bab5cd7a0376dbd8e05fe7bdd">tesseract::EquationDetect::PaintSpecialTexts</a></div><div class="ttdeci">void PaintSpecialTexts(const STRING &outfile) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01465">equationdetect.cpp:1465</a></div></div>
<div class="ttc" id="a01629_html_a04550a0ed1279562027bf2fc92c421aeaea8028f61e76a0f4def7cbe7905206cf"><div class="ttname"><a href="a01629.html#a04550a0ed1279562027bf2fc92c421aeaea8028f61e76a0f4def7cbe7905206cf">tesseract::OEM_TESSERACT_ONLY</a></div><div class="ttdef"><b>Definition:</b> <a href="a00380_source.html#l00269">publictypes.h:269</a></div></div>
<div class="ttc" id="a01629_html_a1a5ac6fad51e61e88df309fb704d8ebc"><div class="ttname"><a href="a01629.html#a1a5ac6fad51e61e88df309fb704d8ebc">tesseract::kLeftIndentAlignmentCountTh</a></div><div class="ttdeci">const int kLeftIndentAlignmentCountTh</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00086">equationdetect.cpp:86</a></div></div>
<div class="ttc" id="a04574_html"><div class="ttname"><a href="a04574.html">tesseract::ColPartitionGrid</a></div><div class="ttdef"><b>Definition:</b> <a href="a01133_source.html#l00033">colpartitiongrid.h:33</a></div></div>
<div class="ttc" id="a02398_html"><div class="ttname"><a href="a02398.html">TBLOB</a></div><div class="ttdef"><b>Definition:</b> <a href="a00230_source.html#l00268">blobs.h:268</a></div></div>
<div class="ttc" id="a04502_html_ad7f7e99bcda5e0daeb682b772e445f60"><div class="ttname"><a href="a04502.html#ad7f7e99bcda5e0daeb682b772e445f60">tesseract::GridSearch::StartFullSearch</a></div><div class="ttdeci">void StartFullSearch()</div><div class="ttdef"><b>Definition:</b> <a href="a01091_source.html#l00667">bbgrid.h:667</a></div></div>
<div class="ttc" id="a01629_html_afe260b66ccf11a3f3346ba282f315c49"><div class="ttname"><a href="a01629.html#afe260b66ccf11a3f3346ba282f315c49">tesseract::IsLeftIndented</a></div><div class="ttdeci">bool IsLeftIndented(const EquationDetect::IndentType type)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00093">equationdetect.cpp:93</a></div></div>
<div class="ttc" id="a02246_html_a56fe80b060d60fd1d833b3054f44abdf"><div class="ttname"><a href="a02246.html#a56fe80b060d60fd1d833b3054f44abdf">tesseract::EquationDetect::best_columns_</a></div><div class="ttdeci">ColPartitionSet ** best_columns_</div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00257">equationdetect.h:257</a></div></div>
<div class="ttc" id="a02246_html_a0867ba3cb66855f3c625537b6b570447"><div class="ttname"><a href="a02246.html#a0867ba3cb66855f3c625537b6b570447">tesseract::EquationDetect::EquationDetect</a></div><div class="ttdeci">EquationDetect(const char *equ_datapath, const char *equ_language)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00103">equationdetect.cpp:103</a></div></div>
<div class="ttc" id="a02610_html_a9fee4521e71300975cb34ebb21e3fca5"><div class="ttname"><a href="a02610.html#a9fee4521e71300975cb34ebb21e3fca5">TBOX::bottom</a></div><div class="ttdeci">int16_t bottom() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00065">rect.h:65</a></div></div>
<div class="ttc" id="a02246_html_a612dd0f3c9191b1614d62e2c6f758cda"><div class="ttname"><a href="a02246.html#a612dd0f3c9191b1614d62e2c6f758cda">tesseract::EquationDetect::IsNearSmallNeighbor</a></div><div class="ttdeci">bool IsNearSmallNeighbor(const TBOX &seed_box, const TBOX &part_box) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01271">equationdetect.cpp:1271</a></div></div>
<div class="ttc" id="a02374_html"><div class="ttname"><a href="a02374.html">BLOBNBOX</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00144">blobbox.h:144</a></div></div>
<div class="ttc" id="a02246_html_a8af35d2174dc3814a0e895115b4b4223a0b833974e34cfce11e7bb182afd5c43c"><div class="ttname"><a href="a02246.html#a8af35d2174dc3814a0e895115b4b4223a0b833974e34cfce11e7bb182afd5c43c">tesseract::EquationDetect::NO_INDENT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00046">equationdetect.h:46</a></div></div>
<div class="ttc" id="a00224_html_a75b089d27e1df813fed544e0c131df8ca9f7c059031ba5f95a4e0f43bac16a33a"><div class="ttname"><a href="a00224.html#a75b089d27e1df813fed544e0c131df8ca9f7c059031ba5f95a4e0f43bac16a33a">BSTT_ITALIC</a></div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00099">blobbox.h:99</a></div></div>
<div class="ttc" id="a01133_html"><div class="ttname"><a href="a01133.html">colpartitiongrid.h</a></div></div>
<div class="ttc" id="a04570_html_a2ad3b1e781a208614d52e263a28c1e00"><div class="ttname"><a href="a04570.html#a2ad3b1e781a208614d52e263a28c1e00">tesseract::ColPartition::boxes_count</a></div><div class="ttdeci">int boxes_count() const</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00191">colpartition.h:191</a></div></div>
<div class="ttc" id="a02246_html_aa01a56f6dae2e52de475be85ac4eabfd"><div class="ttname"><a href="a02246.html#aa01a56f6dae2e52de475be85ac4eabfd">tesseract::EquationDetect::ExpandSeedHorizontal</a></div><div class="ttdeci">void ExpandSeedHorizontal(const bool search_left, ColPartition *seed, GenericVector< ColPartition *> *parts_to_merge)</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01128">equationdetect.cpp:1128</a></div></div>
<div class="ttc" id="a02602_html_ad448095b666bfb864211714ec2c2375e"><div class="ttname"><a href="a02602.html#ad448095b666bfb864211714ec2c2375e">BLOB_CHOICE::unichar_id</a></div><div class="ttdeci">UNICHAR_ID unichar_id() const</div><div class="ttdef"><b>Definition:</b> <a href="a00401_source.html#l00077">ratngs.h:77</a></div></div>
<div class="ttc" id="a02834_html_a7a1f2a841e8d01d5a8c05bc3ab8064eb"><div class="ttname"><a href="a02834.html#a7a1f2a841e8d01d5a8c05bc3ab8064eb">STRING::length</a></div><div class="ttdeci">int32_t length() const</div><div class="ttdef"><b>Definition:</b> <a href="a00581_source.html#l00191">strngs.cpp:191</a></div></div>
<div class="ttc" id="a02610_html_a72fcb736ed0ddeae95e6a51b3bf8d979"><div class="ttname"><a href="a02610.html#a72fcb736ed0ddeae95e6a51b3bf8d979">TBOX::height</a></div><div class="ttdeci">int16_t height() const</div><div class="ttdef"><b>Definition:</b> <a href="a00407_source.html#l00108">rect.h:108</a></div></div>
<div class="ttc" id="a02246_html_a096b2bb7f8f59484ec2043d92c3f1eec"><div class="ttname"><a href="a02246.html#a096b2bb7f8f59484ec2043d92c3f1eec">tesseract::EquationDetect::EstimateTextPartLineSpacing</a></div><div class="ttdeci">int EstimateTextPartLineSpacing()</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00868">equationdetect.cpp:868</a></div></div>
<div class="ttc" id="a02374_html_a5d497fdc454feff733889db8fe604868"><div class="ttname"><a href="a02374.html#a5d497fdc454feff733889db8fe604868">BLOBNBOX::cblob</a></div><div class="ttdeci">C_BLOB * cblob() const</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00269">blobbox.h:269</a></div></div>
<div class="ttc" id="a02246_html_ad7ae4f58197c854689b69df45e77352d"><div class="ttname"><a href="a02246.html#ad7ae4f58197c854689b69df45e77352d">tesseract::EquationDetect::PrintSpecialBlobsDensity</a></div><div class="ttdeci">void PrintSpecialBlobsDensity(const ColPartition *part) const</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l01505">equationdetect.cpp:1505</a></div></div>
<div class="ttc" id="a04570_html_a9fcf07be83840289187d6358ee752a46"><div class="ttname"><a href="a04570.html#a9fcf07be83840289187d6358ee752a46">tesseract::ColPartition::set_type</a></div><div class="ttdeci">void set_type(PolyBlockType t)</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00185">colpartition.h:185</a></div></div>
<div class="ttc" id="a01629_html_ad996502770c51cc260e4d66db9543bcc"><div class="ttname"><a href="a01629.html#ad996502770c51cc260e4d66db9543bcc">tesseract::kMathDigitDensityTh1</a></div><div class="ttdeci">const float kMathDigitDensityTh1</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00081">equationdetect.cpp:81</a></div></div>
<div class="ttc" id="a01629_html_a07a51423879204a025d373c6ae40fba5"><div class="ttname"><a href="a01629.html#a07a51423879204a025d373c6ae40fba5">tesseract::kUnclearDensityTh</a></div><div class="ttdeci">const float kUnclearDensityTh</div><div class="ttdef"><b>Definition:</b> <a href="a00083_source.html#l00084">equationdetect.cpp:84</a></div></div>
<div class="ttc" id="a00503_html_a93a603f4063a6b9403d81caa245a583b"><div class="ttname"><a href="a00503.html#a93a603f4063a6b9403d81caa245a583b">ASSERT_HOST</a></div><div class="ttdeci">#define ASSERT_HOST(x)</div><div class="ttdef"><b>Definition:</b> <a href="a00503_source.html#l00084">errcode.h:84</a></div></div>
<div class="ttc" id="a00014_html_a02cfd8369d5ad8c70a8b90c0f40d677faa52ce81f771512916e01215965910fc6"><div class="ttname"><a href="a00014.html#a02cfd8369d5ad8c70a8b90c0f40d677faa52ce81f771512916e01215965910fc6">PT_INLINE_EQUATION</a></div><div class="ttdef"><b>Definition:</b> <a href="a00014_source.html#l00099">capi.h:99</a></div></div>
<div class="ttc" id="a04570_html_a2b91c5a8fcbace20f38dbe94ebf2cac9"><div class="ttname"><a href="a04570.html#a2b91c5a8fcbace20f38dbe94ebf2cac9">tesseract::ColPartition::type</a></div><div class="ttdeci">PolyBlockType type() const</div><div class="ttdef"><b>Definition:</b> <a href="a01127_source.html#l00182">colpartition.h:182</a></div></div>
<div class="ttc" id="a02246_html_a8af35d2174dc3814a0e895115b4b4223"><div class="ttname"><a href="a02246.html#a8af35d2174dc3814a0e895115b4b4223">tesseract::EquationDetect::IndentType</a></div><div class="ttdeci">IndentType</div><div class="ttdef"><b>Definition:</b> <a href="a00086_source.html#l00045">equationdetect.h:45</a></div></div>
<div class="ttc" id="a02374_html_a1650427df7e6b935dd737ad9eb70c36b"><div class="ttname"><a href="a02374.html#a1650427df7e6b935dd737ad9eb70c36b">BLOBNBOX::set_special_text_type</a></div><div class="ttdeci">void set_special_text_type(BlobSpecialTextType new_type)</div><div class="ttdef"><b>Definition:</b> <a href="a00224_source.html#l00293">blobbox.h:293</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_fce9a394c0d2c636e610a0a34fe30580.html">tesseract-ocr.master</a></li><li class="navelem"><a class="el" href="dir_fd2783e80b2d56815818e17a68fc4d98.html">src</a></li><li class="navelem"><a class="el" href="dir_f676e76c9a53ee7edd5046de803da784.html">ccmain</a></li><li class="navelem"><a class="el" href="a00083.html">equationdetect.cpp</a></li>
<li class="footer">Generated on Mon Oct 29 2018 11:03:42 for tesseract by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
</ul>
</div>
</body>
</html>