From 6bdaa3a24fc48e9ab05b0fe74fca9be794d0886a Mon Sep 17 00:00:00 2001 From: Tim Park Date: Mon, 29 Jul 2013 13:17:49 -0700 Subject: [PATCH] combine absDiff and countNonZero tests --- test/unit.js | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/test/unit.js b/test/unit.js index 863750c..7a5159d 100755 --- a/test/unit.js +++ b/test/unit.js @@ -190,17 +190,19 @@ vows.describe('Smoke Tests OpenCV').addBatch({ } } - , ".absDiff" : function(cv){ - var mat1 = new cv.Matrix(1,1); - mat1.set(0,0, 0); + , ".absDiff" : function(cv) { + cv.readImage("./examples/mona.png", function(err, im) { + cv.readImage("./examples/mona.png", function(err, im2){ + assert.ok(im); + assert.ok(im2); - var mat2 = new cv.Matrix(1,1); - mat2.set(0,0, 1); + var diff = new cv.Matrix(im.width(), im.height()); + diff.absDiff(im, im2); - var diff = new cv.Matrix(1,1); - diff.absDiff(mat1, mat2); - - assert.equal(diff.get(0,0), 1); + diff.convertGrayscale(); + assert.equal(diff.countNonZero(), 0); + }); + }); } , ".bitwiseXor" : function(cv) { @@ -216,15 +218,6 @@ vows.describe('Smoke Tests OpenCV').addBatch({ assert.equal(xored.get(0,0), 0); } - , ".countNonZero": function(cv) { - cv.readImage("./examples/mona.png", function(err, im) { - assert.ok(im); - - im.convertGrayscale(); - assert.equal(im.countNonZero(), 378000); - }); - } - }