-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathImgWindow.html
141 lines (132 loc) · 4.24 KB
/
ImgWindow.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
<!--FantAscII v0.1 Copyright Ostler et al. (Jimmy Ostler, Pachie Ackerman, August Bergquist, Benjamin Weber)-->
<!DOCTYPE html>
<html>
<head>
<Title>
Real Time Edge Detection with OpenCV.js
</Title>
<script>
const scalars = [1,2,2.5]
const chunks = [10,5,4]
var scalarIndex = 0
var cameraWidth = 400;
var cameraHeight = 300;
var uploadWidth = 1600
var uploadHeight = 1600
var scalar = scalars[scalarIndex];
var chunksVal = chunks[scalarIndex];
var fontColor = "white"
var asciiFont = "bold 11px Courier New"
var citeFont = " 14px Courier"
</script>
<script type="text/javascript" src="opencv.js" defer></script>
<script type="text/javascript" src="edgeDetection.js" defer></script>
<script type="text/javascript" src="pachieEdgeCode.js" defer></script>
<link rel="stylesheet" href="./styles.css">
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body>
<video id="video" playsinline autoplay></video>
<div class="page">
<!-- left menu -->
<div class="menu" id="left-menu">
<!-- video settings-->
<div class="settings" id="video-settings">
<p>Video</p>
<button onclick="startVideo()">
<img src="cameraIcons/Camera_On.png">
<p>Start</p>
</button>
<button onclick="pausePlayVideo()">
<img src="cameraIcons/Pause-Play.png">
<p>Pause / Play</p>
</button>
<button onclick="stopVideo()">
<img src="cameraIcons/Stop_Video.png">
<p>Stop</p>
</button>
</div>
<div class="settings" id="gradient-settings">
<!-- gradient settings-->
<p>Gradient</p>
<button onclick="invertGrad()">
<img src="cameraIcons/Invert_Gradient.png">
<p>Invert</p>
</button>
<button onclick="loopGrad()">
<img src="cameraIcons/Loop_Through_Gradients.png">
<p>Loop Through</p>
</button>
<button onclick="resetGrad()">
<img src="cameraIcons/Reset_to_Default_Gradient.png">
<p>Reset to Default</p>
</button>
<button onclick="addGrad()">
<img src="cameraIcons/Add_Gradient.png">
<p>Add</p>
</button>
</div>
</div>
<div>
<canvas id = "streamCanvas" style = "display:none"></canvas>
<canvas id = "edgeDetectionCanvas" style = "display:none"></canvas>
<canvas id = "grayCharStreamCanvas" style = "display:none"></canvas>
<canvas id = "imgUpload" style="border: 1px solid white; display:none"></canvas>
<canvas id = "grayImgUpload" style="display:none" ></canvas>
<div class="canvas-div">
<canvas id = "charCanvas"></canvas>
</div>
</div>
<!-- right menu -->
<div class="menu" id="right-menu">
<!-- upload image settings-->
<div class="settings" id="upload-image-settings">
<p>Upload Image</p>
<input type = "file" id = "fileInput" accept="image/*">
<output></output>
<button onclick="convertImage()">
<img src="cameraIcons/Convert_Image.png">
<p>Convert</p>
</button>
</div>
<!-- misc settings-->
<div class="settings" id="misc-settings">
<p></p>
<button onclick="swapAscii()">
<img src="cameraIcons/Toggle_Line_Char_Ascii.png">
<p>Toggle Line / Char AscII</p>
</button>
<button onclick="changeAsciiSize()">
<img src="cameraIcons/Change_Canvas_Size.png">
<p>Change Canvas Size</p>
</button>
<button onclick="lightDarkMode()">
<img src="cameraIcons/Light_Dark_Mode.png">
<p>Toggle Light/Dark Mode</p>
</button>
<button onclick="copyText()">
<img src="cameraIcons/Copy.png">
<p>Copy Ascii</p>
</button>
<button onclick="saveToTXT()">
<p>Save as TXT</p>
</button>
</div>
</div>
</div>
<script>
streamCanvas.width = cameraWidth;
streamCanvas.height = cameraHeight;
edgeDetectionCanvas.width = cameraWidth;
edgeDetectionCanvas.height = cameraHeight;
grayCharStreamCanvas.width = cameraWidth;
grayCharStreamCanvas.height = cameraHeight;
charCanvas.width = cameraWidth*scalar*.61;
charCanvas.height = cameraHeight*scalar;
imgUpload.width = uploadWidth;
imgUpload.height = uploadHeight;
grayImgUpload.width = uploadWidth/(10/scalars[scalarIndex]);
grayImgUpload.height = uploadHeight/(10/scalars[scalarIndex]);
</script>
</body>
</html>