const sockets = require('./servers.js')
const recordings = require('./recordings.js')
+const share = require('./share.js')
odasStudio.odas = require('./odas.js')
recordings.register(odasStudio)
"delayed-stream": "1.0.0"
}
},
+ "complex.js": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.0.4.tgz",
+ "integrity": "sha512-Syl95HpxUTS0QjwNxencZsKukgh1zdS9uXeXX2Us0pHaqBR6kiZZi0AkZ9VpZFwHJyVIUVzI4EumjWdXP3fy6w=="
+ },
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
},
+ "decimal.js": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-9.0.1.tgz",
+ "integrity": "sha512-2h0iKbJwnImBk4TGk7CG1xadoA0g3LDPlQhQzbZ221zvG0p2YVUedbKIPsOZXKZGx6YmZMJKYOalpCMxSdDqTQ=="
+ },
"deep-extend": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz",
"mime-types": "2.1.17"
}
},
+ "fraction.js": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.0.4.tgz",
+ "integrity": "sha512-aK/oGatyYLTtXRHjfEsytX5fieeR5H4s8sLorzcT12taFS+dbMZejnvm9gRa8mZAPwci24ucjq9epDyaq5u8Iw=="
+ },
"fs-extra": {
"version": "0.30.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
+ "javascript-natural-sort": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
+ "integrity": "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k="
+ },
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
"dev": true
},
+ "mathjs": {
+ "version": "3.20.1",
+ "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-3.20.1.tgz",
+ "integrity": "sha512-cra4iv6Xj5g38TlVX9VQCqaE8UcDGZkIlB2aM3cB5djoD9YAsLVsQPmzfGWGoZIB/qTht93U8mf1BmkteynSOQ==",
+ "requires": {
+ "complex.js": "2.0.4",
+ "decimal.js": "9.0.1",
+ "fraction.js": "4.0.4",
+ "javascript-natural-sort": "0.7.1",
+ "seed-random": "2.2.0",
+ "tiny-emitter": "2.0.2",
+ "typed-function": "0.10.6"
+ }
+ },
"meow": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
},
+ "seed-random": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/seed-random/-/seed-random-2.2.0.tgz",
+ "integrity": "sha1-KpsZ4lCoFwmSMaW5mk2vgLf77VQ="
+ },
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
"xtend": "4.0.1"
}
},
+ "tiny-emitter": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.0.2.tgz",
+ "integrity": "sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow=="
+ },
"tough-cookie": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz",
"resolved": "https://registry.npmjs.org/type-name/-/type-name-2.0.2.tgz",
"integrity": "sha1-7+fUEj2KxSr/9/QMfk3sUmYAj7Q="
},
+ "typed-function": {
+ "version": "0.10.6",
+ "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-0.10.6.tgz",
+ "integrity": "sha512-PYtsDjxyW3vq7Itn2RMz0cn6CrbybIY6XC2i9c1q1o/H94QW8B1Pf3wSsbBDOCMpN1i5jDRrlDsLXFaqXBpfHQ=="
+ },
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"electron-rebuild": "^1.7.3"
},
"dependencies": {
+ "@google-cloud/speech": "^1.0.1",
"ip": "^1.1.5",
+ "mathjs": "^3.20.1",
"systeminformation": "^3.17.3",
"wav": "^1.0.1",
- "wav-file-info": "^0.0.8",
- "@google-cloud/speech": "^1.0.1"
+ "wav-file-info": "^0.0.8"
},
"repository": {
"type": "git",
--- /dev/null
+math = require('mathjs');
+
+mtx = [
+ [ 788.9292, 0, 329.4620],
+ [0, 785.3060, 229.3576],
+ [0, 0, 1.0000]
+];
+
+exports.transform = function(point) {
+
+ pt = [
+ -point.x,
+ -point.y,
+ point.z
+ ];
+
+ coord = math.multiply(mtx, pt);
+
+ return { x: coord[0], y: coord[1]};
+}
--- /dev/null
+const electron = require('electron');
+const ipcRenderer = require('electron').ipcRenderer;
+const pointToImage = require("../resources/js/point-to-image.js");
+
+const markers = document.getElementsByClassName('marker');
+var rgbValueStrings = ["rgb(75,192,192)","rgb(192,75,192)","rgb(192,192,30)","rgb(0,200,40)"];
+
+var errorCallback = function(e) {
+ console.log('Reeeejected!', e);
+ };
+
+ // Not showing vendor prefixes.
+ navigator.getUserMedia({video: true, audio: false}, function(localMediaStream) {
+ var video = document.getElementById('video-frame')
+ video.src = window.URL.createObjectURL(localMediaStream);
+ }, errorCallback);
+
+
+ipcRenderer.on('tracking', (event, data)=> {
+
+ data.forEach(source => {
+ let marker = markers[source.index];
+
+ if(source.active) {
+ let point = {
+ x: source.x,
+ y: source.y,
+ z: source.z
+ };
+
+ let coord = pointToImage.transform(point);
+
+ 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) {
+ marker.style.display = 'none';
+ }
+
+ else {
+ marker.style.display = 'block';
+ }
+ }
+
+ else {
+ marker.style.display = 'none';
+ }
+ })
+}) ;
+
+
+const shareModel = new Vue({
+ el: '#share-model',
+ data: {
+ },
+ methods: {
+ }
+});
+
+const drawCircle = function(canvas, index) {
+ console.log(canvas);
+ console.log(index);
+
+ let centerX = 25;
+ let centerY = 25;
+ let radius = 20;
+
+ let context = canvas.getContext('2d');
+
+ context.beginPath();
+ context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
+ context.lineWidth = 10;
+ context.strokeStyle = rgbValueStrings[index];
+ context.stroke();
+}
+
+for(let n = 0; n < markers.length; n++)
+ drawCircle(markers[n], n);
// Trigger update
document.dispatchEvent(new Event('tracking'));
- if(hasNewSource)
- document.dispatchEvent(new Event('update-selection'));
+ // Send to main
+ ipcRenderer.send('tracking', currentFrame.sources);
};
ipcRenderer.on('newTracking', processTracking)
--- /dev/null
+const electron = require('electron');
+const fs = require('fs');
+const path = require('path');
+const url = require('url');
+
+const BrowserWindow = electron.BrowserWindow;
+const ipcMain = electron.ipcMain;
+
+let shareWindow = null;
+
+ipcMain.on('open-share-window', openShareWindow);
+
+function openShareWindow () {
+
+ if(shareWindow !== null) {
+ shareWindow.show();
+ return;
+ }
+
+ shareWindow = new BrowserWindow({width: 1280, height: 820, show: false});
+
+ shareWindow.loadURL(url.format({
+ pathname: path.join(__dirname, 'views','share.html'),
+ protocol: 'file:',
+ slashes: true
+ }));
+
+ shareWindow.once('ready-to-show', function () {
+ shareWindow.show()
+ });
+
+ shareWindow.on('closed', function () {
+ shareWindow = null
+ });
+}
+
+ipcMain.on('tracking', (event, data) => {
+ if(shareWindow !== null && data.length > 0) {
+ try {
+ shareWindow.webContents.send('tracking', data);
+ }
+
+ catch(err) {
+ console.log('Window was closed');
+ }
+ }
+});
<div class="collapse navbar-collapse" id="navbar-content">
<ul class="nav navbar-nav navbar-right">
<li><a href="#" onclick="ipcRenderer.send('open-recordings-window')">Record</a></li>
+ <li><a href="#" onclick="ipcRenderer.send('open-share-window')">Camera</a></li>
</ul>
</div>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Camera</title>
+ <link href="../resources/css/bootstrap.css" rel="stylesheet">
+ <link href="../resources/css/style.css" rel="stylesheet">
+ </head>
+ <body style="height: 100%; overflow: hidden">
+ <nav class="navbar navbar-default bg-primary navbar-fixed-top ">
+ <div class="container-fluid">
+ <div class="navbar-header">
+ <a class="navbar-brand navbar-logo" width="120" href="#"><img src="../resources/images/introlab_icon.png"></a>
+ <a class="navbar-brand" width="120" href="#"><span>ODAS Studio</span></a>
+ </div>
+ </div>
+ </nav>
+
+ <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>
+ <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>
+ <canvas style="position:absolute; display:none" class="marker" ></canvas>
+ </div>
+ </div>
+ </div>
+
+ <footer class="footer">
+ <div class="container-fluid">
+ <div class="row">
+ <p class="col-xs-10 text-muted">Graphic interface for ODAS library</p>
+ <a href="javascript:window.close()" class="col-xs-2 text-right">Close</a>
+ </div>
+ </div>
+ </footer>
+
+ <script>window.$ = window.jQuery = require('./../resources/js/jquery.min.js');</script>
+ <script src="./../resources/js/bootstrap.min.js"></script>
+ <script src="./../resources/js/bootstrap-toggle.min.js"></script>
+ <script src="./../resources/js/vue.js"></script>
+ <script src="./../resources/js/share-model.js"></script>
+ </body>
+</html>