Skip to content

Commit

Permalink
nasty bug, good observation made by Christian Schneider
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Nov 7, 2010
1 parent adb30b1 commit 64bde45
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions js/ccv.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var ccv = {
__worker_scripts : {},

spawn : function (pre, script, params, post, complete, worker_num) {
var params = ccv.__get_named_arguments(arguments, ["pre", "script", "params", "post", "complete"]);
var params = ccv.__get_named_arguments(arguments, ["pre", "script", "params", "post", "complete", "worker_num"]);
var worker = new Worker("ccv.js");
worker.onmessage = function (event) {
params.complete(params.post((typeof event.data == "string") ? JSON.parse(event.data) : event.data));
Expand Down Expand Up @@ -134,10 +134,12 @@ var ccv = {

detect_objects : function (canvas, cascade, interval, min_neighbors, complete, worker_num, setup) {
var params = ccv.__get_named_arguments(arguments, ["canvas", "cascade", "interval", "min_neighbors", "complete", "worker_num", "setup"]);
var cascade = params.cascade;
var scale = Math.pow(2, 1 / (params.interval + 1));
var next = params.interval + 1;
var scale_upto = (cascade !== undefined) ? Math.floor(Math.log(Math.min(cascade.width, cascade.height)) / Math.log(scale)) : 0;
if (!params.setup) {
var cascade = params.cascade;
var scale = Math.pow(2, 1 / (params.interval + 1));
var next = params.interval + 1;
var scale_upto = Math.floor(Math.log(Math.min(params.canvas.width / cascade.width, params.canvas.height / cascade.height)) / Math.log(scale));
}
var pre = function () {
var pyr = new Array((scale_upto + next * 2) * 4);
var ret = new Array((scale_upto + next * 2) * 4);
Expand Down Expand Up @@ -196,7 +198,7 @@ var ccv = {
var cascade = params.cascade;
var scale = Math.pow(2, 1 / (params.interval + 1));
var next = params.interval + 1;
var scale_upto = Math.floor(Math.log(Math.min(cascade.width, cascade.height)) / Math.log(scale));
var scale_upto = Math.floor(Math.log(Math.min(pyr[0].width / cascade.width, pyr[0].height / cascade.height)) / Math.log(scale));
var i, j, k, x, y, q;
var scale_x = 1, scale_y = 1;
var dx = [0, 1, 0, 1];
Expand Down

0 comments on commit 64bde45

Please sign in to comment.