mirror of
https://github.com/opencv/opencv.git
synced 2025-01-19 06:53:50 +08:00
add sanity checks into the calib3d gpu performance tests
This commit is contained in:
parent
dce323a67b
commit
3de2023c61
@ -24,7 +24,7 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png",
|
||||
const int preset = 0;
|
||||
const int ndisp = 256;
|
||||
|
||||
if (runOnGpu)
|
||||
if (PERF_RUN_GPU())
|
||||
{
|
||||
cv::gpu::StereoBM_GPU d_bm(preset, ndisp);
|
||||
|
||||
@ -38,6 +38,8 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png",
|
||||
{
|
||||
d_bm(d_imgLeft, d_imgRight, d_dst);
|
||||
}
|
||||
|
||||
GPU_SANITY_CHECK(d_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -51,6 +53,8 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBM, Values(pair_string("gpu/perf/aloe.png",
|
||||
{
|
||||
bm(imgLeft, imgRight, dst);
|
||||
}
|
||||
|
||||
CPU_SANITY_CHECK(dst);
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +73,7 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(pair_string("gpu/
|
||||
|
||||
const int ndisp = 64;
|
||||
|
||||
if (runOnGpu)
|
||||
if (PERF_RUN_GPU())
|
||||
{
|
||||
cv::gpu::StereoBeliefPropagation d_bp(ndisp);
|
||||
|
||||
@ -83,10 +87,12 @@ PERF_TEST_P(ImagePair, Calib3D_StereoBeliefPropagation, Values(pair_string("gpu/
|
||||
{
|
||||
d_bp(d_imgLeft, d_imgRight, d_dst);
|
||||
}
|
||||
|
||||
GPU_SANITY_CHECK(d_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
FAIL();
|
||||
FAIL() << "No such CPU implementation analogy.";
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +111,7 @@ PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(pair_string("gpu/st
|
||||
|
||||
const int ndisp = 128;
|
||||
|
||||
if (runOnGpu)
|
||||
if (PERF_RUN_GPU())
|
||||
{
|
||||
cv::gpu::StereoConstantSpaceBP d_csbp(ndisp);
|
||||
|
||||
@ -119,10 +125,12 @@ PERF_TEST_P(ImagePair, Calib3D_StereoConstantSpaceBP, Values(pair_string("gpu/st
|
||||
{
|
||||
d_csbp(d_imgLeft, d_imgRight, d_dst);
|
||||
}
|
||||
|
||||
GPU_SANITY_CHECK(d_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
FAIL();
|
||||
FAIL() << "No such CPU implementation analogy.";
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,7 +147,7 @@ PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(pair_string("gpu
|
||||
|
||||
const int ndisp = 128;
|
||||
|
||||
if (runOnGpu)
|
||||
if (PERF_RUN_GPU())
|
||||
{
|
||||
cv::gpu::DisparityBilateralFilter d_filter(ndisp);
|
||||
|
||||
@ -153,10 +161,12 @@ PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(pair_string("gpu
|
||||
{
|
||||
d_filter(d_disp, d_img, d_dst);
|
||||
}
|
||||
|
||||
GPU_SANITY_CHECK(d_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
FAIL();
|
||||
FAIL() << "No such CPU implementation analogy.";
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +185,7 @@ PERF_TEST_P(Count, Calib3D_TransformPoints, Values(5000, 10000, 20000))
|
||||
const cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);
|
||||
const cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
|
||||
|
||||
if (runOnGpu)
|
||||
if (PERF_RUN_GPU())
|
||||
{
|
||||
cv::gpu::GpuMat d_src(src);
|
||||
cv::gpu::GpuMat d_dst;
|
||||
@ -186,10 +196,12 @@ PERF_TEST_P(Count, Calib3D_TransformPoints, Values(5000, 10000, 20000))
|
||||
{
|
||||
cv::gpu::transformPoints(d_src, rvec, tvec, d_dst);
|
||||
}
|
||||
|
||||
GPU_SANITY_CHECK(d_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
FAIL();
|
||||
FAIL() << "No such CPU implementation analogy.";
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +219,7 @@ PERF_TEST_P(Count, Calib3D_ProjectPoints, Values(5000, 10000, 20000))
|
||||
const cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);
|
||||
const cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);
|
||||
|
||||
if (runOnGpu)
|
||||
if (PERF_RUN_GPU())
|
||||
{
|
||||
cv::gpu::GpuMat d_src(src);
|
||||
cv::gpu::GpuMat d_dst;
|
||||
@ -218,6 +230,8 @@ PERF_TEST_P(Count, Calib3D_ProjectPoints, Values(5000, 10000, 20000))
|
||||
{
|
||||
cv::gpu::projectPoints(d_src, rvec, tvec, camera_mat, cv::Mat(), d_dst);
|
||||
}
|
||||
|
||||
GPU_SANITY_CHECK(d_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -229,6 +243,8 @@ PERF_TEST_P(Count, Calib3D_ProjectPoints, Values(5000, 10000, 20000))
|
||||
{
|
||||
cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);
|
||||
}
|
||||
|
||||
CPU_SANITY_CHECK(dst);
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,7 +281,7 @@ PERF_TEST_P(Count, Calib3D_SolvePnPRansac, Values(5000, 10000, 20000))
|
||||
cv::Mat rvec;
|
||||
cv::Mat tvec;
|
||||
|
||||
if (runOnGpu)
|
||||
if (PERF_RUN_GPU())
|
||||
{
|
||||
cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
|
||||
|
||||
@ -283,6 +299,9 @@ PERF_TEST_P(Count, Calib3D_SolvePnPRansac, Values(5000, 10000, 20000))
|
||||
cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);
|
||||
}
|
||||
}
|
||||
|
||||
CPU_SANITY_CHECK(rvec);
|
||||
CPU_SANITY_CHECK(tvec);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -299,7 +318,7 @@ PERF_TEST_P(Sz_Depth, Calib3D_ReprojectImageTo3D, Combine(GPU_TYPICAL_MAT_SIZES,
|
||||
cv::Mat Q(4, 4, CV_32FC1);
|
||||
fillRandom(Q, 0.1, 1.0);
|
||||
|
||||
if (runOnGpu)
|
||||
if (PERF_RUN_GPU())
|
||||
{
|
||||
cv::gpu::GpuMat d_src(src);
|
||||
cv::gpu::GpuMat d_dst;
|
||||
@ -310,6 +329,8 @@ PERF_TEST_P(Sz_Depth, Calib3D_ReprojectImageTo3D, Combine(GPU_TYPICAL_MAT_SIZES,
|
||||
{
|
||||
cv::gpu::reprojectImageTo3D(d_src, d_dst, Q);
|
||||
}
|
||||
|
||||
GPU_SANITY_CHECK(d_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -321,6 +342,8 @@ PERF_TEST_P(Sz_Depth, Calib3D_ReprojectImageTo3D, Combine(GPU_TYPICAL_MAT_SIZES,
|
||||
{
|
||||
cv::reprojectImageTo3D(src, dst, Q);
|
||||
}
|
||||
|
||||
CPU_SANITY_CHECK(dst);
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,7 +358,7 @@ PERF_TEST_P(Sz_Depth, Calib3D_DrawColorDisp, Combine(GPU_TYPICAL_MAT_SIZES, Valu
|
||||
cv::Mat src(size, type);
|
||||
fillRandom(src, 0, 255);
|
||||
|
||||
if (runOnGpu)
|
||||
if (PERF_RUN_GPU())
|
||||
{
|
||||
cv::gpu::GpuMat d_src(src);
|
||||
cv::gpu::GpuMat d_dst;
|
||||
@ -346,10 +369,12 @@ PERF_TEST_P(Sz_Depth, Calib3D_DrawColorDisp, Combine(GPU_TYPICAL_MAT_SIZES, Valu
|
||||
{
|
||||
cv::gpu::drawColorDisp(d_src, d_dst, 255);
|
||||
}
|
||||
|
||||
GPU_SANITY_CHECK(d_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
FAIL();
|
||||
FAIL() << "No such CPU implementation analogy.";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user