Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +0 -26
templates/index.html
CHANGED
@@ -129,35 +129,11 @@
|
|
129 |
window.ProcessStatus = false;
|
130 |
document.getElementById("startStop").innerText = "Start";
|
131 |
}
|
132 |
-
console.log(window.ProcessStatus);
|
133 |
-
// let videoElement = document.getElementById("videoElement");
|
134 |
-
// let output = document.getElementById("ouptut");
|
135 |
-
// let model = document.getElementById("model").value;
|
136 |
-
// let cameraId = cameraSelect.value;
|
137 |
-
// if (videoElement.srcObject) {
|
138 |
-
// if (videoElement.style.display === "none") {
|
139 |
-
// videoElement.style.display = "block";
|
140 |
-
// output.style.display = "none";
|
141 |
-
// videoElement.srcObject.getTracks().forEach((track) => track.enabled = true);
|
142 |
-
// } else {
|
143 |
-
// videoElement.style.display = "none";
|
144 |
-
// output.style.display = "block";
|
145 |
-
// videoElement.srcObject.getTracks().forEach((track) => track.enabled = false);
|
146 |
-
// let ws = new WebSocket(`ws://${window.location.host}/ws`);
|
147 |
-
// ws.onopen = () => {
|
148 |
-
// ws.send(JSON.stringify({ model, cameraId }));
|
149 |
-
// };
|
150 |
-
// ws.onmessage = (event) => {
|
151 |
-
// output.src = URL.createObjectURL(new Blob([event.data], { type: "image/jpeg" }));
|
152 |
-
// };
|
153 |
-
// }
|
154 |
-
// }
|
155 |
if (window.ProcessStatus) {
|
156 |
let videoElement = document.getElementById("videoElement");
|
157 |
let output = document.getElementById("ouptut");
|
158 |
let newCanvas = document.createElement("canvas");
|
159 |
let model = document.getElementById("model").value;
|
160 |
-
// resize the canvas to the size of the video element
|
161 |
newCanvas.width = videoElement.videoWidth;
|
162 |
newCanvas.height = videoElement.videoHeight;
|
163 |
iterator(newCanvas,videoElement,output)
|
@@ -166,8 +142,6 @@
|
|
166 |
}
|
167 |
function iterator(newCanvas,videoElement,output) {
|
168 |
let ctx = newCanvas.getContext("2d");
|
169 |
-
|
170 |
-
|
171 |
ctx.drawImage(videoElement, 0, 0, newCanvas.width, newCanvas.height);
|
172 |
let formdata = new FormData();
|
173 |
formdata.append("image", newCanvas.toDataURL("image/jpeg"));
|
|
|
129 |
window.ProcessStatus = false;
|
130 |
document.getElementById("startStop").innerText = "Start";
|
131 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
if (window.ProcessStatus) {
|
133 |
let videoElement = document.getElementById("videoElement");
|
134 |
let output = document.getElementById("ouptut");
|
135 |
let newCanvas = document.createElement("canvas");
|
136 |
let model = document.getElementById("model").value;
|
|
|
137 |
newCanvas.width = videoElement.videoWidth;
|
138 |
newCanvas.height = videoElement.videoHeight;
|
139 |
iterator(newCanvas,videoElement,output)
|
|
|
142 |
}
|
143 |
function iterator(newCanvas,videoElement,output) {
|
144 |
let ctx = newCanvas.getContext("2d");
|
|
|
|
|
145 |
ctx.drawImage(videoElement, 0, 0, newCanvas.width, newCanvas.height);
|
146 |
let formdata = new FormData();
|
147 |
formdata.append("image", newCanvas.toDataURL("image/jpeg"));
|