mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 05:06:29 +08:00
fixed some tests in gpu module
This commit is contained in:
parent
95f7e5ca2f
commit
f6fc807d49
@ -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::zeros(1, 5, CV_32F), dst);
|
||||
projectPoints(src, rvec, tvec, camera_mat, Mat::zeros(1, 8, 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::zeros(1, 5, CV_32F), image_vec);
|
||||
projectPoints(object, rvec_gold, tvec_gold, camera_mat, Mat::zeros(1, 8, 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::zeros(1, 5, CV_32F), rvec, tvec, false, 200, 2.f, 100, &inliers);
|
||||
gpu::solvePnPRansac(object, image, camera_mat, Mat::zeros(1, 8, 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::zeros(1, 5, CV_32F), dst);
|
||||
projectPoints(src, rvec, tvec, camera_mat, Mat::zeros(1, 8, CV_32F), dst);
|
||||
CPU_OFF;
|
||||
|
||||
d_src = src;
|
||||
@ -814,12 +814,12 @@ TEST(solvePnPRansac)
|
||||
vector<int> inliers_cpu, inliers_gpu;
|
||||
|
||||
CPU_ON;
|
||||
solvePnPRansac(object, image, camera_mat, Mat::zeros(1, 5, CV_32F), rvec, tvec, false, num_iters,
|
||||
solvePnPRansac(object, image, camera_mat, Mat::zeros(1, 8, 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::zeros(1, 5, CV_32F), rvec, tvec, false, num_iters,
|
||||
gpu::solvePnPRansac(object, image, camera_mat, Mat::zeros(1, 8, CV_32F), rvec, tvec, false, num_iters,
|
||||
max_dist, int(num_points * 0.05), &inliers_gpu);
|
||||
GPU_OFF;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user