2012-05-22 12:29:58 +02:00
|
|
|
#include "perf_cpu_precomp.hpp"
|
2012-05-22 10:29:08 +02:00
|
|
|
|
|
|
|
#ifdef HAVE_CUDA
|
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// StereoBM
|
|
|
|
|
|
|
|
GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo)
|
|
|
|
{
|
|
|
|
cv::Mat img_l = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img_l.empty());
|
|
|
|
|
|
|
|
cv::Mat img_r = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img_r.empty());
|
|
|
|
|
|
|
|
cv::StereoBM bm(0, 256);
|
|
|
|
|
|
|
|
cv::Mat dst;
|
|
|
|
|
|
|
|
bm(img_l, img_r, dst);
|
|
|
|
|
|
|
|
declare.time(5.0);
|
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
|
|
|
bm(img_l, img_r, dst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(Calib3D, StereoBM, ALL_DEVICES);
|
|
|
|
|
2012-05-22 10:29:08 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// ProjectPoints
|
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
IMPLEMENT_PARAM_CLASS(Count, int)
|
|
|
|
|
|
|
|
GPU_PERF_TEST(ProjectPoints, cv::gpu::DeviceInfo, Count)
|
2012-05-22 10:29:08 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
int count = GET_PARAM(1);
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat src(1, count, CV_32FC3);
|
|
|
|
fill(src, -100, 100);
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
|
|
|
|
cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
|
|
|
|
cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);
|
2012-05-22 12:29:58 +02:00
|
|
|
cv::Mat dst;
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);
|
|
|
|
|
2012-05-22 10:29:08 +02:00
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);
|
2012-05-22 10:29:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(Calib3D, ProjectPoints, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
testing::Values<Count>(5000, 10000, 20000)));
|
2012-05-22 10:29:08 +02:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// SolvePnPRansac
|
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
GPU_PERF_TEST(SolvePnPRansac, cv::gpu::DeviceInfo, Count)
|
2012-05-22 10:29:08 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
int count = GET_PARAM(1);
|
|
|
|
|
|
|
|
cv::Mat object(1, count, CV_32FC3);
|
|
|
|
fill(object, -100, 100);
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat camera_mat(3, 3, CV_32FC1);
|
|
|
|
fill(camera_mat, 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;
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0));
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
std::vector<cv::Point2f> image_vec;
|
|
|
|
cv::Mat rvec_gold(1, 3, CV_32FC1);
|
|
|
|
fill(rvec_gold, 0, 1);
|
|
|
|
cv::Mat tvec_gold(1, 3, CV_32FC1);
|
|
|
|
fill(tvec_gold, 0, 1);
|
|
|
|
cv::projectPoints(object, rvec_gold, tvec_gold, camera_mat, dist_coef, image_vec);
|
|
|
|
|
|
|
|
cv::Mat image(1, count, CV_32FC2, &image_vec[0]);
|
|
|
|
|
|
|
|
cv::Mat rvec;
|
|
|
|
cv::Mat tvec;
|
|
|
|
|
|
|
|
cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
|
|
|
|
|
|
|
|
declare.time(10.0);
|
2012-05-22 10:29:08 +02:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
|
2012-05-22 10:29:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(Calib3D, SolvePnPRansac, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
testing::Values<Count>(5000, 10000, 20000)));
|
2012-05-22 10:29:08 +02:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2012-05-23 14:58:01 +02:00
|
|
|
// ReprojectImageTo3D
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
GPU_PERF_TEST(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, MatDepth)
|
2012-05-22 10:29:08 +02:00
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Size size = GET_PARAM(1);
|
|
|
|
int depth = GET_PARAM(2);
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat src(size, depth);
|
|
|
|
fill(src, 5.0, 30.0);
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat Q(4, 4, CV_32FC1);
|
|
|
|
fill(Q, 0.1, 1.0);
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::Mat dst;
|
2012-05-22 10:29:08 +02:00
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::reprojectImageTo3D(src, dst, Q);
|
2012-05-22 10:29:08 +02:00
|
|
|
|
|
|
|
TEST_CYCLE()
|
|
|
|
{
|
2012-05-23 14:58:01 +02:00
|
|
|
cv::reprojectImageTo3D(src, dst, Q);
|
2012-05-22 10:29:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-23 14:58:01 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(Calib3D, ReprojectImageTo3D, testing::Combine(
|
|
|
|
ALL_DEVICES,
|
|
|
|
GPU_TYPICAL_MAT_SIZES,
|
|
|
|
testing::Values<MatDepth>(CV_8U, CV_16S)));
|
2012-05-22 10:29:08 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|