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

Commit

Permalink
bad merge fixes part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
aribornstein committed Jun 7, 2017
1 parent 8a5263a commit 93d7cfa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 107 deletions.
4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function createWindow () {
label: 'File',
submenu: [
{
label: 'Open Video...',
label: 'Open...',
accelerator: 'CmdOrCtrl+O',
click () { mainWindow.webContents.send('openVideo'); }
},
Expand All @@ -135,7 +135,7 @@ function createWindow () {
click () { mainWindow.webContents.send('saveVideo'); }
},
{
label: 'Toggle Region Suggestions',
label: 'Toggle Tracking',
accelerator: 'CmdOrCtrl+T',
enabled: false,
click () { mainWindow.webContents.send('toggleTracking'); }
Expand Down
11 changes: 5 additions & 6 deletions src/bower_components/video-tagging/video-taggingstyles.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@

.overlaystyle {
position: absolute;
width: 100%;
height: 100%;
z-index: 20;
border:1px solid green;
border:0px solid green;
}

.videoStyle {
Expand All @@ -52,7 +50,6 @@
background-repeat: no-repeat;
background-position: 50% 50%;
box-sizing: border-box;

}

/*playback*/
Expand Down Expand Up @@ -138,7 +135,8 @@


/*video controls*/
.videoControls {
.videoControls {

width:100%;
background-color: black;
margin-top: -6px;
Expand Down Expand Up @@ -185,7 +183,8 @@


/*tagging controls*/
.videoTagControls {
.videoTagControls {

border: rgb(38,38,38,0.25);
background-color: black;
margin-top:.15em;
Expand Down
97 changes: 0 additions & 97 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ function openPath(pathName, isDir) {
try {
var config = require(`${pathName}.json`);
saveState = JSON.stringify(config);

//restore config
$('#inputtags').val(config.inputTags);
config.inputTags.split(",").forEach( tag => {
Expand Down Expand Up @@ -236,7 +235,6 @@ function openPath(pathName, isDir) {
$('.bootstrap-tagsinput').last().removeClass( "invalid" );

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

//load image directory
function folderSelected(path) {
$('#load-message').hide();
dialog.showOpenDialog({
filters: [{ name: 'Image Directory'}],
properties: ['openDirectory']
},function (pathName) {
if (pathName) openPath(pathName[0]);
else $('#load-message').show();
});

function openPath(pathName) {
var config;

// show configuration
$('#load-message').hide();
$('#video-tagging-container').hide()
$('#load-form-container').show();
$('#framerateGroup').hide();

//set title indicator
$('title').text(`Image Tagging Job Configuration: ${pathJS.dirname(pathName)}`);

$('#inputtags').tagsinput('removeAll');//remove all previous tag labels
$('#output').val(`${basepath}/cntk`);
$('#model').val(`${basepath}/cntk/Fast-RCNN.model`);

try {
config = require(`${pathName}/ImageTaggingConfig.json`);
//restore tags
$('#inputtags').val(config.inputTags);
config.inputTags.split(",").forEach( tag => {
$("#inputtags").tagsinput('add',tag);
});
} catch (e) {
console.log(`Error loading save file ${e.message}`);
}

// REPLACE implementation, use jQuery to remove all event handlers on loadbutton
document.getElementById('loadButton').parentNode.replaceChild(document.getElementById('loadButton').cloneNode(true), document.getElementById('loadButton'));
document.getElementById('loadButton').addEventListener('click', loadTagger);

function loadTagger (e) {
if(inputtags.validity.valid) {
$('.bootstrap-tagsinput').last().removeClass( "invalid" );

$('title').text(`Image Tagging Job: ${pathJS.dirname(pathName)}}`); //set title indicator

videotagging = document.getElementById('video-tagging'); //find out why jquery doesn't play nice with polymer
videotagging.regiontype = $('#regiontype').val();
videotagging.multiregions = 1;
videotagging.regionsize = $('#regionsize').val();
videotagging.inputtagsarray = $('#inputtags').val().split(',');
videotagging.video.currentTime = 0;
videotagging.videowidth = 854;
videotagging.videoheight = 480;
videotagging.framerate = $('#framerate').val();

//get list of images in directory
var files = fs.readdirSync(pathName);

videotagging.imagelist = files.filter(function(file){
return file.match(/.(jpg|jpeg|png|gif)$/i);
});

videotagging.imagelist = videotagging.imagelist.map((filepath) => {return pathJS.join(pathName,filepath)});
videotagging.src = pathName;

//track visited frames
videotagging.video.removeEventListener("canplay", updateVisitedFrames); //remove old listener
videotagging.video.addEventListener("canplay",updateVisitedFrames);

//init cntk extensions
CNTKExtension = new VideoTaggingCNTKExtension({
videotagging: videotagging,
cntkPath: cntkConfig.cntkPath,
cntkEnv: cntkConfig.cntkEnv,
visitedFrames: visitedFrames,
exportUntil: $('#exportTo').val(),
exportPath: $('#output').val()
});

$('#load-form-container').hide();
$('#video-tagging-container').show();

ipcRenderer.send('setFilePath', pathName);
} else {
$('.bootstrap-tagsinput').last().addClass( "invalid" );
}
}

}
}


//saves current video to config
function save() {
var saveObject = {
Expand Down
7 changes: 5 additions & 2 deletions src/lib/videotagging_extensions/detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,14 @@ function Detection(videotagging, visitedFrames) {
}

function saveFrame(frameName, frameId, fCanvas, canvasContext, saveCb){

var writePath = path.join(reviewPath, `${frameId}.jpg`);
//write canvas to file and change frame
console.log('saving file', writePath);
fs.writeFile(writePath, self.canvasToJpgBuffer(fCanvas, canvasContext), saveCb);
fs.exists(writePath, (exists) => {
if (!exists) {
fs.writeFile(writePath, self.canvasToJpgBuffer(fCanvas, canvasContext), saveCb);
}
});
}
});
}
Expand Down

0 comments on commit 93d7cfa

Please sign in to comment.