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

« back to all changes in this revision

Viewing changes to doc/html/a01145_source.html

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
2
<html xmlns="http://www.w3.org/1999/xhtml">
 
3
<head>
 
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
 
5
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
 
6
<title>tesseract: /usr/local/google/home/jbreiden/tesseract-ocr-read-only/textord/tablerecog.h Source File</title>
 
7
 
 
8
<link href="tabs.css" rel="stylesheet" type="text/css"/>
 
9
<link href="doxygen.css" rel="stylesheet" type="text/css" />
 
10
<link href="navtree.css" rel="stylesheet" type="text/css"/>
 
11
<script type="text/javascript" src="jquery.js"></script>
 
12
<script type="text/javascript" src="resize.js"></script>
 
13
<script type="text/javascript" src="navtree.js"></script>
 
14
<script type="text/javascript">
 
15
  $(document).ready(initResizable);
 
16
</script>
 
17
<link href="search/search.css" rel="stylesheet" type="text/css"/>
 
18
<script type="text/javascript" src="search/search.js"></script>
 
19
<script type="text/javascript">
 
20
  $(document).ready(function() { searchBox.OnSelectItem(0); });
 
21
</script>
 
22
 
 
23
</head>
 
24
<body>
 
25
<div id="top"><!-- do not remove this div! -->
 
26
 
 
27
 
 
28
<div id="titlearea">
 
29
<table cellspacing="0" cellpadding="0">
 
30
 <tbody>
 
31
 <tr style="height: 56px;">
 
32
  
 
33
  
 
34
  <td style="padding-left: 0.5em;">
 
35
   <div id="projectname">tesseract
 
36
   &#160;<span id="projectnumber">3.03</span>
 
37
   </div>
 
38
   
 
39
  </td>
 
40
  
 
41
  
 
42
  
 
43
 </tr>
 
44
 </tbody>
 
45
</table>
 
46
</div>
 
47
 
 
48
<!-- Generated by Doxygen 1.7.6.1 -->
 
49
<script type="text/javascript">
 
50
var searchBox = new SearchBox("searchBox", "search",false,'Search');
 
51
</script>
 
52
  <div id="navrow1" class="tabs">
 
53
    <ul class="tablist">
 
54
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
 
55
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
 
56
      <li><a href="modules.html"><span>Modules</span></a></li>
 
57
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
 
58
      <li><a href="annotated.html"><span>Classes</span></a></li>
 
59
      <li class="current"><a href="files.html"><span>Files</span></a></li>
 
60
      <li>
 
61
        <div id="MSearchBox" class="MSearchBoxInactive">
 
62
        <span class="left">
 
63
          <img id="MSearchSelect" src="search/mag_sel.png"
 
64
               onmouseover="return searchBox.OnSearchSelectShow()"
 
65
               onmouseout="return searchBox.OnSearchSelectHide()"
 
66
               alt=""/>
 
67
          <input type="text" id="MSearchField" value="Search" accesskey="S"
 
68
               onfocus="searchBox.OnSearchFieldFocus(true)" 
 
69
               onblur="searchBox.OnSearchFieldFocus(false)" 
 
70
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
 
71
          </span><span class="right">
 
72
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
 
73
          </span>
 
74
        </div>
 
75
      </li>
 
76
    </ul>
 
77
  </div>
 
78
  <div id="navrow2" class="tabs2">
 
79
    <ul class="tablist">
 
80
      <li><a href="files.html"><span>File&#160;List</span></a></li>
 
81
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
 
82
    </ul>
 
83
  </div>
 
84
</div>
 
85
<div id="side-nav" class="ui-resizable side-nav-resizable">
 
86
  <div id="nav-tree">
 
87
    <div id="nav-tree-contents">
 
88
    </div>
 
89
  </div>
 
90
  <div id="splitbar" style="-moz-user-select:none;" 
 
91
       class="ui-resizable-handle">
 
92
  </div>
 
93
</div>
 
94
<script type="text/javascript">
 
95
  initNavTree('a01145.html','');
 
96
</script>
 
97
<div id="doc-content">
 
98
<div class="header">
 
99
  <div class="headertitle">
 
100
<div class="title">/usr/local/google/home/jbreiden/tesseract-ocr-read-only/textord/tablerecog.h</div>  </div>
 
101
</div><!--header-->
 
102
<div class="contents">
 
103
<a href="a01145.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
 
104
<a name="l00002"></a>00002 <span class="comment">// File:        tablerecog.h</span>
 
105
<a name="l00003"></a>00003 <span class="comment">// Description: Functions to detect structure of tables.</span>
 
106
<a name="l00004"></a>00004 <span class="comment">// Author:    Nicholas Beato</span>
 
107
<a name="l00005"></a>00005 <span class="comment">// Created:   Aug 17, 2010</span>
 
108
<a name="l00006"></a>00006 <span class="comment">//</span>
 
109
<a name="l00007"></a>00007 <span class="comment">// (C) Copyright 2010, Google Inc.</span>
 
110
<a name="l00008"></a>00008 <span class="comment">// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
 
111
<a name="l00009"></a>00009 <span class="comment">// you may not use this file except in compliance with the License.</span>
 
112
<a name="l00010"></a>00010 <span class="comment">// You may obtain a copy of the License at</span>
 
113
<a name="l00011"></a>00011 <span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span>
 
114
<a name="l00012"></a>00012 <span class="comment">// Unless required by applicable law or agreed to in writing, software</span>
 
115
<a name="l00013"></a>00013 <span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
 
116
<a name="l00014"></a>00014 <span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
 
117
<a name="l00015"></a>00015 <span class="comment">// See the License for the specific language governing permissions and</span>
 
118
<a name="l00016"></a>00016 <span class="comment">// limitations under the License.</span>
 
119
<a name="l00017"></a>00017 <span class="comment">//</span>
 
120
<a name="l00019"></a>00019 <span class="comment"></span>
 
121
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef TABLERECOG_H_</span>
 
122
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define TABLERECOG_H_</span>
 
123
<a name="l00022"></a>00022 <span class="preprocessor"></span>
 
124
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="a01103.html">colpartitiongrid.h</a>&quot;</span>
 
125
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;<a class="code" href="a00826.html">genericvector.h</a>&quot;</span>
 
126
<a name="l00025"></a>00025 
 
