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">
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/ccstruct/boxword.h Source File</title>
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);
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); });
25
<div id="top"><!-- do not remove this div! -->
29
<table cellspacing="0" cellpadding="0">
31
<tr style="height: 56px;">
34
<td style="padding-left: 0.5em;">
35
<div id="projectname">tesseract
36
 <span id="projectnumber">3.03</span>
48
<!-- Generated by Doxygen 1.7.6.1 -->
49
<script type="text/javascript">
50
var searchBox = new SearchBox("searchBox", "search",false,'Search');
52
<div id="navrow1" class="tabs">
54
<li><a href="index.html"><span>Main Page</span></a></li>
55
<li><a href="pages.html"><span>Related 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>
61
<div id="MSearchBox" class="MSearchBoxInactive">
63
<img id="MSearchSelect" src="search/mag_sel.png"
64
onmouseover="return searchBox.OnSearchSelectShow()"
65
onmouseout="return searchBox.OnSearchSelectHide()"
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>
78
<div id="navrow2" class="tabs2">
80
<li><a href="files.html"><span>File List</span></a></li>
81
<li><a href="globals.html"><span>File Members</span></a></li>
85
<div id="side-nav" class="ui-resizable side-nav-resizable">
87
<div id="nav-tree-contents">
90
<div id="splitbar" style="-moz-user-select:none;"
91
class="ui-resizable-handle">
94
<script type="text/javascript">
95
initNavTree('a00736.html','');
97
<div id="doc-content">
99
<div class="headertitle">
100
<div class="title">/usr/local/google/home/jbreiden/tesseract-ocr-read-only/ccstruct/boxword.h</div> </div>
102
<div class="contents">
103
<a href="a00736.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: boxword.h</span>
105
<a name="l00003"></a>00003 <span class="comment">// Description: Class to represent the bounding boxes of the output.</span>
106
<a name="l00004"></a>00004 <span class="comment">// Author: Ray Smith</span>
107
<a name="l00005"></a>00005 <span class="comment">// Created: Tue May 25 14:18:14 PDT 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 "License");</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 "AS IS" 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 TESSERACT_CSTRUCT_BOXWORD_H__</span>
122
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define TESSERACT_CSTRUCT_BOXWORD_H__</span>
123
<a name="l00022"></a>00022 <span class="preprocessor"></span>
124
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="a00826.html">genericvector.h</a>"</span>
125
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="a00790.html">rect.h</a>"</span>
126
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="a00862.html">unichar.h</a>"</span>
127
<a name="l00026"></a>00026
128
<a name="l00027"></a>00027 <span class="keyword">class </span><a class="code" href="a00280.html">BLOCK</a>;
129
<a name="l00028"></a>00028 <span class="keyword">class </span><a class="code" href="a00352.html">DENORM</a>;
130
<a name="l00029"></a>00029 <span class="keyword">struct </span><a class="code" href="a00635.html">TWERD</a>;
131
<a name="l00030"></a>00030 <span class="keyword">class </span><a class="code" href="a00642.html">UNICHARSET</a>;
132
<a name="l00031"></a>00031 <span class="keyword">class </span><a class="code" href="a00648.html">WERD</a>;
133
<a name="l00032"></a>00032 <span class="keyword">class </span><a class="code" href="a00649.html">WERD_CHOICE</a>;
134
<a name="l00033"></a>00033 <span class="keyword">class </span><a class="code" href="a00650.html">WERD_RES</a>;
135
<a name="l00034"></a>00034
136
<a name="l00035"></a>00035 <span class="keyword">namespace </span><a class="code" href="a01266.html#afed58feacb84df2de88bdd613cfdba6d">tesseract</a> {
137
<a name="l00036"></a>00036
138
<a name="l00037"></a>00037 <span class="comment">// Class to hold an array of bounding boxes for an output word and</span>
139
<a name="l00038"></a>00038 <span class="comment">// the bounding box of the whole word.</span>
140
<a name="l00039"></a><a class="code" href="a00287.html">00039</a> <span class="keyword">class </span><a class="code" href="a00287.html">BoxWord</a> {
141
<a name="l00040"></a>00040 <span class="keyword">public</span>:
142
<a name="l00041"></a>00041 <a class="code" href="a00287.html#a7467dd28609edc0c8635c6e2a53184ae">BoxWord</a>();
143
<a name="l00042"></a>00042 <span class="keyword">explicit</span> <a class="code" href="a00287.html#a7467dd28609edc0c8635c6e2a53184ae">BoxWord</a>(<span class="keyword">const</span> <a class="code" href="a00287.html">BoxWord</a>& src);
144
<a name="l00043"></a>00043 <a class="code" href="a00287.html#abd3273e3c4b4a949fa89d7bbbee0e4d9">~BoxWord</a>();
145
<a name="l00044"></a>00044
146
<a name="l00045"></a>00045 <a class="code" href="a00287.html">BoxWord</a>& <a class="code" href="a00287.html#a611c93e8803464085f680bd2b85b9c5e">operator=</a>(<span class="keyword">const</span> <a class="code" href="a00287.html">BoxWord</a>& src);
147
<a name="l00046"></a>00046
148
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="a00287.html#afabca4efb6b959b45ea2567aad48820d">CopyFrom</a>(<span class="keyword">const</span> <a class="code" href="a00287.html">BoxWord</a>& src);
149
<a name="l00048"></a>00048
150
<a name="l00049"></a>00049 <span class="comment">// Factory to build a BoxWord from a TWERD using the DENORMs on each blob to</span>
151
<a name="l00050"></a>00050 <span class="comment">// switch back to original image coordinates.</span>
152
<a name="l00051"></a>00051 <span class="keyword">static</span> <a class="code" href="a00287.html">BoxWord</a>* <a class="code" href="a00287.html#aab72d68adc48c35cbdcfa89f9aad5677">CopyFromNormalized</a>(<a class="code" href="a00635.html">TWERD</a>* tessword);
153
<a name="l00052"></a>00052
154
<a name="l00053"></a>00053 <span class="comment">// Clean up the bounding boxes from the polygonal approximation by</span>
155
<a name="l00054"></a>00054 <span class="comment">// expanding slightly, then clipping to the blobs from the original_word</span>
156
<a name="l00055"></a>00055 <span class="comment">// that overlap. If not null, the block provides the inverse rotation.</span>
157
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="a00287.html#af74a52ee479f2e2172b5fb15d680f9fa">ClipToOriginalWord</a>(<span class="keyword">const</span> <a class="code" href="a00280.html">BLOCK</a>* block, <a class="code" href="a00648.html">WERD</a>* original_word);
158
<a name="l00057"></a>00057
159
<a name="l00058"></a>00058 <span class="comment">// Merges the boxes from start to end, not including end, and deletes</span>
160
<a name="l00059"></a>00059 <span class="comment">// the boxes between start and end.</span>
161
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="a00287.html#a3a7da282c5432576b36cd7a8ec9702d8">MergeBoxes</a>(<span class="keywordtype">int</span> start, <span class="keywordtype">int</span> end);
162
<a name="l00061"></a>00061
163
<a name="l00062"></a>00062 <span class="comment">// Inserts a new box before the given index.</span>
164
<a name="l00063"></a>00063 <span class="comment">// Recomputes the bounding box.</span>
165
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="a00287.html#a23d6471fdda275e6448db555aecee1f3">InsertBox</a>(<span class="keywordtype">int</span> index, <span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>& box);
166
<a name="l00065"></a>00065
167
<a name="l00066"></a>00066 <span class="comment">// Deletes the box with the given index, and shuffles up the rest.</span>
168
<a name="l00067"></a>00067 <span class="comment">// Recomputes the bounding box.</span>
169
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="a00287.html#a8a85de03e0800fe425990e498b00f87c">DeleteBox</a>(<span class="keywordtype">int</span> index);
170
<a name="l00069"></a>00069
171
<a name="l00070"></a>00070 <span class="comment">// Deletes all the boxes stored in BoxWord.</span>
172
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="a00287.html#aede79b94bea39b3223d32137bab439e2">DeleteAllBoxes</a>();
173
<a name="l00072"></a>00072
174
<a name="l00073"></a>00073 <span class="comment">// This and other putatively are the same, so call the (permanent) callback</span>
175
<a name="l00074"></a>00074 <span class="comment">// for each blob index where the bounding boxes match.</span>
176
<a name="l00075"></a>00075 <span class="comment">// The callback is deleted on completion.</span>
177
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="a00287.html#aabd2c8e3b6f8dda66725754fa034cc8e">ProcessMatchedBlobs</a>(<span class="keyword">const</span> <a class="code" href="a00635.html">TWERD</a>& other, <a class="code" href="a00598.html">TessCallback1<int></a>* cb) <span class="keyword">const</span>;
178
<a name="l00077"></a>00077
179
<a name="l00078"></a><a class="code" href="a00287.html#aa3e49314fa288ca6b29fde03cc251cd9">00078</a> <span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>& <a class="code" href="a00287.html#aa3e49314fa288ca6b29fde03cc251cd9">bounding_box</a>()<span class="keyword"> const </span>{
180
<a name="l00079"></a>00079 <span class="keywordflow">return</span> bbox_;
181
<a name="l00080"></a>00080 }
182
<a name="l00081"></a><a class="code" href="a00287.html#afe001fe8fb7f2d3725b2ac2f542e9878">00081</a> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="a00287.html#afe001fe8fb7f2d3725b2ac2f542e9878">length</a>()<span class="keyword"> const </span>{
183
<a name="l00082"></a>00082 <span class="keywordflow">return</span> length_;
184
<a name="l00083"></a>00083 }
185
<a name="l00084"></a><a class="code" href="a00287.html#a022cfe52a644e9e800595f014b1fbcf5">00084</a> <span class="keyword">const</span> <a class="code" href="a00592.html">TBOX</a>& <a class="code" href="a00287.html#a022cfe52a644e9e800595f014b1fbcf5">BlobBox</a>(<span class="keywordtype">int</span> index)<span class="keyword"> const </span>{
186
<a name="l00085"></a>00085 <span class="keywordflow">return</span> boxes_[index];
187
<a name="l00086"></a>00086 }
188
<a name="l00087"></a>00087
189
<a name="l00088"></a>00088 <span class="keyword">private</span>:
190
<a name="l00089"></a>00089 <span class="keywordtype">void</span> ComputeBoundingBox();
191
<a name="l00090"></a>00090
192
<a name="l00091"></a>00091 <a class="code" href="a00592.html">TBOX</a> bbox_;
193
<a name="l00092"></a>00092 <span class="keywordtype">int</span> length_;
194
<a name="l00093"></a>00093 <a class="code" href="a00403.html">GenericVector<TBOX></a> boxes_;
195
<a name="l00094"></a>00094 };
196
<a name="l00095"></a>00095
197
<a name="l00096"></a>00096 } <span class="comment">// namespace tesseract.</span>
198
<a name="l00097"></a>00097
199
<a name="l00098"></a>00098
200
<a name="l00099"></a>00099 <span class="preprocessor">#endif // TESSERACT_CSTRUCT_BOXWORD_H__</span>
201
</pre></div></div><!-- contents -->
203
<!-- window showing the filter options -->
204
<div id="MSearchSelectWindow"
205
onmouseover="return searchBox.OnSearchSelectShow()"
206
onmouseout="return searchBox.OnSearchSelectHide()"
207
onkeydown="return searchBox.OnSearchSelectKey(event)">
208
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Defines</a></div>
210
<!-- iframe showing the search results (closed by default) -->
211
<div id="MSearchResultsWindow">
212
<iframe src="javascript:void(0)" frameborder="0"
213
name="MSearchResults" id="MSearchResults">
217
<div id="nav-path" class="navpath">
219
<li class="navelem"><a class="el" href="a00736.html">boxword.h</a> </li>
221
<li class="footer">Generated on Mon Feb 3 2014 10:59:07 for tesseract by
222
<a href="http://www.doxygen.org/index.html">
223
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>