mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -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']}
|
||||
|
||||
@@ -171,7 +171,7 @@ aruco = {'': ['detectMarkers', 'drawDetectedMarkers', 'drawAxis', 'estimatePoseS
|
||||
'aruco_CharucoBoard': ['create', 'draw'],
|
||||
}
|
||||
|
||||
calib3d = {'': ['findHomography','calibrateCameraExtended', 'drawFrameAxes', 'getDefaultNewCameraMatrix', 'initUndistortRectifyMap']}
|
||||
calib3d = {'': ['findHomography', 'calibrateCameraExtended', 'drawFrameAxes', 'estimateAffine2D', 'getDefaultNewCameraMatrix', 'initUndistortRectifyMap', 'Rodrigues']}
|
||||
|
||||
def makeWhiteList(module_list):
|
||||
wl = {}
|
||||
|
||||
@@ -41,3 +41,51 @@ QUnit.test('findHomography', function(assert) {
|
||||
|
||||
assert.ok(mat instanceof cv.Mat);
|
||||
});
|
||||
|
||||
QUnit.test('Rodrigues', function(assert) {
|
||||
// Converts a rotation matrix to a rotation vector and vice versa
|
||||
// data64F is the output array
|
||||
const rvec0 = cv.matFromArray(1, 3, cv.CV_64F, [1,1,1]);
|
||||
let rMat0 = new cv.Mat();
|
||||
let rvec1 = new cv.Mat();
|
||||
|
||||
// Args: input Mat, output Mat. The function mutates the output Mat, so the function does not return anything.
|
||||
// cv.Rodrigues (InputArray=src, OutputArray=dst, jacobian=0)
|
||||
// https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#void%20Rodrigues(InputArray%20src,%20OutputArray%20dst,%20OutputArray%20jacobian)
|
||||
// vec to Mat, starting number is 3 long and each element is 1.
|
||||
cv.Rodrigues(rvec0, rMat0);
|
||||
|
||||
assert.ok(rMat0.data64F.length == 9);
|
||||
assert.ok(0.23 > rMat0.data64F[0] > 0.22);
|
||||
|
||||
// convert Mat to Vec, should be same as what we started with, 3 long and each item should be a 1.
|
||||
cv.Rodrigues(rMat0, rvec1);
|
||||
|
||||
assert.ok(rvec1.data64F.length == 3);
|
||||
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
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user