Spaces:
Running
Running
Update index.html
Browse files- index.html +10 -2
index.html
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
<!DOCTYPE html>
|
3 |
<html>
|
4 |
<head>
|
@@ -145,16 +144,23 @@
|
|
145 |
// Set canvas size
|
146 |
canvas.width = 640;
|
147 |
canvas.height = 480;
|
|
|
|
|
|
|
|
|
148 |
// Start detection loop
|
149 |
requestAnimationFrame(detect);
|
150 |
}
|
|
|
151 |
function toggleNightVision() {
|
152 |
isNightVision = !isNightVision;
|
153 |
video.className = isNightVision ? 'night-vision' : '';
|
154 |
}
|
|
|
155 |
function toggleDetection() {
|
156 |
isDetecting = !isDetecting;
|
157 |
}
|
|
|
158 |
async function detect() {
|
159 |
if (isDetecting) {
|
160 |
// Calculate FPS
|
@@ -209,10 +215,12 @@
|
|
209 |
}
|
210 |
requestAnimationFrame(detect);
|
211 |
}
|
|
|
212 |
// Start application
|
213 |
init().catch(err => {
|
214 |
console.error('Error initializing camera:', err);
|
215 |
});
|
|
|
216 |
// Add image processing for better night vision
|
217 |
const imageProcessor = new ImageCapture(video.srcObject.getVideoTracks()[0]);
|
218 |
|
@@ -236,4 +244,4 @@
|
|
236 |
}
|
237 |
</script>
|
238 |
</body>
|
239 |
-
</html>
|
|
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
<head>
|
|
|
144 |
// Set canvas size
|
145 |
canvas.width = 640;
|
146 |
canvas.height = 480;
|
147 |
+
|
148 |
+
// Automatically enable detection when camera is initialized
|
149 |
+
toggleDetection(); // This activates object detection as soon as the camera starts
|
150 |
+
|
151 |
// Start detection loop
|
152 |
requestAnimationFrame(detect);
|
153 |
}
|
154 |
+
|
155 |
function toggleNightVision() {
|
156 |
isNightVision = !isNightVision;
|
157 |
video.className = isNightVision ? 'night-vision' : '';
|
158 |
}
|
159 |
+
|
160 |
function toggleDetection() {
|
161 |
isDetecting = !isDetecting;
|
162 |
}
|
163 |
+
|
164 |
async function detect() {
|
165 |
if (isDetecting) {
|
166 |
// Calculate FPS
|
|
|
215 |
}
|
216 |
requestAnimationFrame(detect);
|
217 |
}
|
218 |
+
|
219 |
// Start application
|
220 |
init().catch(err => {
|
221 |
console.error('Error initializing camera:', err);
|
222 |
});
|
223 |
+
|
224 |
// Add image processing for better night vision
|
225 |
const imageProcessor = new ImageCapture(video.srcObject.getVideoTracks()[0]);
|
226 |
|
|
|
244 |
}
|
245 |
</script>
|
246 |
</body>
|
247 |
+
</html>
|