face-recognition.js/Feature_detection/www/js/Main.js

60 lines
1.7 KiB
JavaScript
Raw Normal View History

/*
* Main.js
*/
'use strict';
function documentIsReady() {
// All document items are available...
console.log("documentIsReady");
new Main();
}
function windowIsLoaded() {
// All resources are available including downloaded images...
console.log("windowIsLoaded");
}
function windowIsUnloaded() {
console.log("windowIsUnloaded");
}
var Main = function () {
$(document).on("detection", {name: "detection"}, this.detection.bind(this));
var Franck = new Image(250, 250); // 250 x 250 to get mouth and eyes
Franck.onload = function () {
$(document).trigger("detection", {image: Franck, image_name: "Franck"});
};
Franck.src = 'img/Franck.jpg';
var Joseph = new Image(250, 250); // 250 x 250 to get mouth and eyes
Joseph.onload = function () {
$(document).trigger("detection", {image: Joseph, image_name: "Joseph"});
};
Joseph.src = 'img/Joseph.jpg';
var Lena = new Image(400, 400); // 400 x 400 to get mouth and eyes
Lena.onload = function () {
$(document).trigger("detection", {image: Lena, image_name: "Lena"});
};
Lena.src = 'img/Lena.jpg';
var Oscar = new Image();
Oscar.onload = function () {
$(document).trigger("detection", {image: Oscar, image_name: "Oscar"});
};
Oscar.src = 'img/Oscar.jpg';
var Sophie = new Image(100, 100);
Sophie.onload = function () {
$(document).trigger("detection", {image: Sophie, image_name: "Sophie"});
};
Sophie.src = 'img/Sophie.jpg';
};
Main.prototype.detection = function (event, parameters) {
chai.assert.strictEqual(event.data.name, "detection", "Precondition does not hold: " + "detection");
new Photography_with_detected_features(parameters.image, parameters.image_name);
};