Skip to content

Commit a2a3018

Browse files
committed
Add Unit test to method
the expected match location should be (717, 0)
1 parent 344ea49 commit a2a3018

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

test/unit.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,21 @@ test('Mean', function(assert) {
366366
assert.end();
367367
});
368368

369+
test('MatchTemplateByMatrix', function(assert) {
370+
var cv = require('../lib/opencv');
371+
cv.readImage("./examples/files/car1.jpg", function(err, target){
372+
cv.readImage("./examples/files/car1_template.jpg", function(err, template){
373+
var res = target.matchTemplateByMatrix(template, cv.Constants.TM_CCORR_NORMED);
374+
var minMax = res.minMaxLoc();
375+
var topLeft = minMax.maxLoc;
376+
assert.ok(topLeft, "Found Match");
377+
console.log(topLeft.x === 717);
378+
assert.equal(topLeft.x, 717, "match location x === 717");
379+
assert.equal(topLeft.y, 0, "match location y === 717");
380+
assert.end();
381+
});
382+
})
383+
});
384+
369385
// Test the examples folder.
370386
require('./examples')()
371-
372-

0 commit comments

Comments
 (0)