-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
367 lines (227 loc) · 11.5 KB
/
index.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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<!doctype html>
<html>
<head>
<meta charset='utf-8' />
<title>stroke-width-transform 1.0.0 | Documentation</title>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
<link href='assets/style.css' type='text/css' rel='stylesheet' />
<link href='assets/github.css' type='text/css' rel='stylesheet' />
<link href='assets/split.css' type='text/css' rel='stylesheet' />
</head>
<body class='documentation m0'>
<div class='flex'>
<div id='split-left' class='overflow-auto fs0 height-viewport-100'>
<div class='py1 px2'>
<h3 class='mb0 no-anchor'>stroke-width-transform</h3>
<div class='mb1'><code>1.0.0</code></div>
<input
placeholder='Filter'
id='filter-input'
class='col12 block input'
type='text' />
<div id='toc'>
<ul class='list-reset h5 py1-ul'>
<li><a
href='#strokewidthtransform'
class="">
strokeWidthTransform
</a>
</li>
</ul>
</div>
<div class='mt1 h6 quiet'>
<a href='http://documentation.js.org/reading-documentation.html'>Need help reading this?</a>
</div>
</div>
</div>
<div id='split-right' class='relative overflow-auto height-viewport-100'>
<section class='p2 mb2 clearfix bg-white minishadow'>
<div class='clearfix'>
<h3 class='fl m0' id='strokewidthtransform'>
strokeWidthTransform
</h3>
<a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/image-js/stroke-width-transform/blob/43eb7c5db3278a5f855145213c5cdfdf40adef45/src/loadSWT.js#L59-L78'>
<span>src/loadSWT.js</span>
</a>
</div>
<p>Get the bounding boxes over the text from the image using stroke width transform (SWT)</p>
<div class='pre p1 fill-light mt0'>strokeWidthTransform(image: <a href="https://developer.mozilla.org/docs/Web/API/HTMLImageElement/Image">Image</a>, options: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a><Roi></div>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>image</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/API/HTMLImageElement/Image">Image</a>)</code>
</div>
</div>
<div class='space-bottom0'>
<div>
<span class='code bold'>options</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>)</code>
</div>
<table class='mt1 mb2 fixed-table h5 col-12'>
<colgroup>
<col width='30%' />
<col width='70%' />
</colgroup>
<thead>
<tr class='bold fill-light'>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody class='mt1'>
<tr>
<td class='break-word'><span class='code bold'>options.scaleInvariant</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
(default <code>true</code>)
</td>
<td class='break-word'><span>Enable scale invariant SWT (to scale to different sizes and then combine the results)
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.interval</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>1</code>)
</td>
<td class='break-word'><span>Intervals for the scale invariant option
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.minNeighbors</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>1</code>)
</td>
<td class='break-word'><span>Minimal neighbors to make a detection valid, this is for scale-invariant version.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.size</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>3</code>)
</td>
<td class='break-word'><span>Size of the sobel operator for Canny Edge.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.lowThresh</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>124</code>)
</td>
<td class='break-word'><span>Low threshold for Canny Edge.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.highThresh</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>204</code>)
</td>
<td class='break-word'><span>High threshold for Canny Edge.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.maxHeight</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>300</code>)
</td>
<td class='break-word'><span>Maximum height for a letter.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.minHeight</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>8</code>)
</td>
<td class='break-word'><span>Minimum height for a letter.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.minArea</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>38</code>)
</td>
<td class='break-word'><span>Minimum occupied area for a letter.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.aspectRatio</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>8</code>)
</td>
<td class='break-word'><span>Maximum aspect ratio for a letter.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.stdRatio</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>0.83</code>)
</td>
<td class='break-word'><span>The inner-class standard derivation when grouping letters.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.thicknessRatio</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>1.5</code>)
</td>
<td class='break-word'><span>The allowable thickness variance when grouping letters.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.heightRatio</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>1.7</code>)
</td>
<td class='break-word'><span>The allowable height variance when grouping letters.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.intensityThresh</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>31</code>)
</td>
<td class='break-word'><span>The allowable intensity variance when grouping letters.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.distanceRatio</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>2.9</code>)
</td>
<td class='break-word'><span>The allowable distance variance when grouping letters.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.intersectRatio</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>1.3</code>)
</td>
<td class='break-word'><span>The allowable intersect variance when grouping letters.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.elongateRatio</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>1.9</code>)
</td>
<td class='break-word'><span>The allowable elongate variance when grouping letters.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.letterThresh</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>3</code>)
</td>
<td class='break-word'><span>The allowable letter threshold.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.breakdown</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>
(default <code>true</code>)
</td>
<td class='break-word'><span>If breakdown text line into words.
</span></td>
</tr>
<tr>
<td class='break-word'><span class='code bold'>options.breakdownRatio</span> <code class='quiet'><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code>
(default <code>1</code>)
</td>
<td class='break-word'><span>Apply OTSU method and if inter-class variance above the threshold, it will be break down into words.
</span></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a><Roi></code>:
Array of regions that contains text.
</section>
</div>
</div>
<script src='assets/anchor.js'></script>
<script src='assets/split.js'></script>
<script src='assets/site.js'></script>
</body>
</html>