Skip to content

Commit

Permalink
#384 Frontend implemented and linked with the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Belberus committed Oct 9, 2020
1 parent c977432 commit 6b6214e
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 126 deletions.
26 changes: 26 additions & 0 deletions src/static/javascript/controllers/toolController.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ angular.module('CVGTool')
navSrvc.setMinFrame($scope.toolParameters.activeDataset.name, $scope.toolParameters.activeDataset.type, cameraNames.videos[i]);
}

// Call to obtain the frames to annotate (for AIK it does nothing)
$scope.commonManager.getVideoFramesToAnnotate(cameraNames.videos[i]);

// Push empty frame spaces
for (var j = 0; j < $scope.toolParameters.numberOfFrames; j++) {
_this.loadedCameras[i].frames.push({})
Expand Down Expand Up @@ -1234,6 +1237,9 @@ angular.module('CVGTool')
callback, $scope.messagesManager.sendMessage);
}
}

// This is here because PT has it, but it does nothing for AIK
_this.getVideoFramesToAnnotate = function(video) {}

_this.getPoseAIKLimbsLengthForAll = function() {
var objects = $scope.objectManager.objectTypes["poseAIK"].objects;
Expand Down Expand Up @@ -1614,6 +1620,8 @@ angular.module('CVGTool')
function PTManager() {
var _this = this;

_this.videoFramesToAnnotate = []

_this.resizedVideos=["007467","014335","002786","015537","008884","013924","024817","024788","015306","014663","021139","000048","003730","014235",
"020868","012746","007536","000866","013523","013519","009993","014334","002839","016442","024722","023416","013952","017184",
"018651","008835","016501","013908","002357","013560","008880","022948","015822","014665","020928","020573","007876","016461",
Expand Down Expand Up @@ -1768,6 +1776,19 @@ angular.module('CVGTool')
return returnKeypoints;
}

// Function that returns the list of frames to annotate
_this.getVideoFramesToAnnotate = function(video) {
var callback = function(frames) {
_this.videoFramesToAnnotate = frames;
}
toolSrvc.getVideoFramesToAnnotate(video, callback, $scope.messagesManager.sendMessage);
}

// Checks if frame has to be annotated
_this.isFrameAnnotable = function(frame) {
return _this.videoFramesToAnnotate.includes(frame);
}

// Gets the labels for the current ignore region in the current frame
_this.getIgnoreRegionLabels = function(frame) {
var keypoints = $scope.objectManager.selectedObject.frames[frame - $scope.toolParameters.frameFrom].keypoints;
Expand Down Expand Up @@ -4742,6 +4763,7 @@ angular.module('CVGTool')
function OptionsManager() {
var _this = this;

// General options of the tool
_this.options = {
pointSize: 10,
fontSize: 10,
Expand All @@ -4757,6 +4779,10 @@ angular.module('CVGTool')
visualizeActions: false
}

// Hidden option to change it manually. When True, the frames that can be annotated in PT with Persons will be restricted
_this.restrictPTFrames = true;

// Specific options for AIK object replication
_this.replicateOptions = {
replicateToTheMaxFrame: true,
replicateTo: 0
Expand Down
15 changes: 15 additions & 0 deletions src/static/javascript/services/toolService.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,21 @@ angular.module('CVGTool')
})
},

getVideoFramesToAnnotate: function(video, callbackSuccess, callbackError) {
$http({
method: 'GET',
url: '/api/annotation/getFramesToAnnotatePersonsPT',
headers: {
'Authorization': 'Bearer ' + navSrvc.getSessionToken(),
'video': video
}
}).then(function successCallback(response) {
callbackSuccess(response.data.msg);
}, function errorCallback(response) {
callbackError("danger", response.data.msg);
})
},

replicateStaticObject: function(user, dataset, datasetType, scene, startFrame, endFrame, maxFrame, uidObject, objectType, callbackSuccess, callbackError) {
$http({
method: 'POST',
Expand Down
Loading

0 comments on commit 6b6214e

Please sign in to comment.