-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathindex.html
62 lines (60 loc) · 2.09 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
<!doctype html>
<html>
<head>
<title>C4SH</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="/../../cbl.js"></script>
<style>
#debugPreprocessed img {
display: block;
}
.note {
margin: 0 0 15px 0;
font-weight: bold;
}
</style>
</head>
<body>
<div class="note">
Note: This is a segmentation-only example in response to <a href="https://github.com/skotz/cbl-js/issues/20">Question #20</a>.
</div>
<div class="main">
<img id="testImage" src="3.png" />
<div id="debugPreprocessed"></div>
<div id="debugSegmented"></div>
<div id="solution"></div>
</div>
<script>
var cbl = new CBL({
preprocess: function(img) {
img.debugImage("debugPreprocessed");
img.convolute([ [ 1, 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, -48, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1, 1] ]);
img.debugImage("debugPreprocessed");
img.colorRegions(2, true);
img.debugImage("debugPreprocessed");
},
character_set: "0123456789",
blob_min_pixels: 2000,
blob_max_pixels: 10000,
pattern_width: 64,
pattern_height: 64,
pattern_maintain_ratio: true,
allow_console_log: true,
perceptive_colorspace: true,
blob_debug: "debugSegmented",
model_loaded: function() {
document.getElementById("aSolve").style.display = "inline-block";
}
});
cbl.train("3.png");
cbl.train("2.png");
cbl.train("1.png");
</script>
</body>
</html>