Skip to content

Commit

Permalink
Improved settings for facedetection
Browse files Browse the repository at this point in the history
  • Loading branch information
auduno committed Sep 7, 2017
1 parent 290d6f0 commit 512b882
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 22 deletions.
25 changes: 18 additions & 7 deletions build/clmtrackr.js
Original file line number Diff line number Diff line change
Expand Up @@ -11242,16 +11242,20 @@ var findFaceWorker = function(e) {

jsfeat.haar.edgesDensity = params.edgesDensity;
var rects = jsfeat.haar.detect_multi_scale(ii_sum, ii_sqsum, ii_tilted, params.useCanny? ii_canny : null, img_u8.cols, img_u8.rows, classifier, params.scaleFactor, params.minScale);
rects = jsfeat.haar.group_rectangles(rects, 1);
rects = jsfeat.haar.group_rectangles(rects, params.min_neighbors);

var rl = rects.length;
for (var i = rects.length-1;i >= 0;i--) {
if (rects[i].confidence < params.confidenceThreshold) {
rects.splice(i,1);
}
}

var rl = rects.length;
if (rl == 0) {
self.postMessage({
faces: []
});
} else {

var best = rects[0];
for (var i = 1;i < rl;i++) {
if (rects[i].neighbors > best.neighbors) {
Expand Down Expand Up @@ -11283,12 +11287,14 @@ var faceDetection = function(pdmModel, params) {
// optionally uses web workers

if (params === undefined) params = {};
if (params.workSize === undefined) params.workSize = 160;
if (params.workSize === undefined) params.workSize = 200;
if (params.minScale === undefined) params.minScale = 2;
if (params.scaleFactor === undefined) params.scaleFactor = 1.15;
if (params.useCanny === undefined) params.useCanny = false;
if (params.edgesDensity === undefined) params.edgesDensity = 0.13;
if (params.equalizeHistogram === undefined) params.equalizeHistogram = true;
if (params.equalizeHistogram === undefined) params.equalizeHistogram = false;
if (params.min_neighbors === undefined) params.min_neighbors = 2;
if (params.confidenceThreshold === undefined) params.confidenceThreshold = 106.1;
if (params.useWebWorkers === undefined) params.useWebWorkers = true;

// disable web workers if not exists
Expand Down Expand Up @@ -11589,10 +11595,15 @@ var jsfeat_face = function(parameters) {

jsfeat_1.haar.edgesDensity = params.edgesDensity;
var rects = jsfeat_1.haar.detect_multi_scale(ii_sum, ii_sqsum, ii_tilted, params.useCanny? ii_canny : null, img_u8.cols, img_u8.rows, classifier, params.scaleFactor, params.minScale);
rects = jsfeat_1.haar.group_rectangles(rects, 1);
rects = jsfeat_1.haar.group_rectangles(rects, params.min_neighbors);

var rl = rects.length;
for (var i = rects.length-1;i >= 0;i--) {
if (rects[i].confidence < params.confidenceThreshold) {
rects.splice(i,1);
}
}

var rl = rects.length;
if (rl == 0) {
reject();
} else {
Expand Down
2 changes: 1 addition & 1 deletion build/clmtrackr.min.js

Large diffs are not rendered by default.

25 changes: 18 additions & 7 deletions build/clmtrackr.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -11236,16 +11236,20 @@ var findFaceWorker = function(e) {

jsfeat.haar.edgesDensity = params.edgesDensity;
var rects = jsfeat.haar.detect_multi_scale(ii_sum, ii_sqsum, ii_tilted, params.useCanny? ii_canny : null, img_u8.cols, img_u8.rows, classifier, params.scaleFactor, params.minScale);
rects = jsfeat.haar.group_rectangles(rects, 1);
rects = jsfeat.haar.group_rectangles(rects, params.min_neighbors);

var rl = rects.length;
for (var i = rects.length-1;i >= 0;i--) {
if (rects[i].confidence < params.confidenceThreshold) {
rects.splice(i,1);
}
}

var rl = rects.length;
if (rl == 0) {
self.postMessage({
faces: []
});
} else {

var best = rects[0];
for (var i = 1;i < rl;i++) {
if (rects[i].neighbors > best.neighbors) {
Expand Down Expand Up @@ -11277,12 +11281,14 @@ var faceDetection = function(pdmModel, params) {
// optionally uses web workers

if (params === undefined) params = {};
if (params.workSize === undefined) params.workSize = 160;
if (params.workSize === undefined) params.workSize = 200;
if (params.minScale === undefined) params.minScale = 2;
if (params.scaleFactor === undefined) params.scaleFactor = 1.15;
if (params.useCanny === undefined) params.useCanny = false;
if (params.edgesDensity === undefined) params.edgesDensity = 0.13;
if (params.equalizeHistogram === undefined) params.equalizeHistogram = true;
if (params.equalizeHistogram === undefined) params.equalizeHistogram = false;
if (params.min_neighbors === undefined) params.min_neighbors = 2;
if (params.confidenceThreshold === undefined) params.confidenceThreshold = 106.1;
if (params.useWebWorkers === undefined) params.useWebWorkers = true;

// disable web workers if not exists
Expand Down Expand Up @@ -11583,10 +11589,15 @@ var jsfeat_face = function(parameters) {

jsfeat_1.haar.edgesDensity = params.edgesDensity;
var rects = jsfeat_1.haar.detect_multi_scale(ii_sum, ii_sqsum, ii_tilted, params.useCanny? ii_canny : null, img_u8.cols, img_u8.rows, classifier, params.scaleFactor, params.minScale);
rects = jsfeat_1.haar.group_rectangles(rects, 1);
rects = jsfeat_1.haar.group_rectangles(rects, params.min_neighbors);

var rl = rects.length;
for (var i = rects.length-1;i >= 0;i--) {
if (rects[i].confidence < params.confidenceThreshold) {
rects.splice(i,1);
}
}

var rl = rects.length;
if (rl == 0) {
reject();
} else {
Expand Down
15 changes: 11 additions & 4 deletions src/facedetector/faceDetection.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions src/facedetector/faceDetection_worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 512b882

Please sign in to comment.