-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathindex.html
68 lines (66 loc) · 2.06 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
<!doctype html>
<html>
<head>
<title>avinashsonee</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;
}
img {
margin: 5px 5px 0 0;
}
</style>
</head>
<body>
<div class="note">
Example in response to <a href="https://github.com/skotz/cbl-js/issues/34">Question #34</a>.
</div>
<div class="main">
<div id="debugPreprocessed"></div>
<div id="debugSegmented"></div>
<div id="solution"></div>
<div id="visualizeModel"></div>
</div>
<script>
var cbl = new CBL({
preprocess: function(img) {
img.cropRelative(2, 2, 2, 2);
img.debugImage("debugPreprocessed");
img.binarize(120);
img.debugImage("debugPreprocessed");
img.blur();
img.debugImage("debugPreprocessed");
img.binarize(50);
img.debugImage("debugPreprocessed");
img.colorRegions(50, true, 1);
img.debugImage("debugPreprocessed");
},
character_set: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
pattern_width: 25,
pattern_height: 25,
blob_min_pixels: 10,
blob_max_pixels: 250,
allow_console_log: true,
blob_console_debug: true,
perceptive_colorspace: true,
blob_debug: "debugSegmented"
});
cbl.train("6HYFHM.png");
cbl.train("76US7T.png");
cbl.train("D9QQ8U.png");
cbl.train("H6E7V2.png");
var saveModel = function() {
// cbl.condenseModel(); // don't do this since the letters vary in rotation
cbl.sortModel();
cbl.visualizeModel("visualizeModel");
cbl.saveModel();
}
</script>
</body>
</html>