fixed failing GPU projectPoints and solvePnPRansac tests

pull/13383/head
Alexey Spizhevoy 14 years ago
parent d67e612f10
commit ce808af594
  1. 6
      modules/gpu/test/test_calib3d.cpp
  2. 8
      samples/gpu/performance/tests.cpp

@ -58,7 +58,7 @@ TEST(projectPoints, accuracy)
camera_mat.at<float>(2, 1) = 0.f;
vector<Point2f> dst;
projectPoints(src, rvec, tvec, camera_mat, Mat(), dst);
projectPoints(src, rvec, tvec, camera_mat, Mat::zeros(1, 5, CV_32F), dst);
GpuMat d_dst;
projectPoints(GpuMat(src), rvec, tvec, camera_mat, Mat(), d_dst);
@ -123,12 +123,12 @@ TEST(solvePnPRansac, accuracy)
Mat tvec_gold = randomMat(rng, Size(3, 1), CV_32F, 0, 1, false);
vector<Point2f> image_vec;
projectPoints(object, rvec_gold, tvec_gold, camera_mat, Mat(), image_vec);
projectPoints(object, rvec_gold, tvec_gold, camera_mat, Mat::zeros(1, 5, CV_32F), image_vec);
Mat image(1, image_vec.size(), CV_32FC2, &image_vec[0]);
Mat rvec, tvec;
vector<int> inliers;
gpu::solvePnPRansac(object, image, camera_mat, Mat(), rvec, tvec, false, 200, 2.f, 100, &inliers);
gpu::solvePnPRansac(object, image, camera_mat, Mat::zeros(1, 5, CV_32F), rvec, tvec, false, 200, 2.f, 100, &inliers);
ASSERT_LE(norm(rvec - rvec_gold), 1e-3f);
ASSERT_LE(norm(tvec - tvec_gold), 1e-3f);

@ -770,7 +770,7 @@ TEST(projectPoints)
dst.resize(size);
CPU_ON;
projectPoints(src, rvec, tvec, camera_mat, Mat(), dst);
projectPoints(src, rvec, tvec, camera_mat, Mat::zeros(1, 5, CV_32F), dst);
CPU_OFF;
d_src = src;
@ -814,13 +814,13 @@ TEST(solvePnPRansac)
vector<int> inliers_cpu, inliers_gpu;
CPU_ON;
solvePnPRansac(object, image, camera_mat, Mat(), rvec, tvec, false, num_iters,
solvePnPRansac(object, image, camera_mat, Mat::zeros(1, 5, CV_32F), rvec, tvec, false, num_iters,
max_dist, int(num_points * 0.05), inliers_cpu);
CPU_OFF;
GPU_ON;
gpu::solvePnPRansac(object, image, camera_mat, Mat(), rvec, tvec, false, num_iters,
gpu::solvePnPRansac(object, image, camera_mat, Mat::zeros(1, 5, CV_32F), rvec, tvec, false, num_iters,
max_dist, int(num_points * 0.05), &inliers_gpu);
GPU_OFF;
}
}
}

Loading…
Cancel
Save