added another triangulation test case from http://code.opencv.org/issues/3461; fixed partial derivative on distortion coefficients, as http://code.opencv.org/issues/4101 suggests
This commit is contained in:
parent
90a78585fb
commit
7fd5b3a0c5
@ -820,9 +820,9 @@ CV_IMPL void cvProjectPoints2( const CvMat* objectPoints,
|
||||
{
|
||||
dpdk_p[5] = fx*x*cdist*(-icdist2)*icdist2*r2;
|
||||
dpdk_p[dpdk_step+5] = fy*y*cdist*(-icdist2)*icdist2*r2;
|
||||
dpdk_p[6] = fx*x*icdist2*cdist*(-icdist2)*icdist2*r4;
|
||||
dpdk_p[6] = fx*x*cdist*(-icdist2)*icdist2*r4;
|
||||
dpdk_p[dpdk_step+6] = fy*y*cdist*(-icdist2)*icdist2*r4;
|
||||
dpdk_p[7] = fx*x*icdist2*cdist*(-icdist2)*icdist2*r6;
|
||||
dpdk_p[7] = fx*x*cdist*(-icdist2)*icdist2*r6;
|
||||
dpdk_p[dpdk_step+7] = fy*y*cdist*(-icdist2)*icdist2*r6;
|
||||
if( _dpdk->cols > 8 )
|
||||
{
|
||||
|
@ -1876,9 +1876,11 @@ TEST(Calib3d_ProjectPoints_CPP, regression) { CV_ProjectPointsTest_CPP test; tes
|
||||
TEST(Calib3d_StereoCalibrate_C, regression) { CV_StereoCalibrationTest_C test; test.safe_run(); }
|
||||
TEST(Calib3d_StereoCalibrate_CPP, regression) { CV_StereoCalibrationTest_CPP test; test.safe_run(); }
|
||||
|
||||
// the testcase by Christian Richardt
|
||||
|
||||
TEST(Calib3d_Triangulate, accuracy)
|
||||
{
|
||||
// the testcase from http://code.opencv.org/issues/4334
|
||||
{
|
||||
double P1data[] = { 250, 0, 200, 0, 0, 250, 150, 0, 0, 0, 1, 0 };
|
||||
double P2data[] = { 250, 0, 200, -250, 0, 250, 150, 0, 0, 0, 1, 0 };
|
||||
Mat P1(3, 4, CV_64F, P1data), P2(3, 4, CV_64F, P2data);
|
||||
@ -1896,8 +1898,50 @@ TEST(Calib3d_Triangulate, accuracy)
|
||||
convertPointsFromHomogeneous(res_, res);
|
||||
res = res.reshape(1, 1);
|
||||
|
||||
cout << "res0: " << res0 << endl;
|
||||
cout << "res: " << res << endl;
|
||||
cout << "[1]:" << endl;
|
||||
cout << "\tres0: " << res0 << endl;
|
||||
cout << "\tres: " << res << endl;
|
||||
|
||||
ASSERT_LE(norm(res, res0, NORM_INF), 1e-1);
|
||||
}
|
||||
|
||||
// another testcase http://code.opencv.org/issues/3461
|
||||
{
|
||||
Matx33d K1(6137.147949, 0.000000, 644.974609,
|
||||
0.000000, 6137.147949, 573.442749,
|
||||
0.000000, 0.000000, 1.000000);
|
||||
Matx33d K2(6137.147949, 0.000000, 644.674438,
|
||||
0.000000, 6137.147949, 573.079834,
|
||||
0.000000, 0.000000, 1.000000);
|
||||
|
||||
Matx34d RT1(1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0);
|
||||
|
||||
Matx34d RT2(0.998297, 0.0064108, -0.0579766, 143.614334,
|
||||
-0.0065818, 0.999975, -0.00275888, -5.160085,
|
||||
0.0579574, 0.00313577, 0.998314, 96.066109);
|
||||
|
||||
Matx34d P1 = K1*RT1;
|
||||
Matx34d P2 = K2*RT2;
|
||||
|
||||
float x1data[] = { 438.f, 19.f };
|
||||
float x2data[] = { 452.363600f, 16.452225f };
|
||||
float Xdata[] = { -81.049530f, -215.702804f, 2401.645449f };
|
||||
Mat x1(2, 1, CV_32F, x1data);
|
||||
Mat x2(2, 1, CV_32F, x2data);
|
||||
Mat res0(1, 3, CV_32F, Xdata);
|
||||
Mat res_, res;
|
||||
|
||||
triangulatePoints(P1, P2, x1, x2, res_);
|
||||
transpose(res_, res_);
|
||||
convertPointsFromHomogeneous(res_, res);
|
||||
res = res.reshape(1, 1);
|
||||
|
||||
cout << "[2]:" << endl;
|
||||
cout << "\tres0: " << res0 << endl;
|
||||
cout << "\tres: " << res << endl;
|
||||
|
||||
ASSERT_LE(norm(res, res0, NORM_INF), 2);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user