Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Commit 93d7cfa

Browse files
committed
bad merge fixes part 1
1 parent 8a5263a commit 93d7cfa

4 files changed

Lines changed: 12 additions & 107 deletions

File tree

main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function createWindow () {
119119
label: 'File',
120120
submenu: [
121121
{
122-
label: 'Open Video...',
122+
label: 'Open...',
123123
accelerator: 'CmdOrCtrl+O',
124124
click () { mainWindow.webContents.send('openVideo'); }
125125
},
@@ -135,7 +135,7 @@ function createWindow () {
135135
click () { mainWindow.webContents.send('saveVideo'); }
136136
},
137137
{
138-
label: 'Toggle Region Suggestions',
138+
label: 'Toggle Tracking',
139139
accelerator: 'CmdOrCtrl+T',
140140
enabled: false,
141141
click () { mainWindow.webContents.send('toggleTracking'); }

src/bower_components/video-tagging/video-taggingstyles.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@
3838

3939
.overlaystyle {
4040
position: absolute;
41-
width: 100%;
42-
height: 100%;
4341
z-index: 20;
44-
border:1px solid green;
42+
border:0px solid green;
4543
}
4644

4745
.videoStyle {
@@ -52,7 +50,6 @@
5250
background-repeat: no-repeat;
5351
background-position: 50% 50%;
5452
box-sizing: border-box;
55-
5653
}
5754

5855
/*playback*/
@@ -138,7 +135,8 @@
138135

139136

140137
/*video controls*/
141-
.videoControls {
138+
.videoControls {
139+
142140
width:100%;
143141
background-color: black;
144142
margin-top: -6px;
@@ -185,7 +183,8 @@
185183

186184

187185
/*tagging controls*/
188-
.videoTagControls {
186+
.videoTagControls {
187+
189188
border: rgb(38,38,38,0.25);
190189
background-color: black;
191190
margin-top:.15em;

src/index.js

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ function openPath(pathName, isDir) {
208208
try {
209209
var config = require(`${pathName}.json`);
210210
saveState = JSON.stringify(config);
211-
212211
//restore config
213212
$('#inputtags').val(config.inputTags);
214213
config.inputTags.split(",").forEach( tag => {
@@ -236,7 +235,6 @@ function openPath(pathName, isDir) {
236235
$('.bootstrap-tagsinput').last().removeClass( "invalid" );
237236

238237
videotagging = document.getElementById('video-tagging'); //find out why jquery doesn't play nice with polymer
239-
videotagging.disableImageDir();
240238
videotagging.regiontype = $('#regiontype').val();
241239
videotagging.multiregions = 1;
242240
videotagging.regionsize = $('#regionsize').val();
@@ -320,101 +318,6 @@ function openPath(pathName, isDir) {
320318
}
321319
}
322320

323-
//load image directory
324-
function folderSelected(path) {
325-
$('#load-message').hide();
326-
dialog.showOpenDialog({
327-
filters: [{ name: 'Image Directory'}],
328-
properties: ['openDirectory']
329-
},function (pathName) {
330-
if (pathName) openPath(pathName[0]);
331-
else $('#load-message').show();
332-
});
333-
334-
function openPath(pathName) {
335-
var config;
336-
337-
// show configuration
338-
$('#load-message').hide();
339-
$('#video-tagging-container').hide()
340-
$('#load-form-container').show();
341-
$('#framerateGroup').hide();
342-
343-
//set title indicator
344-
$('title').text(`Image Tagging Job Configuration: ${pathJS.dirname(pathName)}`);
345-
346-
$('#inputtags').tagsinput('removeAll');//remove all previous tag labels
347-
$('#output').val(`${basepath}/cntk`);
348-
$('#model').val(`${basepath}/cntk/Fast-RCNN.model`);
349-
350-
try {
351-
config = require(`${pathName}/ImageTaggingConfig.json`);
352-
//restore tags
353-
$('#inputtags').val(config.inputTags);
354-
config.inputTags.split(",").forEach( tag => {
355-
$("#inputtags").tagsinput('add',tag);
356-
});
357-
} catch (e) {
358-
console.log(`Error loading save file ${e.message}`);
359-
}
360-
361-
// REPLACE implementation, use jQuery to remove all event handlers on loadbutton
362-
document.getElementById('loadButton').parentNode.replaceChild(document.getElementById('loadButton').cloneNode(true), document.getElementById('loadButton'));
363-
document.getElementById('loadButton').addEventListener('click', loadTagger);
364-
365-
function loadTagger (e) {
366-
if(inputtags.validity.valid) {
367-
$('.bootstrap-tagsinput').last().removeClass( "invalid" );
368-
369-
$('title').text(`Image Tagging Job: ${pathJS.dirname(pathName)}}`); //set title indicator
370-
371-
videotagging = document.getElementById('video-tagging'); //find out why jquery doesn't play nice with polymer
372-
videotagging.regiontype = $('#regiontype').val();
373-
videotagging.multiregions = 1;
374-
videotagging.regionsize = $('#regionsize').val();
375-
videotagging.inputtagsarray = $('#inputtags').val().split(',');
376-
videotagging.video.currentTime = 0;
377-
videotagging.videowidth = 854;
378-
videotagging.videoheight = 480;
379-
videotagging.framerate = $('#framerate').val();
380-
381-
//get list of images in directory
382-
var files = fs.readdirSync(pathName);
383-
384-
videotagging.imagelist = files.filter(function(file){
385-
return file.match(/.(jpg|jpeg|png|gif)$/i);
386-
});
387-
388-
videotagging.imagelist = videotagging.imagelist.map((filepath) => {return pathJS.join(pathName,filepath)});
389-
videotagging.src = pathName;
390-
391-
//track visited frames
392-
videotagging.video.removeEventListener("canplay", updateVisitedFrames); //remove old listener
393-
videotagging.video.addEventListener("canplay",updateVisitedFrames);
394-
395-
//init cntk extensions
396-
CNTKExtension = new VideoTaggingCNTKExtension({
397-
videotagging: videotagging,
398-
cntkPath: cntkConfig.cntkPath,
399-
cntkEnv: cntkConfig.cntkEnv,
400-
visitedFrames: visitedFrames,
401-
exportUntil: $('#exportTo').val(),
402-
exportPath: $('#output').val()
403-
});
404-
405-
$('#load-form-container').hide();
406-
$('#video-tagging-container').show();
407-
408-
ipcRenderer.send('setFilePath', pathName);
409-
} else {
410-
$('.bootstrap-tagsinput').last().addClass( "invalid" );
411-
}
412-
}
413-
414-
}
415-
}
416-
417-
418321
//saves current video to config
419322
function save() {
420323
var saveObject = {

src/lib/videotagging_extensions/detection.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,14 @@ function Detection(videotagging, visitedFrames) {
242242
}
243243

244244
function saveFrame(frameName, frameId, fCanvas, canvasContext, saveCb){
245-
246245
var writePath = path.join(reviewPath, `${frameId}.jpg`);
247246
//write canvas to file and change frame
248247
console.log('saving file', writePath);
249-
fs.writeFile(writePath, self.canvasToJpgBuffer(fCanvas, canvasContext), saveCb);
248+
fs.exists(writePath, (exists) => {
249+
if (!exists) {
250+
fs.writeFile(writePath, self.canvasToJpgBuffer(fCanvas, canvasContext), saveCb);
251+
}
252+
});
250253
}
251254
});
252255
}

0 commit comments

Comments
 (0)