1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Fix drawKeypoints and drawMatches for JS

This commit is contained in:
Dmitry Kurtaev
2019-07-20 23:26:40 +03:00
parent 099f4f9e7c
commit a66a1a24d7
2 changed files with 35 additions and 2 deletions
+33
View File
@@ -80,3 +80,36 @@ QUnit.test('BFMatcher', function(assert) {
assert.equal(dm.size(), 67);
});
QUnit.test('Drawing', function(assert) {
// Generate key points.
let image = generateTestFrame();
let kp = new cv.KeyPointVector();
let descriptors = new cv.Mat();
let orb = new cv.ORB();
orb.detectAndCompute(image, new cv.Mat(), kp, descriptors);
assert.equal(kp.size(), 67);
let dst = new cv.Mat();
cv.drawKeypoints(image, kp, dst);
assert.equal(dst.rows, image.rows);
assert.equal(dst.cols, image.cols);
// Run a matcher.
let dm = new cv.DMatchVector();
let matcher = new cv.BFMatcher();
matcher.match(descriptors, descriptors, dm);
assert.equal(dm.size(), 67);
cv.drawMatches(image, kp, image, kp, dm, dst);
assert.equal(dst.rows, image.rows);
assert.equal(dst.cols, 2 * image.cols);
dm = new cv.DMatchVectorVector();
matcher.knnMatch(descriptors, descriptors, dm, 2);
assert.equal(dm.size(), 67);
cv.drawMatchesKnn(image, kp, image, kp, dm, dst);
assert.equal(dst.rows, image.rows);
assert.equal(dst.cols, 2 * image.cols);
});