127
<a name="l00026"></a>00026 <span class="keyword">namespace </span><a class="code" href="a01266.html#afed58feacb84df2de88bdd613cfdba6d">tesseract</a> {
 
128
<a name="l00027"></a>00027 
 
129
<a name="l00028"></a>00028 <span class="comment">// There are 2 classes in this file. They have 2 different purposes.</span>
 
130
<a name="l00029"></a>00029 <span class="comment">//  - StructuredTable contains the methods to find the structure given</span>
 
131
<a name="l00030"></a>00030 <span class="comment">//    a specific bounding box and grow that structure.</span>
 
132
<a name="l00031"></a>00031 <span class="comment">//  - TableRecognizer contains the methods to adjust the possible positions</span>
 
133
<a name="l00032"></a>00032 <span class="comment">//    of a table without worrying about structure.</span>
 
134
<a name="l00033"></a>00033 <span class="comment">//</span>
 
135
<a name="l00034"></a>00034 <span class="comment">// To use these classes, the assumption is that the TableFinder will</span>
 
136
<a name="l00035"></a>00035 <span class="comment">// have a guess of the location of a table (or possibly over/undersegmented</span>
 
137
<a name="l00036"></a>00036 <span class="comment">// tables). The TableRecognizer is responsible for finding the table boundaries</span>
 
138
<a name="l00037"></a>00037 <span class="comment">// at a high level. The StructuredTable class is responsible for determining</span>
 
139
<a name="l00038"></a>00038 <span class="comment">// the structure of the table and trying to maximize its bounds while retaining</span>
 
140
<a name="l00039"></a>00039 <span class="comment">// the structure.</span>
 
141
<a name="l00040"></a>00040 <span class="comment">// (The latter part is not implemented yet, but that was the goal).</span>
 
142
<a name="l00041"></a>00041 <span class="comment">//</span>
 
143
<a name="l00042"></a>00042 <span class="comment">// While on the boundary discussion, keep in mind that this is a first pass.</span>
 
144
<a name="l00043"></a>00043 <span class="comment">// There should eventually be some things like internal structure checks,</span>
 
145
<a name="l00044"></a>00044 <span class="comment">// and, more importantly, surrounding text flow checks.</span>
 
146
<a name="l00045"></a>00045 <span class="comment">//</span>
 
147
<a name="l00046"></a>00046 
 
148
<a name="l00047"></a>00047 <span class="comment">// Usage:</span>
 
149
<a name="l00048"></a>00048 <span class="comment">// The StructuredTable class contains methods to query a potential table.</span>
 
150
<a name="l00049"></a>00049 <span class="comment">// It has functions to find structure, count rows, find ColPartitions that</span>
 
151
<a name="l00050"></a>00050 <span class="comment">// intersect gridlines, etc. It is not meant to blindly find a table. It</span>
 
152
<a name="l00051"></a>00051 <span class="comment">// is meant to start with a known table location and enhance it.</span>
 
153
<a name="l00052"></a>00052 <span class="comment">// Usage:</span>
 
154
<a name="l00053"></a>00053 <span class="comment">//    ColPartitionGrid text_grid, line_grid;  // init</span>
 
155
<a name="l00054"></a>00054 <span class="comment">//    TBOX table_box;  // known location of table location</span>
 
156
<a name="l00055"></a>00055 <span class="comment">//</span>
 
157
<a name="l00056"></a>00056 <span class="comment">//    StructuredTable table;</span>
 
158
<a name="l00057"></a>00057 <span class="comment">//    table.Init();  // construction code</span>
 
159
<a name="l00058"></a>00058 <span class="comment">//    table.set_text_grid(/* text */);  // These 2 grids can be the same!</span>
 
160
<a name="l00059"></a>00059 <span class="comment">//    table.set_line_grid(/* lines */);</span>
 
161
<a name="l00060"></a>00060 <span class="comment">//    table.set_min_text_height(10);    // Filter vertical and tall text.</span>
 
162
<a name="l00061"></a>00061 <span class="comment">//    // IMPORTANT! The table needs to be told where it is!</span>
 
163
<a name="l00062"></a>00062 <span class="comment">//    table.set_bounding_box(table_box);  // Set initial table location.</span>
 
164
<a name="l00063"></a>00063 <span class="comment">//    if (table.FindWhitespacedStructure()) {</span>
 
165
<a name="l00064"></a>00064 <span class="comment">//      // process table</span>
 
166
<a name="l00065"></a>00065 <span class="comment">//      table.column_count();  // number of columns</span>
 
167
<a name="l00066"></a>00066 <span class="comment">//      table.row_count();     // number of rows</span>
 
168
<a name="l00067"></a>00067 <span class="comment">//      table.cells_count();   // number of cells</span>
 
169
<a name="l00068"></a>00068 <span class="comment">//      table.bounding_box();  // updated bounding box</span>
 
170
<a name="l00069"></a>00069 <span class="comment">//      // etc.</span>
 
171
<a name="l00070"></a>00070 <span class="comment">//    }</span>
 
172
<a name="l00071"></a>00071 <span class="comment">//</span>
 
173
<a name="l00072"></a><a class="code" href="a00562.html">00072</a> <span class="keyword">class </span><a class="code" href="a00562.html">StructuredTable</a> {
 
174
<a name="l00073"></a>00073  <span class="keyword">public</span>:
 
175
<a name="l00074"></a>00074   <a class="code" href="a00562.html#a61e7479fd0274d93178161ff1b90f12d">StructuredTable</a>();
 
176
<a name="l00075"></a>00075   <a class="code" href="a00562.html#a7b7955c72479ce32909b345c656415f5">~StructuredTable</a>();
 
177
<a name="l00076"></a>00076 
 
178
<a name="l00077"></a>00077   <span class="comment">// Initialization code. Must be called after the constructor.</span>
 
179
<a name="l00078"></a>00078   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a3dc40da641753dbaf7b8351f67b95ddb">Init</a>();
 
180
<a name="l00079"></a>00079 
 
181
<a name="l00080"></a>00080   <span class="comment">// Sets the grids used by the table. These can be changed between</span>
 
182
<a name="l00081"></a>00081   <span class="comment">// calls to Recognize. They are treated as read-only data.</span>
 
183
<a name="l00082"></a>00082   <span class="keywordtype">void</span> <a class="code" href="a00562.html#ae525ff4858f6123817232f93ecc43476">set_text_grid</a>(<a class="code" href="a00324.html">ColPartitionGrid</a>* text);
 
184
<a name="l00083"></a>00083   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a98ef5d31a061ce9b3091fb79f0191c69">set_line_grid</a>(<a class="code" href="a00324.html">ColPartitionGrid</a>* lines);
 
185
<a name="l00084"></a>00084   <span class="comment">// Filters text partitions that are ridiculously tall to prevent</span>
 
186
<a name="l00085"></a>00085   <span class="comment">// merging rows.</span>
 
187
<a name="l00086"></a>00086   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a47a275de6919be20e719b704c45814f1">set_max_text_height</a>(<span class="keywordtype">int</span> height);
 
188
<a name="l00087"></a>00087 
 
189
<a name="l00088"></a>00088   <span class="comment">// Basic accessors. Some are treated as attributes despite having indirect</span>
 
190
<a name="l00089"></a>00089   <span class="comment">// representation.</span>
 
191
<a name="l00090"></a>00090   <span class="keywordtype">bool</span> <a class="code" href="a00562.html#a1507dc9a3a530f8819cfd18f3635cbf3">is_lined</a>() <span class="keyword">const</span>;
 
192
<a name="l00091"></a>00091   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a5516d2be345fb1740fd35a4316da2072">row_count</a>() <span class="keyword">const</span>;
 
193
<a name="l00092"></a>00092   <span class="keywordtype">int</span> <a class="code" href="a00562.html#aeefea2e84ee34a4b7495949e9d0dbede">column_count</a>() <span class="keyword">const</span>;
 
194
<a name="l00093"></a>00093   <span class="keywordtype">int</span> <a class="code" href="a00562.html#aad8221b60221210d9cad2cede71d705e">cell_count</a>() <span class="keyword">const</span>;
 
195
<a name="l00094"></a>00094   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a735232879bcc0cad741b02fee2c2e660">set_bounding_box</a>(<span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>&amp; box);
 
196
<a name="l00095"></a>00095   <span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>&amp; <a class="code" href="a00562.html#a3c7bee910fbd573f3999c58db9539c02">bounding_box</a>() <span class="keyword">const</span>;
 
197
<a name="l00096"></a>00096   <span class="keywordtype">int</span> <a class="code" href="a00562.html#aeba605980cd361c291fc5cfb770c3efa">median_cell_height</a>();
 
198
<a name="l00097"></a>00097   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a25242413ecf219632e47b776e91de532">median_cell_width</a>();
 
199
<a name="l00098"></a>00098   <span class="keywordtype">int</span> <a class="code" href="a00562.html#ae6f73aa2764c036433b2cca3c7c058b3">row_height</a>(<span class="keywordtype">int</span> row) <span class="keyword">const</span>;
 
200
<a name="l00099"></a>00099   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a8b7c2dbdaac6a8a502de0badba4a4fd7">column_width</a>(<span class="keywordtype">int</span> column) <span class="keyword">const</span>;
 
201
<a name="l00100"></a>00100   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a32b66cd4497a4126fcca80a5acd8da1c">space_above</a>() <span class="keyword">const</span>;
 
202
<a name="l00101"></a>00101   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a75ce97ac260ae3697d22827e8108aa74">space_below</a>() <span class="keyword">const</span>;
 
203
<a name="l00102"></a>00102 
 
204
<a name="l00103"></a>00103   <span class="comment">// Given enough horizontal and vertical lines in a region, create this table</span>
 
205
<a name="l00104"></a>00104   <span class="comment">// based on the structure given by the lines. Return true if it worked out.</span>
 
206
<a name="l00105"></a>00105   <span class="comment">// Code assumes the lines exist. It is the caller&#39;s responsibility to check</span>
 
207
<a name="l00106"></a>00106   <span class="comment">// for lines and find an appropriate bounding box.</span>
 
208
<a name="l00107"></a>00107   <span class="keywordtype">bool</span> <a class="code" href="a00562.html#a918b3e568bf9c5518a61744b9e2903a9">FindLinedStructure</a>();
 
209
<a name="l00108"></a>00108 
 
210
<a name="l00109"></a>00109   <span class="comment">// The main subroutine for finding generic table structure. The function</span>
 
211
<a name="l00110"></a>00110   <span class="comment">// finds the grid structure in the given box. Returns true if a good grid</span>
 
212
<a name="l00111"></a>00111   <span class="comment">// exists, implying that &quot;this&quot; table is valid.</span>
 
213
<a name="l00112"></a>00112   <span class="keywordtype">bool</span> <a class="code" href="a00562.html#a8931e5502d9bcccee24083f44f8262f3">FindWhitespacedStructure</a>();
 
214
<a name="l00113"></a>00113 
 
215
<a name="l00117"></a>00117 
 
216
<a name="l00118"></a>00118   <span class="comment">// Returns true if inserting part into the table does not cause any</span>
 
217
<a name="l00119"></a>00119   <span class="comment">// cell merges.</span>
 
218
<a name="l00120"></a>00120   <span class="keywordtype">bool</span> <a class="code" href="a00562.html#a3cb05866929df4ec8793b53fcd9ae0a8">DoesPartitionFit</a>(<span class="keyword">const</span> <a class="code" href="a00323.html">ColPartition</a>&amp; part) <span class="keyword">const</span>;
 
219
<a name="l00121"></a>00121   <span class="comment">// Checks if a sub-table has multiple data cells filled.</span>
 
220
<a name="l00122"></a>00122   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a298934f8abccabe361df8b6a991b5c97">CountFilledCells</a>();
 
221
<a name="l00123"></a>00123   <span class="keywordtype">int</span> <a class="code" href="a00562.html#ab309005ab9016419f2d4af29e524f945">CountFilledCellsInRow</a>(<span class="keywordtype">int</span> row);
 
222
<a name="l00124"></a>00124   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a7fa7ba1ae2c09eae1a43476bcb6dbb81">CountFilledCellsInColumn</a>(<span class="keywordtype">int</span> column);
 
223
<a name="l00125"></a>00125   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a298934f8abccabe361df8b6a991b5c97">CountFilledCells</a>(<span class="keywordtype">int</span> row_start, <span class="keywordtype">int</span> row_end,
 
224
<a name="l00126"></a>00126                        <span class="keywordtype">int</span> column_start, <span class="keywordtype">int</span> column_end);
 
225
<a name="l00127"></a>00127 
 
226
<a name="l00128"></a>00128   <span class="comment">// Makes sure that at least one cell in a row has substantial area filled.</span>
 
227
<a name="l00129"></a>00129   <span class="comment">// This can filter out large whitespace caused by growing tables too far</span>
 
228
<a name="l00130"></a>00130   <span class="comment">// and page numbers.</span>
 
229
<a name="l00131"></a>00131   <span class="comment">// (currently bugged for some reason).</span>
 
230
<a name="l00132"></a>00132   <span class="keywordtype">bool</span> <a class="code" href="a00562.html#a175d7d7c8b49471e593c99ab3c43f44e">VerifyRowFilled</a>(<span class="keywordtype">int</span> row);
 
231
<a name="l00133"></a>00133   <span class="comment">// Finds the filled area in a cell.</span>
 
232
<a name="l00134"></a>00134   <span class="keywordtype">double</span> <a class="code" href="a00562.html#a876e5d9f12bd9f23a1bc41144ba49135">CalculateCellFilledPercentage</a>(<span class="keywordtype">int</span> row, <span class="keywordtype">int</span> column);
 
233
<a name="l00135"></a>00135 
 
234
<a name="l00136"></a>00136   <span class="comment">// Debug display, draws the table in the given color. If the table is not</span>
 
235
<a name="l00137"></a>00137   <span class="comment">// valid, the table and &quot;best&quot; grid lines are still drawn in the given color.</span>
 
236
<a name="l00138"></a>00138   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a963787fcfcc5343b74b5e873723752a0">Display</a>(<a class="code" href="a00532.html">ScrollView</a>* window, <a class="code" href="a00532.html#a100504544a5423a94222149ee9ed0fe8">ScrollView::Color</a> color);
 
237
<a name="l00139"></a>00139 
 
238
<a name="l00140"></a>00140  <span class="keyword">protected</span>:
 
239
<a name="l00141"></a>00141   <span class="comment">// Clear the structure information.</span>
 
240
<a name="l00142"></a>00142   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a9f06f45074d0987e9c6d6eee54033ccd">ClearStructure</a>();
 
241
<a name="l00143"></a>00143 
 
242
<a name="l00147"></a>00147 
 
243
<a name="l00148"></a>00148   <span class="comment">// Verifies the lines do not intersect partitions. This happens when</span>
 
244
<a name="l00149"></a>00149   <span class="comment">// the lines are in column boundaries and extend the full page. As a result,</span>
 
245
<a name="l00150"></a>00150   <span class="comment">// the grid lines go through column text. The condition is detectable.</span>
 
246
<a name="l00151"></a>00151   <span class="keywordtype">bool</span> <a class="code" href="a00562.html#a10d18f070403d28436812e28c8eddf21">VerifyLinedTableCells</a>();
 
247
<a name="l00152"></a>00152 
 
248
<a name="l00156"></a>00156 
 
249
<a name="l00157"></a>00157   <span class="comment">// This is the function to change if you want to filter resulting tables</span>
 
250
<a name="l00158"></a>00158   <span class="comment">// better. Right now it just checks for a minimum cell count and such.</span>
 
251
<a name="l00159"></a>00159   <span class="comment">// You could add things like maximum number of ColPartitions per cell or</span>
 
252
<a name="l00160"></a>00160   <span class="comment">// similar.</span>
 
253
<a name="l00161"></a>00161   <span class="keywordtype">bool</span> <a class="code" href="a00562.html#adeb681371e657a5596c79acfd558fcc9">VerifyWhitespacedTable</a>();
 
254
<a name="l00162"></a>00162   <span class="comment">// Find the columns of a table using whitespace.</span>
 
255
<a name="l00163"></a>00163   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a9096fe209bc3bac12d3d6478cfe614bd">FindWhitespacedColumns</a>();
 
256
<a name="l00164"></a>00164   <span class="comment">// Find the rows of a table using whitespace.</span>
 
257
<a name="l00165"></a>00165   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a267d885a876327019d2fd85ef6dade90">FindWhitespacedRows</a>();
 
258
<a name="l00166"></a>00166 
 
259
<a name="l00170"></a>00170 
 
260
<a name="l00171"></a>00171   <span class="comment">// Calculates the whitespace around the table using the table boundary and</span>
 
261
<a name="l00172"></a>00172   <span class="comment">// the supplied grids (set_text_grid and set_line_grid).</span>
 
262
<a name="l00173"></a>00173   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a5ff1789e2e45b46e9b0d29e75120e068">CalculateMargins</a>();
 
263
<a name="l00174"></a>00174   <span class="comment">// Update the table margins with the supplied grid. This is</span>
 
264
<a name="l00175"></a>00175   <span class="comment">// only called by calculate margins to use multiple grid sources.</span>
 
265
<a name="l00176"></a>00176   <span class="keywordtype">void</span> <a class="code" href="a00562.html#ae86b1f857121b9e9270143d8fdbe5715">UpdateMargins</a>(<a class="code" href="a00324.html">ColPartitionGrid</a>* grid);
 
266
<a name="l00177"></a>00177   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a235fd8f82d814906b0407a323c94d7f6">FindVerticalMargin</a>(<a class="code" href="a00324.html">ColPartitionGrid</a>* grid, <span class="keywordtype">int</span> start_x,
 
267
<a name="l00178"></a>00178                          <span class="keywordtype">bool</span> decrease) <span class="keyword">const</span>;
 
