combine absDiff and countNonZero tests

This commit is contained in:
Tim Park 2013-07-29 13:17:49 -07:00
parent d60e3d11d5
commit 6bdaa3a24f

View File

@ -190,17 +190,19 @@ vows.describe('Smoke Tests OpenCV').addBatch({
} }
} }
, ".absDiff" : function(cv){ , ".absDiff" : function(cv) {
var mat1 = new cv.Matrix(1,1); cv.readImage("./examples/mona.png", function(err, im) {
mat1.set(0,0, 0); cv.readImage("./examples/mona.png", function(err, im2){
assert.ok(im);
assert.ok(im2);
var mat2 = new cv.Matrix(1,1); var diff = new cv.Matrix(im.width(), im.height());
mat2.set(0,0, 1); diff.absDiff(im, im2);
var diff = new cv.Matrix(1,1); diff.convertGrayscale();
diff.absDiff(mat1, mat2); assert.equal(diff.countNonZero(), 0);
});
assert.equal(diff.get(0,0), 1); });
} }
, ".bitwiseXor" : function(cv) { , ".bitwiseXor" : function(cv) {
@ -216,15 +218,6 @@ vows.describe('Smoke Tests OpenCV').addBatch({
assert.equal(xored.get(0,0), 0); 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);
});
}
} }