math = require('mathjs');
mtx = [
- [ 788.9292, 0, 329.4620],
- [0, 785.3060, 229.3576],
+ [ 1389.6, 0, 995.9],
+ [0, 1387.2, 598.5],
[0, 0, 1.0000]
];
-exports.transform = function(point) {
+exports.transform = function(point, scale) {
pt = [
-point.x,
coord = math.multiply(mtx, pt);
- return { x: coord[0], y: coord[1]};
+ return { x: coord[0]*scale, y: coord[1]*scale};
}
};
// Not showing vendor prefixes.
- navigator.getUserMedia({video: true, audio: false}, function(localMediaStream) {
+ navigator.getUserMedia({video: { width: {min:1920}, height:{min:1080}}, audio: false}, function(localMediaStream) {
var video = document.getElementById('video-frame')
video.src = window.URL.createObjectURL(localMediaStream);
}, errorCallback);
z: source.z
};
- let coord = pointToImage.transform(point);
+ let video = document.getElementById('video-frame');
+
+ let scale = video.offsetWidth / 1920;
+ let coord = pointToImage.transform(point,scale);
marker.style.top = coord.y-25 + 'px';
marker.style.left = coord.x-25 + 'px';
- let video = document.getElementById('video-frame');
if(coord.y < 0 || coord.x < 0) {
marker.style.display = 'none';
}
- else if(coord.x > video.offsetWidth || coord.y > video.offsetHeight) {
+ else if(coord.x > 1920*scale || coord.y > 1080*scale) {
marker.style.display = 'none';
}
currentFrame.potentialSources = [];
document.dispatchEvent(new Event('tracking'));
+ ipcRenderer.send('tracking', currentFrame.sources);
document.dispatchEvent(new Event('potential'));
document.dispatchEvent(new Event('update-selection'));
<div id="share-model" class="container-fluid p-body">
<div class="row">
<div class="col-sm-12">
- <video style="position:absolute; top:0px; left:0px; z-index:-10" id="video-frame" autoplay></video>
+ <video style="position:absolute; top:0px; left:0px; z-index:-10; max-width:100vw; max-height:100vh; padding-bottom:80px" id="video-frame" autoplay></video>
<canvas style="position:absolute; display:none" class="marker" ></canvas>
<canvas style="position:absolute; display:none" class="marker" ></canvas>
<canvas style="position:absolute; display:none" class="marker" ></canvas>