|
|
|
@ -784,10 +784,10 @@ TEST(projectPoints) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InitSolvePnpRansac() |
|
|
|
|
{ |
|
|
|
|
Mat object; gen(object, 1, 4, CV_32FC3, Scalar::all(0), Scalar::all(100)); |
|
|
|
|
Mat image; gen(image, 1, 4, CV_32FC2, Scalar::all(0), Scalar::all(100)); |
|
|
|
|
Mat rvec, tvec; |
|
|
|
|
{ |
|
|
|
|
Mat object; gen(object, 1, 4, CV_32FC3, Scalar::all(0), Scalar::all(100)); |
|
|
|
|
Mat image; gen(image, 1, 4, CV_32FC2, Scalar::all(0), Scalar::all(100)); |
|
|
|
|
Mat rvec, tvec; |
|
|
|
|
gpu::solvePnPRansac(object, image, Mat::eye(3, 3, CV_32F), Mat(), rvec, tvec); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -796,31 +796,31 @@ TEST(solvePnPRansac) |
|
|
|
|
{ |
|
|
|
|
InitSolvePnpRansac(); |
|
|
|
|
|
|
|
|
|
for (int num_points = 5000; num_points <= 300000; num_points = int(num_points * 3.76)) |
|
|
|
|
{ |
|
|
|
|
SUBTEST << "num_points " << num_points; |
|
|
|
|
|
|
|
|
|
Mat object; gen(object, 1, num_points, CV_32FC3, Scalar::all(10), Scalar::all(100)); |
|
|
|
|
Mat image; gen(image, 1, num_points, CV_32FC2, Scalar::all(10), Scalar::all(100)); |
|
|
|
|
Mat camera_mat; gen(camera_mat, 3, 3, CV_32F, 0.5, 1); |
|
|
|
|
camera_mat.at<float>(0, 1) = 0.f; |
|
|
|
|
camera_mat.at<float>(1, 0) = 0.f; |
|
|
|
|
camera_mat.at<float>(2, 0) = 0.f; |
|
|
|
|
camera_mat.at<float>(2, 1) = 0.f; |
|
|
|
|
|
|
|
|
|
Mat rvec, tvec; |
|
|
|
|
const int num_iters = 200; |
|
|
|
|
const float max_dist = 2.0f; |
|
|
|
|
vector<int> inliers_cpu, inliers_gpu; |
|
|
|
|
|
|
|
|
|
CPU_ON; |
|
|
|
|
solvePnPRansac(object, image, camera_mat, Mat(), 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, |
|
|
|
|
max_dist, int(num_points * 0.05), &inliers_gpu); |
|
|
|
|
for (int num_points = 5000; num_points <= 300000; num_points = int(num_points * 3.76)) |
|
|
|
|
{ |
|
|
|
|
SUBTEST << "num_points " << num_points; |
|
|
|
|
|
|
|
|
|
Mat object; gen(object, 1, num_points, CV_32FC3, Scalar::all(10), Scalar::all(100)); |
|
|
|
|
Mat image; gen(image, 1, num_points, CV_32FC2, Scalar::all(10), Scalar::all(100)); |
|
|
|
|
Mat camera_mat; gen(camera_mat, 3, 3, CV_32F, 0.5, 1); |
|
|
|
|
camera_mat.at<float>(0, 1) = 0.f; |
|
|
|
|
camera_mat.at<float>(1, 0) = 0.f; |
|
|
|
|
camera_mat.at<float>(2, 0) = 0.f; |
|
|
|
|
camera_mat.at<float>(2, 1) = 0.f; |
|
|
|
|
|
|
|
|
|
Mat rvec, tvec; |
|
|
|
|
const int num_iters = 200; |
|
|
|
|
const float max_dist = 2.0f; |
|
|
|
|
vector<int> inliers_cpu, inliers_gpu; |
|
|
|
|
|
|
|
|
|
CPU_ON; |
|
|
|
|
solvePnPRansac(object, image, camera_mat, Mat(), 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, |
|
|
|
|
max_dist, int(num_points * 0.05), &inliers_gpu); |
|
|
|
|
GPU_OFF; |
|
|
|
|
} |
|
|
|
|
} |