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:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user