268
<a name="l00179"></a>00179   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a37a39634fe1a9f1d11f05cb8214f4444">FindHorizontalMargin</a>(<a class="code" href="a00324.html">ColPartitionGrid</a>* grid, <span class="keywordtype">int</span> start_y,
 
269
<a name="l00180"></a>00180                            <span class="keywordtype">bool</span> decrease) <span class="keyword">const</span>;
 
270
<a name="l00181"></a>00181   <span class="comment">// Calculates stats on the table, namely the median cell height and width.</span>
 
271
<a name="l00182"></a>00182   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a2e34d7cc3d51305252ab3f88a4d75c82">CalculateStats</a>();
 
272
<a name="l00183"></a>00183 
 
273
<a name="l00187"></a>00187 
 
274
<a name="l00188"></a>00188   <span class="comment">// Given a whitespaced table, this looks for bordering lines that might</span>
 
275
<a name="l00189"></a>00189   <span class="comment">// be page layout boxes around the table. It is necessary to get the margins</span>
 
276
<a name="l00190"></a>00190   <span class="comment">// correct on the table. If the lines are not joined, the margins will be</span>
 
277
<a name="l00191"></a>00191   <span class="comment">// the distance to the line, which is not right.</span>
 
278
<a name="l00192"></a>00192   <span class="keywordtype">void</span> <a class="code" href="a00562.html#a1b867f9bd1c26b92dcf946592e2db94c">AbsorbNearbyLines</a>();
 
279
<a name="l00193"></a>00193 
 
280
<a name="l00194"></a>00194   <span class="comment">// Nice utility function for finding partition gaps. You feed it a sorted</span>
 
281
<a name="l00195"></a>00195   <span class="comment">// list of all of the mins/maxes of the partitions in the table, and it gives</span>
 
282
<a name="l00196"></a>00196   <span class="comment">// you the gaps (middle). This works for both vertical and horizontal</span>
 
283
<a name="l00197"></a>00197   <span class="comment">// gaps.</span>
 
284
<a name="l00198"></a>00198   <span class="comment">//</span>
 
285
<a name="l00199"></a>00199   <span class="comment">// If you want to allow slight overlap in the division and the partitions,</span>
 
286
<a name="l00200"></a>00200   <span class="comment">// just scale down the partitions before inserting them in the list.</span>
 
287
<a name="l00201"></a>00201   <span class="comment">// Likewise, you can force at least some space between partitions.</span>
 
288
<a name="l00202"></a>00202   <span class="comment">// This trick is how the horizontal partitions are done (since the page</span>
 
289
<a name="l00203"></a>00203   <span class="comment">// skew could make it hard to find splits in the text).</span>
 
290
<a name="l00204"></a>00204   <span class="comment">//</span>
 
291
<a name="l00205"></a>00205   <span class="comment">// As a result, &quot;0 distance&quot; between closest partitions causes a gap.</span>
 
292
<a name="l00206"></a>00206   <span class="comment">// This is not a programmatic assumption. It is intentional and simplifies</span>
 
293
<a name="l00207"></a>00207   <span class="comment">// things.</span>
 
294
<a name="l00208"></a>00208   <span class="comment">//</span>
 
295
<a name="l00209"></a>00209   <span class="comment">// &quot;max_merged&quot; indicates both the minimum number of stacked partitions</span>
 
296
<a name="l00210"></a>00210   <span class="comment">// to cause a cell (add 1 to it), and the maximum number of partitions that</span>
 
297
<a name="l00211"></a>00211   <span class="comment">// a grid line can intersect. For example, if max_merged is 0, then lines</span>
 
298
<a name="l00212"></a>00212   <span class="comment">// are inserted wherever space exists between partitions. If it is 2,</span>
 
299
<a name="l00213"></a>00213   <span class="comment">// lines may intersect 2 partitions at most, but you also need at least</span>
 
300
<a name="l00214"></a>00214   <span class="comment">// 2 partitions to generate a line.</span>
 
301
<a name="l00215"></a>00215   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00562.html#a855165a2c1cf7e18aa4df0d56b56d86c">FindCellSplitLocations</a>(<span class="keyword">const</span> <a class="code" href="a00403.html">GenericVector&lt;int&gt;</a>&amp; min_list,
 
302
<a name="l00216"></a>00216                                      <span class="keyword">const</span> <a class="code" href="a00403.html">GenericVector&lt;int&gt;</a>&amp; max_list,
 
303
<a name="l00217"></a>00217                                      <span class="keywordtype">int</span> max_merged,
 
304
<a name="l00218"></a>00218                                      <a class="code" href="a00403.html">GenericVector&lt;int&gt;</a>* locations);
 
305
<a name="l00219"></a>00219 
 
306
<a name="l00223"></a>00223 
 
307
<a name="l00224"></a>00224   <span class="comment">// Counts the number of ColPartitions that intersect vertical cell</span>
 
308
<a name="l00225"></a>00225   <span class="comment">// division at this x value. Used by VerifyLinedTable.</span>
 
309
<a name="l00226"></a>00226   <span class="keywordtype">int</span> <a class="code" href="a00562.html#ae4f7bc2ae0ce34f6ba90c262cb4042b5">CountVerticalIntersections</a>(<span class="keywordtype">int</span> x);
 
310
<a name="l00227"></a>00227   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a9d51b6ec44c4019aeffb8d29e53411e7">CountHorizontalIntersections</a>(<span class="keywordtype">int</span> y);
 
311
<a name="l00228"></a>00228 
 
312
<a name="l00229"></a>00229   <span class="comment">// Counts how many text partitions are in this box.</span>
 
313
<a name="l00230"></a>00230   <span class="keywordtype">int</span> <a class="code" href="a00562.html#ae190c12603d6999e32720726ccec6f6c">CountPartitions</a>(<span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>&amp; box);
 
314
<a name="l00231"></a>00231 
 
315
<a name="l00235"></a>00235 
 
316
<a name="l00236"></a>00236   <span class="comment">// Input data, used as read only data to make decisions.</span>
 
317
<a name="l00237"></a><a class="code" href="a00562.html#a3e7a1ec39e82e5f0cca9c11133ddfe1b">00237</a>   <a class="code" href="a00324.html">ColPartitionGrid</a>* <a class="code" href="a00562.html#a3e7a1ec39e82e5f0cca9c11133ddfe1b">text_grid_</a>;    <span class="comment">// Text ColPartitions</span>
 
318
<a name="l00238"></a><a class="code" href="a00562.html#a62fec6d4270cd340c843b445f85de7a3">00238</a>   <a class="code" href="a00324.html">ColPartitionGrid</a>* <a class="code" href="a00562.html#a62fec6d4270cd340c843b445f85de7a3">line_grid_</a>;    <span class="comment">// Line ColPartitions</span>
 
319
<a name="l00239"></a>00239   <span class="comment">// Table structure.</span>
 
320
<a name="l00240"></a>00240   <span class="comment">// bounding box is a convenient external representation.</span>
 
321
<a name="l00241"></a>00241   <span class="comment">// cell_x_ and cell_y_ indicate the grid lines.</span>
 
322
<a name="l00242"></a><a class="code" href="a00562.html#ad73e474cdce4ccd7af1a09efa6fa9fa9">00242</a>   <a class="code" href="a00592.html">TBOX</a> <a class="code" href="a00562.html#ad73e474cdce4ccd7af1a09efa6fa9fa9">bounding_box_</a>;              <span class="comment">// Bounding box</span>
 
323
<a name="l00243"></a><a class="code" href="a00562.html#aa44caf479da7fa5f65c5600063e7a073">00243</a>   <a class="code" href="a00404.html">GenericVectorEqEq&lt;int&gt;</a> <a class="code" href="a00562.html#aa44caf479da7fa5f65c5600063e7a073">cell_x_</a>;  <span class="comment">// Locations of vertical divisions (sorted)</span>
 
324
<a name="l00244"></a><a class="code" href="a00562.html#a61ad297f7e3351085670324ec9f4a95f">00244</a>   <a class="code" href="a00404.html">GenericVectorEqEq&lt;int&gt;</a> <a class="code" href="a00562.html#a61ad297f7e3351085670324ec9f4a95f">cell_y_</a>;  <span class="comment">// Locations of horizontal divisions (sorted)</span>
 
325
<a name="l00245"></a><a class="code" href="a00562.html#a1480c3fdb3fa9e7de7a3a032351004a4">00245</a>   <span class="keywordtype">bool</span> <a class="code" href="a00562.html#a1480c3fdb3fa9e7de7a3a032351004a4">is_lined_</a>;                  <span class="comment">// Is the table backed up by a line structure</span>
 
326
<a name="l00246"></a>00246   <span class="comment">// Table margins, set via CalculateMargins</span>
 
327
<a name="l00247"></a><a class="code" href="a00562.html#aae33c28056468e9da3b8b652e3cf0c94">00247</a>   <span class="keywordtype">int</span> <a class="code" href="a00562.html#aae33c28056468e9da3b8b652e3cf0c94">space_above_</a>;
 
328
<a name="l00248"></a><a class="code" href="a00562.html#a5d0168255bb07d28f1e30276d3fb751c">00248</a>   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a5d0168255bb07d28f1e30276d3fb751c">space_below_</a>;
 
329
<a name="l00249"></a><a class="code" href="a00562.html#a369e1cab57c1cf20f454d31bc2d9b69c">00249</a>   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a369e1cab57c1cf20f454d31bc2d9b69c">space_left_</a>;
 
330
<a name="l00250"></a><a class="code" href="a00562.html#a950d1abfe05a5582cc71617d3e689c80">00250</a>   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a950d1abfe05a5582cc71617d3e689c80">space_right_</a>;
 
331
<a name="l00251"></a><a class="code" href="a00562.html#a69b525ae08de1ff7dd256f61b9ae28b8">00251</a>   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a69b525ae08de1ff7dd256f61b9ae28b8">median_cell_height_</a>;
 
332
<a name="l00252"></a><a class="code" href="a00562.html#a4d6c741190fdf2e49551baf63e53dafe">00252</a>   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a4d6c741190fdf2e49551baf63e53dafe">median_cell_width_</a>;
 
333
<a name="l00253"></a>00253   <span class="comment">// Filters, used to prevent awkward partitions from destroying structure.</span>
 
334
<a name="l00254"></a><a class="code" href="a00562.html#a7e77d9ccc738260e085d54d840020844">00254</a>   <span class="keywordtype">int</span> <a class="code" href="a00562.html#a7e77d9ccc738260e085d54d840020844">max_text_height_</a>;
 
335
<a name="l00255"></a>00255 };
 
336
<a name="l00256"></a>00256 
 
337
<a name="l00257"></a><a class="code" href="a00589.html">00257</a> <span class="keyword">class </span><a class="code" href="a00589.html">TableRecognizer</a> {
 
338
<a name="l00258"></a>00258  <span class="keyword">public</span>:
 
339
<a name="l00259"></a>00259   <a class="code" href="a00589.html#af82ad8abb0e3f94edb554594b9e41b55">TableRecognizer</a>();
 
340
<a name="l00260"></a>00260   <a class="code" href="a00589.html#a5a661cb9168813a34fe23af441958bb2">~TableRecognizer</a>();
 
341
<a name="l00261"></a>00261 
 
342
<a name="l00262"></a>00262   <span class="comment">// Initialization code. Must be called after the constructor.</span>
 
343
<a name="l00263"></a>00263   <span class="keywordtype">void</span> <a class="code" href="a00589.html#aca159b4dcd53ac99591aff44ce50a015">Init</a>();
 
344
<a name="l00264"></a>00264 
 
345
<a name="l00268"></a>00268 
 
346
<a name="l00269"></a>00269   <span class="comment">// Sets the grids used by the table. These can be changed between</span>
 
347
<a name="l00270"></a>00270   <span class="comment">// calls to Recognize. They are treated as read-only data.</span>
 
348
<a name="l00271"></a>00271   <span class="keywordtype">void</span> <a class="code" href="a00589.html#abdb2fec4ac7970b190ceaaf4bfb4368f">set_text_grid</a>(<a class="code" href="a00324.html">ColPartitionGrid</a>* text);
 
349
<a name="l00272"></a>00272   <span class="keywordtype">void</span> <a class="code" href="a00589.html#a969a85b74ae52c0fc72da54e66ed93a6">set_line_grid</a>(<a class="code" href="a00324.html">ColPartitionGrid</a>* lines);
 
350
<a name="l00273"></a>00273   <span class="comment">// Sets some additional constraints on the table.</span>
 
351
<a name="l00274"></a>00274   <span class="keywordtype">void</span> <a class="code" href="a00589.html#ad24b027f3a4261cf7cb25f03646e58de">set_min_height</a>(<span class="keywordtype">int</span> height);
 
352
<a name="l00275"></a>00275   <span class="keywordtype">void</span> <a class="code" href="a00589.html#a394e60c5a4a61f8572ae33d2fade3ee3">set_min_width</a>(<span class="keywordtype">int</span> width);
 
353
<a name="l00276"></a>00276   <span class="comment">// Filters text partitions that are ridiculously tall to prevent</span>
 
354
<a name="l00277"></a>00277   <span class="comment">// merging rows. Note that &quot;filters&quot; refers to allowing horizontal</span>
 
355
<a name="l00278"></a>00278   <span class="comment">// cells to slice through them on the premise that they were</span>
 
356
<a name="l00279"></a>00279   <span class="comment">// merged text rows during previous layout.</span>
 
357
<a name="l00280"></a>00280   <span class="keywordtype">void</span> <a class="code" href="a00589.html#a5c4fca3ea6f9452c7ec5a76f2e085a0c">set_max_text_height</a>(<span class="keywordtype">int</span> height);
 
358
<a name="l00281"></a>00281 
 
359
<a name="l00282"></a>00282   <span class="comment">// Given a guess location, the RecognizeTable function will try to find a</span>
 
360
<a name="l00283"></a>00283   <span class="comment">// structured grid in the area. On success, it will return a new</span>
 
361
<a name="l00284"></a>00284   <span class="comment">// StructuredTable (and assumes you will delete it). Otherwise,</span>
 
362
<a name="l00285"></a>00285   <span class="comment">// NULL is returned.</span>
 
363
<a name="l00286"></a>00286   <span class="comment">//</span>
 
364
<a name="l00287"></a>00287   <span class="comment">// Keep in mind, this may &quot;overgrow&quot; or &quot;undergrow&quot; the size of guess.</span>
 
365
<a name="l00288"></a>00288   <span class="comment">// Ideally, there is a either a one-to-one correspondence between</span>
 
366
<a name="l00289"></a>00289   <span class="comment">// the guess and table or no table at all. This is not the best of</span>
 
367
<a name="l00290"></a>00290   <span class="comment">// assumptions right now, but was made to try to keep things simple in</span>
 
368
<a name="l00291"></a>00291   <span class="comment">// the first pass.</span>
 
369
<a name="l00292"></a>00292   <span class="comment">//</span>
 
370
<a name="l00293"></a>00293   <span class="comment">// If a line structure is available on the page in the given region,</span>
 
371
<a name="l00294"></a>00294   <span class="comment">// the table will use the linear structure as it is.</span>
 
372
<a name="l00295"></a>00295   <span class="comment">// Otherwise, it will try to maximize the whitespace around it while keeping</span>
 
373
<a name="l00296"></a>00296   <span class="comment">// a grid structure. This is somewhat working.</span>
 
374
<a name="l00297"></a>00297   <span class="comment">//</span>
 
375
<a name="l00298"></a>00298   <span class="comment">// Since the combination of adjustments can get high, effort was</span>
 
376
<a name="l00299"></a>00299   <span class="comment">// originally made to keep the number of adjustments linear in the number</span>
 
377
<a name="l00300"></a>00300   <span class="comment">// of partitions. The underlying structure finding code used to be</span>
 
378
<a name="l00301"></a>00301   <span class="comment">// much more complex. I don&#39;t know how necessary this constraint is anymore.</span>
 
379
<a name="l00302"></a>00302   <span class="comment">// The evaluation of a possible table is kept within O(nlogn) in the size of</span>
 
380
<a name="l00303"></a>00303   <span class="comment">// the table (where size is the number of partitions in the table).</span>
 
381
<a name="l00304"></a>00304   <span class="comment">// As a result, the algorithm is capable of O(n^2 log n). Depending</span>
 
382
<a name="l00305"></a>00305   <span class="comment">// on the grid search size, it may be higher.</span>
 
383
<a name="l00306"></a>00306   <span class="comment">//</span>
 
384
<a name="l00307"></a>00307   <span class="comment">// Last note: it is possible to just try all partition boundaries at a high</span>
 
385
<a name="l00308"></a>00308   <span class="comment">// level O(n^4) and do a verification scheme (at least O(nlogn)). If there</span>
 
386
<a name="l00309"></a>00309   <span class="comment">// area 200 partitions on a page, this could be too costly. Effort could go</span>
 
387
<a name="l00310"></a>00310   <span class="comment">// into pruning the search, but I opted for something quicker. I&#39;m confident</span>
 
388
<a name="l00311"></a>00311   <span class="comment">// that the independent adjustments can get similar results and keep the</span>
 
389
<a name="l00312"></a>00312   <span class="comment">// complextiy down. However, the other approach could work without using</span>
 
390
<a name="l00313"></a>00313   <span class="comment">// TableFinder at all if it is fast enough.  It comes down to properly</span>
 
391
<a name="l00314"></a>00314   <span class="comment">// deciding what is a table. The code currently relies on TableFinder&#39;s</span>
 
392
<a name="l00315"></a>00315   <span class="comment">// guess to the location of a table for that.</span>
 
393
<a name="l00316"></a>00316   <a class="code" href="a00562.html">StructuredTable</a>* <a class="code" href="a00589.html#adc08877ea279ece9d88e2e69cd00b2b4">RecognizeTable</a>(<span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>&amp; guess_box);
 
394
<a name="l00317"></a>00317 
 
395
<a name="l00318"></a>00318  <span class="keyword">protected</span>:
 
396
<a name="l00322"></a>00322 
 
397
<a name="l00323"></a>00323   <span class="comment">// Returns true if the given box has a lined table within it. The</span>
 
398
<a name="l00324"></a>00324   <span class="comment">// table argument will be updated with the table if the table exists.</span>
 
399
<a name="l00325"></a>00325   <span class="keywordtype">bool</span> <a class="code" href="a00589.html#a09c44b26f6ef2bf6308b669031cc00f1">RecognizeLinedTable</a>(<span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>&amp; guess_box, <a class="code" href="a00562.html">StructuredTable</a>* table);
 
400
<a name="l00326"></a>00326   <span class="comment">// Returns true if the given box has a large number of horizontal and</span>
 
401
<a name="l00327"></a>00327   <span class="comment">// vertical lines present. If so, we assume the extent of these lines</span>
 
402
<a name="l00328"></a>00328   <span class="comment">// uniquely defines a table and find that table via SolveLinedTable.</span>
 
403
<a name="l00329"></a>00329   <span class="keywordtype">bool</span> <a class="code" href="a00589.html#a9d994f1b39135c0a95e558e8bc0489ec">HasSignificantLines</a>(<span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>&amp; guess);
 
404
<a name="l00330"></a>00330 
 
405
<a name="l00331"></a>00331   <span class="comment">// Given enough horizontal and vertical lines in a region, find a bounding</span>
 
406
<a name="l00332"></a>00332   <span class="comment">// box that encloses all of them (as well as newly introduced lines).</span>
 
407
<a name="l00333"></a>00333   <span class="comment">// The bounding box is the smallest box that encloses the lines in guess</span>
 
408
<a name="l00334"></a>00334   <span class="comment">// without having any lines sticking out of it.</span>
 
409
<a name="l00335"></a>00335   <span class="comment">// bounding_box is an in/out parameter.</span>
 
410
<a name="l00336"></a>00336   <span class="comment">// On input, it in the extents of the box to search.</span>
 
411
<a name="l00337"></a>00337   <span class="comment">// On output, it is the resulting bounding box.</span>
 
412
<a name="l00338"></a>00338   <span class="keywordtype">bool</span> <a class="code" href="a00589.html#a1976dd404a086faf445085759cc3024c">FindLinesBoundingBox</a>(<a class="code" href="a00592.html">TBOX</a>* bounding_box);
 
413
<a name="l00339"></a>00339   <span class="comment">// Iteration in above search.</span>
 
414
<a name="l00340"></a>00340   <span class="comment">// bounding_box is an in/out parameter.</span>
 
415
<a name="l00341"></a>00341   <span class="comment">// On input, it in the extents of the box to search.</span>
 
416
<a name="l00342"></a>00342   <span class="comment">// On output, it is the resulting bounding box.</span>
 
417
<a name="l00343"></a>00343   <span class="keywordtype">bool</span> <a class="code" href="a00589.html#a0e3b073b746ba18778b10413fe16f4e0">FindLinesBoundingBoxIteration</a>(<a class="code" href="a00592.html">TBOX</a>* bounding_box);
 
418
<a name="l00344"></a>00344 
 
419
<a name="l00348"></a>00348 
 
420
<a name="l00349"></a>00349   <span class="comment">// Returns true if the given box has a whitespaced table within it. The</span>
 
421
<a name="l00350"></a>00350   <span class="comment">// table argument will be updated if the table exists. Also note</span>
 
422
<a name="l00351"></a>00351   <span class="comment">// that this method will fail if the guess_box center is not</span>
 
423
<a name="l00352"></a>00352   <span class="comment">// mostly within the table.</span>
 
424
<a name="l00353"></a>00353   <span class="keywordtype">bool</span> <a class="code" href="a00589.html#ad40e89784fedeaa63f2b8e6088e9b270">RecognizeWhitespacedTable</a>(<span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>&amp; guess_box, <a class="code" href="a00562.html">StructuredTable</a>* table);
 
425
<a name="l00354"></a>00354 
 
426
<a name="l00355"></a>00355   <span class="comment">// Finds the location of a horizontal split relative to y.</span>
 
427
<a name="l00356"></a>00356   <span class="comment">// This function is mostly unused now. If the SolveWhitespacedTable</span>
 
428
<a name="l00357"></a>00357   <span class="comment">// changes much, it can be removed. Note, it isn&#39;t really as reliable</span>
 
429
<a name="l00358"></a>00358   <span class="comment">// as I thought. I went with alternatives for most of the other uses.</span>
 
430
<a name="l00359"></a>00359   <span class="keywordtype">int</span> <a class="code" href="a00589.html#a6852b6aaf9df0c7085a644b7696ff881">NextHorizontalSplit</a>(<span class="keywordtype">int</span> left, <span class="keywordtype">int</span> right, <span class="keywordtype">int</span> y, <span class="keywordtype">bool</span> top_to_bottom);
 
431
<a name="l00360"></a>00360 
 
432
<a name="l00361"></a>00361   <span class="comment">// Indicates that a table row is weak. This means that it has</span>
 
433
<a name="l00362"></a>00362   <span class="comment">// many missing data cells or very large cell heights compared.</span>
 
434
<a name="l00363"></a>00363   <span class="comment">// to the rest of the table.</span>
 
435
<a name="l00364"></a>00364   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="a00589.html#a3fb9b12226218c00102c77c2a9e2ca6f">IsWeakTableRow</a>(<a class="code" href="a00562.html">StructuredTable</a>* table, <span class="keywordtype">int</span> row);
 
436
<a name="l00365"></a>00365 
 
437
<a name="l00366"></a>00366   <span class="comment">// Input data, used as read only data to make decisions.</span>
 
438
<a name="l00367"></a><a class="code" href="a00589.html#a1ec03b4d8e7b7cd1361d23be47d5d81a">00367</a>   <a class="code" href="a00324.html">ColPartitionGrid</a>* <a class="code" href="a00589.html#a1ec03b4d8e7b7cd1361d23be47d5d81a">text_grid_</a>;    <span class="comment">// Text ColPartitions</span>
 
439
<a name="l00368"></a><a class="code" href="a00589.html#acef775b055806466bf907b9008a9f705">00368</a>   <a class="code" href="a00324.html">ColPartitionGrid</a>* <a class="code" href="a00589.html#acef775b055806466bf907b9008a9f705">line_grid_</a>;    <span class="comment">// Line ColPartitions</span>
 
440
<a name="l00369"></a>00369   <span class="comment">// Table constraints, a &quot;good&quot; table must satisfy these.</span>
 
441
<a name="l00370"></a><a class="code" href="a00589.html#a4a0cb917deb38c9cd761390e2e89967b">00370</a>   <span class="keywordtype">int</span> <a class="code" href="a00589.html#a4a0cb917deb38c9cd761390e2e89967b">min_height_</a>;
 
442
<a name="l00371"></a><a class="code" href="a00589.html#a99ef7bab6b09c69357a69f440235d83c">00371</a>   <span class="keywordtype">int</span> <a class="code" href="a00589.html#a99ef7bab6b09c69357a69f440235d83c">min_width_</a>;
 
443
<a name="l00372"></a>00372   <span class="comment">// Filters, used to prevent awkward partitions from destroying structure.</span>
 
444
<a name="l00373"></a><a class="code" href="a00589.html#a2d6b6326270fc127b50a497e4d0c6c7c">00373</a>   <span class="keywordtype">int</span> <a class="code" href="a00589.html#a2d6b6326270fc127b50a497e4d0c6c7c">max_text_height_</a>;  <span class="comment">// Horizontal lines may intersect taller text.</span>
 
445
<a name="l00374"></a>00374 };
 
446
<a name="l00375"></a>00375 
 
447
<a name="l00376"></a>00376 }  <span class="comment">// namespace tesseract</span>
 
448
<a name="l00377"></a>00377 
 
449
<a name="l00378"></a>00378 <span class="preprocessor">#endif  </span><span class="comment">/* TABLERECOG_H_ */</span>
 
450
</pre></div></div><!-- contents -->
 
451
</div>
 
452
<!-- window showing the filter options -->
 
453
<div id="MSearchSelectWindow"
 
454
     onmouseover="return searchBox.OnSearchSelectShow()"
 
455
     onmouseout="return searchBox.OnSearchSelectHide()"
 
456
     onkeydown="return searchBox.OnSearchSelectKey(event)">
 
457
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>
 
458
 
 
459
<!-- iframe showing the search results (closed by default) -->
 
460
<div id="MSearchResultsWindow">
 
461
<iframe src="javascript:void(0)" frameborder="0" 
 
462
        name="MSearchResults" id="MSearchResults">
 
463
</iframe>
 
464
</div>
 
465
 
 
466
  <div id="nav-path" class="navpath">
 
467
    <ul>
 
468
      <li class="navelem"><a class="el" href="a01145.html">tablerecog.h</a>      </li>
 
469
 
 
470
    <li class="footer">Generated on Mon Feb 3 2014 10:59:10 for tesseract by
 
471
    <a href="http://www.doxygen.org/index.html">
 
472
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
 
473
   </ul>
 
474
 </div>
 
475
 
 
476
 
 
477
</body>
 
478
</html>