-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#9 Face detection information is provided in GUI
Face detection (from each camera) is now provided in GUI. Further styling will be done. This was mainly achieved via AJAX, jQuery andjsonify module from Flask.
- Loading branch information
Showing
4 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
$(document).ready(function(){ | ||
/** | ||
* face_detected is a JSON containing information | ||
* about face detection on each camera. | ||
*/ | ||
var faces_detected; | ||
|
||
var checkIfDetected = function() { | ||
$.ajax({ | ||
url: '/face_detected', | ||
dataType: 'json', | ||
type: 'get', | ||
success: function(e) { | ||
faces_detected = e; | ||
$('#detection').html('Detecting faces.'); | ||
}, | ||
error: function(e) { | ||
$('#detection').html('Error: Something went wrong! Check your connection to the host!'); | ||
}, | ||
}); | ||
} | ||
|
||
window.setInterval(function(){ | ||
checkIfDetected(); | ||
$('#camera_info').empty(); | ||
$.each(faces_detected, function(k, v) { | ||
if(v == true){ | ||
var message = "Face/s detected!"; | ||
$('#camera_info').append('<li class="warning">Camera #' + k + ': ' + message +'</li>') | ||
} | ||
else{ | ||
var message = "No faces detected." | ||
$('#camera_info').append('<li class="normal">Camera #' + k + ': ' + message +'</li>') | ||
} | ||
|
||
}); | ||
}, 1000); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters