mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
combine absDiff and countNonZero tests
This commit is contained in:
parent
d60e3d11d5
commit
6bdaa3a24f
29
test/unit.js
29
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);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user