Commit a3144cba authored by Sebastián Gurin's avatar Sebastián Gurin Committed by Alexander Alekhin

Merge pull request #15480 from cancerberoSgx:estimateAffine2D

js - cv.estimateAffine2D, cv.warpPolar
parent 5c9a624a
......@@ -112,7 +112,7 @@ imgproc = {'': ['Canny', 'GaussianBlur', 'Laplacian', 'HoughLines', 'HoughLinesP
'goodFeaturesToTrack','grabCut','initUndistortRectifyMap', 'integral','integral2', 'isContourConvex', 'line', \
'matchShapes', 'matchTemplate','medianBlur', 'minAreaRect', 'minEnclosingCircle', 'moments', 'morphologyEx', \
'pointPolygonTest', 'putText','pyrDown','pyrUp','rectangle','remap', 'resize','sepFilter2D','threshold', \
'undistort','warpAffine','warpPerspective','watershed', \
'undistort','warpAffine','warpPerspective','warpPolar','watershed', \
'fillPoly', 'fillConvexPoly'],
'CLAHE': ['apply', 'collectGarbage', 'getClipLimit', 'getTilesGridSize', 'setClipLimit', 'setTilesGridSize']}
......@@ -143,7 +143,7 @@ features2d = {'Feature2D': ['detect', 'compute', 'detectAndCompute', 'descriptor
'BFMatcher': ['isMaskSupported', 'create'],
'': ['drawKeypoints', 'drawMatches', 'drawMatchesKnn']}
calib3d = {'': ['findHomography', 'Rodrigues']}
calib3d = {'': ['findHomography', 'estimateAffine2D', 'Rodrigues']}
def makeWhiteList(module_list):
wl = {}
......
......@@ -65,3 +65,27 @@ QUnit.test('Rodrigues', function(assert) {
assert.ok(1.01 > rvec1.data64F[0] > 0.9);
// Answer should be around 1: 0.9999999999999999
});
QUnit.test('estimateAffine2D', function(assert) {
const inputs = cv.matFromArray(4, 1, cv.CV_32FC2, [
1, 1,
80, 0,
0, 80,
80, 80
]);
const outputs = cv.matFromArray(4, 1, cv.CV_32FC2, [
21, 51,
70, 77,
40, 40,
10, 70
]);
const M = cv.estimateAffine2D(inputs, outputs);
assert.ok(M instanceof cv.Mat);
assert.deepEqual(Array.from(M.data), [
23, 55, 97, 126, 87, 139, 227, 63, 0, 0,
0, 0, 0, 0, 232, 191, 71, 246, 12, 68,
165, 35, 53, 64, 99, 56, 27, 66, 14, 254,
212, 63, 103, 102, 102, 102, 102, 102, 182, 191,
195, 252, 174, 22, 55, 97, 73, 64
]);
});
......@@ -960,3 +960,20 @@ QUnit.test('test_filter', function(assert) {
src.delete();
}
});
QUnit.test('warpPolar', function(assert) {
const lines = new cv.Mat(255, 255, cv.CV_8U, new cv.Scalar(0));
for (let r = 0; r < lines.rows; r++) {
lines.row(r).setTo(new cv.Scalar(r));
}
cv.warpPolar(lines, lines, { width: 5, height: 5 }, new cv.Point(2, 2), 3,
cv.INTER_CUBIC | cv.WARP_FILL_OUTLIERS | cv.WARP_INVERSE_MAP);
assert.ok(lines instanceof cv.Mat);
assert.deepEqual(Array.from(lines.data), [
159, 172, 191, 210, 223,
146, 159, 191, 223, 236,
128, 128, 0, 0, 0,
109, 96, 64, 32, 19,
96, 83, 64, 45, 32
]);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment