-
Notifications
You must be signed in to change notification settings - Fork 0
/
cam.html
191 lines (174 loc) · 7.73 KB
/
cam.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ESP32 Camera</title>
<meta name="robots" content="index,follow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript">
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if ( (charCode > 31 && charCode < 48) || charCode > 57) {
return false;
}
return true;
}
</script>
</head>
<body onload="updateForm()">
<div class="container content">
<div class="page-header">
</div>
<div class="panel panel-default">
<div class="panel-body">
<img src='stream/d' onload='imageRefresh(this, 30);' style="max-width: 100%;">
<form id="uPyCam">
<section class="section-preview">
<div class="form-group">
<label for="formSize">Frame size</label>
<select class="selectpicker" id="formSize" style="width: 100%;">
<option value="0">96X96</option>
<option value="1">QQVGA</option>
<option value="2">QCIF</option>
<option value="3">HQVGA</option>
<option value="4">240X240</option>
<option value="5">QVGA</option>
<option value="6">CIF</option>
<option value="7">HVGA</option>
<option value="8">VGA</option>
<option value="9">SVGA</option>
<option value="10">XGA</option>
<option value="11">HD</option>
<option value="12">SXGA</option>
<option value="13">UXGA</option>
<option value="14">FHD</option>
<option value="15">P_HD</option>
<option value="16">P_3MP</option>
<option value="17">QXGA</option>
<option value="18">QHD</option>
<option value="19">WQXGA</option>
<option value="20">P_FHD</option>
<option value="21">QSXGA</option>
</select>
</div>
<div class="form-group">
<label for="formSaturation">Saturation (-2, 2):</label>
<input type="range" min="0" max="4" value="2" step="1" class="slider custom-range" id="formSaturation" style="width: 100%;">
</div>
<div class="form-group">
<label for="formBrightness">Brightness (-2, 2):</label>
<input type="range" min="0" max="4" value="2" step="1" class="slider custom-range" id="formBrightness" style="width: 100%;">
</div>
<div class="form-group">
<label for="formContrast">Contrast (-2, 2):</label>
<input type="range" min="0" max="4" value="2" step="1" class="slider custom-range" id="formContrast" style="width: 100%;">
</div>
<div class="form-group">
<label for="formQuality">Quality (10-high, 63-low):</label>
<input type="range" min="10" max="63" value="10" step="1" class="slider custom-range" id="formQuality" style="width: 100%;">
</div>
<div class="form-group">
<label for="forvFlip">vFlip:</label>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="forvFlip" id="forvFlipR" value="vFlipR" checked>
<label class="form-check-label" for="forvFlipR">Off</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="forvFlip" id="forvFlipL" value="vFlipL">
<label class="form-check-label" for="forvFlipL">On</label>
</div>
</div>
<div class="form-group">
<label for="forhFlip">hFlip:</label>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="forhFlip" id="forhFlipU" value="hFlipU" checked>
<label class="form-check-label" for="forhFlipU">Off</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="forhFlip" id="forhFlipD" value="vFlipD">
<label class="form-check-label" for="forhFlipD">On</label>
</div>
</div>
<div class="form-check">
<button class="btn btn-primary" type="button" onclick="submitForm()">Configure</button>
</div>
</section>
</form>
</div>
</div>
<footer class="footer">
<div class="container">
<span class="text-muted"><a href="https://lemariva.com">LeMaRiva|tech</a></span>
</div>
</footer>
</div>
<script language="javascript">
var update_track = 0;
var update_input = 0;
var uPyCam = document.getElementById("uPyCam");
function imageRefresh(img, timeout) {
setTimeout(function() {
var d = new Date;
var http = img.src;
if (http.indexOf("/d") != -1) { http = http.split("/d")[0]; }
img.src = http + '/d' + d.getTime();
}, timeout);
}
function updateForm() {
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "upy", true);
xhttp.send();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200
&& (!update_input || this_update == update_input)) {
update_input = 0;
var obj = JSON.parse(this.response);
uPyCam.formSaturation.value = (obj.saturation + 2);
uPyCam.formBrightness.value = (obj.brightness + 2);
uPyCam.formContrast.value = (obj.contrast + 2);
uPyCam.formQuality.value = obj.quality;
uPyCam.formSize.value = obj.framesize;
if (obj.vflip) {
uPyCam.forvFlipL.checked = true;
uPyCam.forvFlipR.checked = false;
}else{
uPyCam.forvFlipL.checked = false;
uPyCam.forvFlipR.checked = true;
}
if (obj.hflip) {
uPyCam.forhFlipU.checked = true;
uPyCam.forhFlipD.checked = false;
}else{
uPyCam.forhFlipU.checked = false;
uPyCam.forhFlipD.checked = true;
}
}
};
}
function submitForm() {
update_track++;
saturation = uPyCam.formSaturation.value;
brightness = uPyCam.formBrightness.value;
contrast = uPyCam.formContrast.value;
quality = uPyCam.formQuality.value;
vflip = uPyCam.forvFlipR.checked ? 1 : 0;
hflip = uPyCam.forhFlipU.checked ? 1 : 0;
framesize = uPyCam.formSize.value;
var this_update = update_track;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200
&& (!update_input || this_update == update_input)) {
update_input = 0;
}
};
xhttp.open("GET", "upy/" + saturation + "/" + brightness + "/" + contrast +
"/" + quality + "/" + vflip + "/" + hflip + "/" + framesize, true);
xhttp.send();
}
</script>
</body>
</html>