-
Notifications
You must be signed in to change notification settings - Fork 0
/
Neighbors.html
65 lines (54 loc) · 1.59 KB
/
Neighbors.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>4 and 8 Neighbors</title>
<script src="lib/ImageJS.js"></script>
<style>
.img {
display: inline-table;
}
</style>
</head>
<body>
<canvas id="rawCanvas" class="card" width="320" height="240" hidden></canvas>
<figure class="img">
<image id="raw"></image>
<figcaption>Original</figcaption>
</figure>
<figure class="img">
<image id="four"></image>
<figcaption>Four Neighbors Original</figcaption>
</figure>
<figure class="img">
<image id="fourOverlap"></image>
<figcaption>Four Neighbors Computed</figcaption>
</figure>
<figure class="img">
<image id="eight"></image>
<figcaption>Eight Neighbors Original</figcaption>
</figure>
<figure class="img">
<image id="eightOverlap"></image>
<figcaption>Eight Neighbors Computed</figcaption>
</figure>
<script>
window.imagejs = new ImageJS(rawCanvas);
window.imagejs.loadImageURL('img/wallpaper18.jpg', function () {
raw.src = rawCanvas.toDataURL();
window.imagejs.computeFourNeighborhood();
four.src = rawCanvas.toDataURL();
window.imagejs.reset();
window.imagejs.computeFourNeighborhood(true);
fourOverlap.src = rawCanvas.toDataURL();
window.imagejs.reset();
window.imagejs.computeEightNeighborhood();
eight.src = rawCanvas.toDataURL();
window.imagejs.reset();
window.imagejs.computeEightNeighborhood(true);
eightOverlap.src = rawCanvas.toDataURL();
//window.imagejs.reset();
});
</script>
</body>
</html>