diff --git a/samples/gpu/performance/tests.cpp b/samples/gpu/performance/tests.cpp index 933c2e2800..77d8621d6f 100644 --- a/samples/gpu/performance/tests.cpp +++ b/samples/gpu/performance/tests.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "performance.h" @@ -743,4 +744,39 @@ TEST(threshold) gpu::threshold(d_src, d_dst, 50.0, 0.0, THRESH_TRUNC); GPU_OFF; } -} \ No newline at end of file +} + + +TEST(projectPoints) +{ + Mat src; + vector dst; + gpu::GpuMat d_src, d_dst; + + Mat rvec; gen(rvec, 1, 3, CV_32F, 0, 1); + Mat tvec; gen(tvec, 1, 3, CV_32F, 0, 1); + Mat camera_mat; gen(camera_mat, 3, 3, CV_32F, 0, 1); + camera_mat.at(0, 1) = 0.f; + camera_mat.at(1, 0) = 0.f; + camera_mat.at(2, 0) = 0.f; + camera_mat.at(2, 1) = 0.f; + + for (int size = 1e6, count = 0; size >= 1e5 && count < 5; size /= 1.4, count++) + { + SUBTEST << "size " << size; + + gen(src, 1, size, CV_32FC3, Scalar::all(0), Scalar::all(10)); + dst.resize(size); + + CPU_ON; + projectPoints(src, rvec, tvec, camera_mat, Mat(), dst); + CPU_OFF; + + d_src = src; + d_dst.create(1, size, CV_32FC2); + + GPU_ON; + gpu::projectPoints(d_src, rvec, tvec, camera_mat, Mat(), d_dst); + GPU_OFF; + } +}