Commit 4f331e4f authored by Michael Murtaugh's avatar Michael Murtaugh

tuning the timing of the displays

parent fbf0e743
......@@ -14,9 +14,6 @@
<div id="content">
<img src="blank.png" />
</div>
<div id="draw">
<canvas id="canvas"></canvas>
</div>
<div id="video">
<video autoplay loop></video>
</div>
......
......@@ -4,17 +4,9 @@ document.addEventListener("DOMContentLoaded", function () {
var sockaddr = window.location.protocol+'//'+window.location.host,
socket,
img = document.querySelector("img"),
canvas = document.querySelector("canvas"),
ctx = canvas.getContext("2d"),
video = document.querySelector("video"),
msg = document.getElementById("message"),
imagesByPath = {},
width = 0,
height = 0,
imageWidth = 640,
imageHeight = 480,
image2screen,
imagedata;
cameragif;
img.style.display = "none";
console.log("opening connection to", sockaddr);
......@@ -83,49 +75,25 @@ document.addEventListener("DOMContentLoaded", function () {
// imagedata = d;
// requestAnimationFrame(draw);
})
socket.on("annotatedcameraframe", function (d) {
img.src = d.src;
img.style.display = "block";
});
socket.on("collage", function (d) {
msg.innerHTML = "";
img.style.display = "none";
video.style.display = "none";
})
socket.on("cameragif", function (d) {
msg.innerHTML = "";
video.src = d.src;
cameragif = d.src;
// video.src = d.src;
img.style.display = "none";
// video.style.display = "block";
});
socket.on("collagegif", function (d) {
video.src = cameragif;
video.style.display = "block";
})
function draw () {
ctx.clearRect(0, 0, width, height);
if (imagedata && imagedata.faces && image2screen) {
// console.log("draw", imagedata.faces ? imagedata.faces.length : 0, imagedata.eyes ? imagedata.eyes.length : 0);
ctx.strokeStyle = "blue";
ctx.lineWidth = 3;
imagedata.faces.forEach(function (x) {
var fr = image2screen(cc.rect(x[0], x[1], x[2], x[3]));
ctx.strokeRect(fr.x, fr.y, fr.width, fr.height);
});
ctx.strokeStyle = "green";
ctx.lineWidth = 3;
imagedata.eyes.forEach(function (x) {
var fr = image2screen(cc.rect(x[0], x[1], x[2], x[3]));
ctx.strokeRect(fr.x, fr.y, fr.width, fr.height);
});
}
}
function resize () {
// console.log("resize");
var br = img.getBoundingClientRect();
// console.log("br", br);
width = br.right - br.left;
height = br.bottom - br.top;
canvas.setAttribute("width", width);
canvas.setAttribute("height", height);
image2screen = cc.transform_from(cc.rect(0, 0, imageWidth, imageHeight),
cc.rect(0, 0, width, height));
requestAnimationFrame(draw);
}
img.addEventListener("load", resize);
window.addEventListener("resize", resize);
resize();
});
});
......@@ -5,6 +5,6 @@ archivegif=$2
collagegif=$3
rm -f frames/*
rm "$cameragif"
# rm "$cameragif" # actually this *can not* happen as it needs to be served...
scp "$archivegif" "$collagegif" aa:/var/www/vhosts/sicv.activearchives.org/httpdocs/vitrine
......@@ -13,10 +13,18 @@ document.addEventListener("DOMContentLoaded", function () {
socket.on("connect", function (data) {
console.log("connected to socket server");
});
socket.on("watch", function (data) {
msg.innerHTML = "";
});
socket.on("record", function (d) {
img.style.display = "none";
msg.innerHTML = "";
})
socket.on("collage", function (d) {
msg.innerHTML = "";
img.style.display = "none";
video.style.display = "none";
})
socket.on("archiveframe", function (d) {
var now = new Date(),
tstr = ""+now.getFullYear()+now.getMonth()+now.getDay()+now.getHours()+now.getMinutes()+now.getSeconds(),
......@@ -30,13 +38,14 @@ document.addEventListener("DOMContentLoaded", function () {
video.pause();
video.style.display = "none";
});
socket.on("analyze", function () {
// start a countdown...
msg.innerHTML = "Searching for faces <br>from the archive...";
img.style.display = "none";
video.pause();
video.style.display = "none";
})
// commenting out -- allow loop to remain until actual matching occurs (via archiveframe)
// socket.on("analyze", function () {
// // start a countdown...
// msg.innerHTML = "Searching for faces <br>from the archive...";
// img.style.display = "none";
// video.pause();
// video.style.display = "none";
// })
socket.on("archivegif", function (d) {
console.log("archivegif", d.src);
archivegif = d.src;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment