Recognizion with multiple
This commit is contained in:
@@ -4,32 +4,7 @@ const { exec } = require('child_process');
|
||||
const { logSnapshot } = require('./log');
|
||||
|
||||
|
||||
function snapshot(outDir, cam0, cam1, ws){
|
||||
|
||||
if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
|
||||
const picDate = Date.now();
|
||||
var name0 = `snapshot_video0_${picDate}.jpg`;
|
||||
var name1 = `snapshot_video1_${picDate}.jpg`;
|
||||
cam0.snapshot(path.join(outDir, name0));
|
||||
cam1.snapshot(path.join(outDir, name1));
|
||||
|
||||
|
||||
console.log('Taking snapshot from cam0 async');
|
||||
(async () => {
|
||||
try {
|
||||
console.log('Taking snapshot from cam1 a…');
|
||||
var name1 = `snapshot_video1a_${picDate}.jpg`;
|
||||
await cam1.snapshotHighRes(path.join(outDir, name1));
|
||||
console.log('Snapshot gespeichert:', name1);
|
||||
} catch (err) {
|
||||
console.error('Snapshot fehlgeschlagen:', err);
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
|
||||
strFile0 = path.join(outDir, name0);
|
||||
strFile1 = path.join(outDir, name1);
|
||||
function processPython(command, name0, name1, outDir, ws) {
|
||||
|
||||
const relUrl = `/snapshots/${name0}`;
|
||||
const relUrlApp = `/snapshots/${name0.replace('.jpg','_two_cam_annotated.jpg')}`;
|
||||
@@ -42,11 +17,6 @@ function snapshot(outDir, cam0, cam1, ws){
|
||||
const csvPath = path.join(outDir, name0.replace('.jpg','_two_cam.csv'));
|
||||
|
||||
|
||||
|
||||
//const command = `python3 /usr/src/app/programs/readTwoImages.py -i ${strFile0} -i ${strFile1} -npz /usr/src/app/data/settings/callibration_cam0.npz -npz /usr/src/app/data/settings/callibration_cam1.npz -settings /usr/src/app/data/settings/settings.json`;
|
||||
const command = `python3 /usr/src/app/programs/readTwoImages.py -i ${strFile0} -i ${strFile1} -npz /usr/src/app/data/settings/callibration_cam0.npz -npz /usr/src/app/data/settings/callibration_cam1.npz -settings /usr/src/app/data/settings/settings1m.json`;
|
||||
console.log("Executing Python " + command);
|
||||
|
||||
// Run the Python post-processing and send the snapshot response only
|
||||
// after the annotated files are present to avoid transient 404s in the browser.
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
@@ -143,6 +113,35 @@ function snapshot(outDir, cam0, cam1, ws){
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function snapshot(outDir, cam0, cam1, ws){
|
||||
|
||||
if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
|
||||
const picDate = Date.now();
|
||||
var name0 = `snapshot_video0_${picDate}.jpg`;
|
||||
var name1 = `snapshot_video1_${picDate}.jpg`;
|
||||
|
||||
|
||||
console.log('Taking snapshot from cam0 async');
|
||||
(async () => {
|
||||
try {
|
||||
console.log('Taking snapshot from cam1 a…');
|
||||
await cam0.snapshotHighRes(path.join(outDir, name0));
|
||||
await cam1.snapshotHighRes(path.join(outDir, name1));
|
||||
console.log('Snapshot gespeichert:', name1);
|
||||
|
||||
strFile0 = path.join(outDir, name0);
|
||||
strFile1 = path.join(outDir, name1);
|
||||
|
||||
//const command = `python3 /usr/src/app/programs/readTwoImages.py -i ${strFile0} -i ${strFile1} -npz /usr/src/app/data/settings/callibration_cam0.npz -npz /usr/src/app/data/settings/callibration_cam1.npz -settings /usr/src/app/data/settings/settings.json`;
|
||||
const command = `python3 /usr/src/app/programs/readTwoImages.py -i ${strFile0} -i ${strFile1} -npz /usr/src/app/data/settings/callibration_cam0.npz -npz /usr/src/app/data/settings/callibration_cam1.npz -settings /usr/src/app/data/settings/settings1m.json`;
|
||||
console.log("Executing Python " + command);
|
||||
processPython(command, name0, name1, outDir, ws);
|
||||
} catch (err) {
|
||||
console.error('Snapshot fehlgeschlagen:', err);
|
||||
}
|
||||
})();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user