|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
<!doctype html> |
|
|
|
|
<html lang="en-us"> |
|
|
|
|
<head> |
|
|
|
|
<title>Optflow Demo</title> |
|
|
|
|
<title>Sparse Optical Flow Demo</title> |
|
|
|
|
<style> |
|
|
|
|
body { |
|
|
|
|
font-family: arial; |
|
|
|
@ -105,9 +105,7 @@ |
|
|
|
|
<span><button id="captureBtn">Start Capture</button><button id="fullscreenBtn">Fullscreen</button> |
|
|
|
|
</span> |
|
|
|
|
</span> |
|
|
|
|
<canvas id="offscreenCanvas" width="960" height="540" style="display: none;"></canvas> |
|
|
|
|
<canvas id="cameraCanvas" width="960" height="540" style="display: none;"></canvas> |
|
|
|
|
<video id="v4dVideoElement" width="960" height="540" autoplay style="display: none;"></video> |
|
|
|
|
<video id="v4dVideoElement" width="960" height="960" autoplay style="display: none;"></video> |
|
|
|
|
|
|
|
|
|
<div class="emscripten" id="status">Downloading...</div> |
|
|
|
|
|
|
|
|
@ -125,19 +123,18 @@ |
|
|
|
|
var fsButton = document.querySelector("#fullscreenBtn"); |
|
|
|
|
var captureBtn = document.querySelector("#captureBtn"); |
|
|
|
|
var videoElement = document.querySelector("#v4dVideoElement"); |
|
|
|
|
var cameraCanvas = document.querySelector("#cameraCanvas"); |
|
|
|
|
|
|
|
|
|
function fixCanvasSize() { |
|
|
|
|
Module.canvas.style.width = ((960) / window.devicePixelRatio)+ "px"; |
|
|
|
|
Module.canvas.style.height = ((540) / window.devicePixelRatio) + "px"; |
|
|
|
|
Module.canvas.style.height = ((960) / window.devicePixelRatio) + "px"; |
|
|
|
|
Module.canvas.width = 960; |
|
|
|
|
Module.canvas.height = 540; |
|
|
|
|
Module.canvas.height = 960; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var Module = { |
|
|
|
|
onRuntimeInitialized: function() { |
|
|
|
|
fixCanvasSize(); |
|
|
|
|
Module._v4dInitCapture(960, 540); |
|
|
|
|
Module._v4dInitCapture(960,960); |
|
|
|
|
}, |
|
|
|
|
preRun: [], |
|
|
|
|
postRun: [], |
|
|
|
@ -209,7 +206,7 @@ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
captureBtn.addEventListener('click', async function() { |
|
|
|
|
let stream = await navigator.mediaDevices.getUserMedia({ video: { width: 960, height: 540 } , audio: false }); |
|
|
|
|
let stream = await navigator.mediaDevices.getUserMedia({ video: { width: 960, height: 960 } , audio: false }); |
|
|
|
|
videoElement.addEventListener( |
|
|
|
|
"playing", |
|
|
|
|
() => { |
|
|
|
@ -245,7 +242,7 @@ |
|
|
|
|
|
|
|
|
|
window.addEventListener('fullscreenchange', function (event) { |
|
|
|
|
if (document.fullscreenElement) { |
|
|
|
|
console.log(`Element: ${document.fullscreenElement.id} entered fullscreen mode.`); |
|
|
|
|
console.log("Element: " + document.fullscreenElement.id + " entered fullscreen mode."); |
|
|
|
|
} else { |
|
|
|
|
console.log('Leaving fullscreen mode.'); |
|
|
|
|
} |
|
|
|
|