\r
DEF_PARAM_TEST_1(ImagePair, pair_string);\r
\r
-PERF_TEST_P(ImagePair, Video_BroxOpticalFlow, Values<pair_string>(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))\r
+PERF_TEST_P(ImagePair, Video_BroxOpticalFlow,\r
+ Values<pair_string>(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))\r
{\r
declare.time(10);\r
\r
frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0);\r
frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0);\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame0(frame0);\r
cv::gpu::GpuMat d_frame1(frame1);\r
{\r
d_flow(d_frame0, d_frame1, d_u, d_v);\r
}\r
+\r
+ GPU_SANITY_CHECK(d_u);\r
+ GPU_SANITY_CHECK(d_v);\r
}\r
else\r
{\r
- FAIL();\r
+ FAIL() << "No such CPU implementation analogy";\r
}\r
}\r
\r
//////////////////////////////////////////////////////\r
// InterpolateFrames\r
\r
-PERF_TEST_P(ImagePair, Video_InterpolateFrames, Values<pair_string>(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))\r
+PERF_TEST_P(ImagePair, Video_InterpolateFrames,\r
+ Values<pair_string>(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))\r
{\r
cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(frame0.empty());\r
frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0);\r
frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0);\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame0(frame0);\r
cv::gpu::GpuMat d_frame1(frame1);\r
{\r
cv::gpu::interpolateFrames(d_frame0, d_frame1, d_fu, d_fv, d_bu, d_bv, 0.5f, d_newFrame, d_buf);\r
}\r
+\r
+ GPU_SANITY_CHECK(d_fu);\r
+ GPU_SANITY_CHECK(d_fv);\r
+ GPU_SANITY_CHECK(d_bu);\r
+ GPU_SANITY_CHECK(d_bv);\r
}\r
else\r
{\r
- FAIL();\r
+ FAIL() << "No such CPU implementation analogy";\r
}\r
}\r
\r
//////////////////////////////////////////////////////\r
// CreateOpticalFlowNeedleMap\r
\r
-PERF_TEST_P(ImagePair, Video_CreateOpticalFlowNeedleMap, Values<pair_string>(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))\r
+PERF_TEST_P(ImagePair, Video_CreateOpticalFlowNeedleMap,\r
+ Values<pair_string>(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))\r
{\r
cv::Mat frame0 = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(frame0.empty());\r
frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0);\r
frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0);\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame0(frame0);\r
cv::gpu::GpuMat d_frame1(frame1);\r
{\r
cv::gpu::createOpticalFlowNeedleMap(d_u, d_v, d_vertex, d_colors);\r
}\r
+\r
+ GPU_SANITY_CHECK(d_vertex);\r
+ GPU_SANITY_CHECK(d_colors)\r
}\r
else\r
{\r
- FAIL();\r
+ FAIL() << "No such CPU implementation analogy";\r
}\r
}\r
\r
\r
DEF_PARAM_TEST(Image_MinDistance, string, double);\r
\r
-PERF_TEST_P(Image_MinDistance, Video_GoodFeaturesToTrack, Combine(Values<string>("gpu/perf/aloe.png"), Values(0.0, 3.0)))\r
+PERF_TEST_P(Image_MinDistance, Video_GoodFeaturesToTrack,\r
+ Combine(Values<string>("gpu/perf/aloe.png"), Values(0.0, 3.0)))\r
{\r
string fileName = GET_PARAM(0);\r
double minDistance = GET_PARAM(1);\r
cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(image.empty());\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GoodFeaturesToTrackDetector_GPU d_detector(8000, 0.01, minDistance);\r
\r
{\r
d_detector(d_image, d_pts);\r
}\r
+\r
+ GPU_SANITY_CHECK(d_pts);\r
}\r
else\r
{\r
{\r
cv::goodFeaturesToTrack(image, pts, 8000, 0.01, minDistance);\r
}\r
+\r
+ CPU_SANITY_CHECK(pts);\r
}\r
}\r
\r
cv::Mat pts;\r
cv::goodFeaturesToTrack(gray_frame, pts, points, 0.01, 0.0);\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_pts(pts.reshape(2, 1));\r
\r
{\r
d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status);\r
}\r
+\r
+ GPU_SANITY_CHECK(d_status);\r
}\r
else\r
{\r
cv::Size(winSize, winSize), levels - 1,\r
cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, iters, 0.01));\r
}\r
+\r
+ CPU_SANITY_CHECK(status);\r
}\r
}\r
\r
cv::Mat frame1 = readImage(imagePair.second, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(frame1.empty());\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame0(frame0);\r
cv::gpu::GpuMat d_frame1(frame1);\r
{\r
d_pyrLK.dense(d_frame0, d_frame1, d_u, d_v);\r
}\r
+\r
+ GPU_SANITY_CHECK(d_u);\r
+ GPU_SANITY_CHECK(d_v);\r
}\r
else\r
{\r
- FAIL();\r
+ FAIL() << "No such CPU implementation analogy";\r
}\r
}\r
\r
//////////////////////////////////////////////////////\r
// FarnebackOpticalFlow\r
\r
-PERF_TEST_P(ImagePair, Video_FarnebackOpticalFlow, Values<pair_string>(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))\r
+PERF_TEST_P(ImagePair, Video_FarnebackOpticalFlow,\r
+ Values<pair_string>(make_pair("gpu/opticalflow/frame0.png", "gpu/opticalflow/frame1.png")))\r
{\r
declare.time(10);\r
\r
double polySigma = 1.1;\r
int flags = 0;\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame0(frame0);\r
cv::gpu::GpuMat d_frame1(frame1);\r
{\r
d_farneback(d_frame0, d_frame1, d_u, d_v);\r
}\r
+\r
+ GPU_SANITY_CHECK(d_u);\r
+ GPU_SANITY_CHECK(d_v);\r
}\r
else\r
{\r
{\r
cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags);\r
}\r
+\r
+ CPU_SANITY_CHECK(flow);\r
}\r
}\r
\r
\r
DEF_PARAM_TEST_1(Video, string);\r
\r
-PERF_TEST_P(Video, Video_FGDStatModel, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"))\r
+PERF_TEST_P(Video, DISABLED_Video_FGDStatModel, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"))\r
{\r
declare.time(60);\r
\r
cap >> frame;\r
ASSERT_FALSE(frame.empty());\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame(frame);\r
\r
\r
DEF_PARAM_TEST(Video_Cn_LearningRate, string, MatCn, double);\r
\r
-PERF_TEST_P(Video_Cn_LearningRate, Video_MOG, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4, Values(0.0, 0.01)))\r
+PERF_TEST_P(Video_Cn_LearningRate, DISABLED_Video_MOG,\r
+ Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4, Values(0.0, 0.01)))\r
{\r
string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));\r
int cn = GET_PARAM(1);\r
cv::swap(temp, frame);\r
}\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame(frame);\r
cv::gpu::MOG_GPU d_mog;\r
\r
DEF_PARAM_TEST(Video_Cn, string, int);\r
\r
-PERF_TEST_P(Video_Cn, Video_MOG2, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4))\r
+PERF_TEST_P(Video_Cn, DISABLED_Video_MOG2,\r
+ Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4))\r
{\r
string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));\r
int cn = GET_PARAM(1);\r
cv::swap(temp, frame);\r
}\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame(frame);\r
cv::gpu::MOG2_GPU d_mog2;\r
//////////////////////////////////////////////////////\r
// MOG2GetBackgroundImage\r
\r
-PERF_TEST_P(Video_Cn, Video_MOG2GetBackgroundImage, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4))\r
+PERF_TEST_P(Video_Cn, Video_MOG2GetBackgroundImage,\r
+ Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4))\r
{\r
string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));\r
int cn = GET_PARAM(1);\r
\r
cv::Mat frame;\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame;\r
cv::gpu::MOG2_GPU d_mog2;\r
{\r
d_mog2.getBackgroundImage(d_background);\r
}\r
+\r
+ GPU_SANITY_CHECK(d_background);\r
}\r
else\r
{\r
{\r
mog2.getBackgroundImage(background);\r
}\r
+\r
+ CPU_SANITY_CHECK(background);\r
}\r
}\r
\r
//////////////////////////////////////////////////////\r
// VIBE\r
\r
-PERF_TEST_P(Video_Cn, Video_VIBE, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4))\r
+PERF_TEST_P(Video_Cn, DISABLED_Video_VIBE,\r
+ Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4))\r
{\r
string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));\r
int cn = GET_PARAM(1);\r
cv::swap(temp, frame);\r
}\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame(frame);\r
cv::gpu::VIBE_GPU d_vibe;\r
}\r
else\r
{\r
- FAIL();\r
+ FAIL() << "No such CPU implementation analogy";\r
}\r
}\r
\r
\r
DEF_PARAM_TEST(Video_Cn_MaxFeatures, string, MatCn, int);\r
\r
-PERF_TEST_P(Video_Cn_MaxFeatures, Video_GMG, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4, Values(20, 40, 60)))\r
+PERF_TEST_P(Video_Cn_MaxFeatures, DISABLED_Video_GMG,\r
+ Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), GPU_CHANNELS_1_3_4, Values(20, 40, 60)))\r
{\r
std::string inputFile = perf::TestBase::getDataPath(GET_PARAM(0));\r
int cn = GET_PARAM(1);\r
cv::swap(temp, frame);\r
}\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::GpuMat d_frame(frame);\r
cv::gpu::GpuMat d_fgmask;\r
//////////////////////////////////////////////////////\r
// VideoWriter\r
\r
-PERF_TEST_P(Video, Video_VideoWriter, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"))\r
+PERF_TEST_P(Video, DISABLED_Video_VideoWriter, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"))\r
{\r
declare.time(30);\r
\r
\r
cv::Mat frame;\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::VideoWriter_GPU d_writer;\r
\r
\r
string inputFile = perf::TestBase::getDataPath(GetParam());\r
\r
- if (runOnGpu)\r
+ if (PERF_RUN_GPU())\r
{\r
cv::gpu::VideoReader_GPU d_reader(inputFile);\r
ASSERT_TRUE( d_reader.isOpened() );\r
{\r
d_reader.read(d_frame);\r
}\r
+\r
+ GPU_SANITY_CHECK(d_frame);\r
}\r
else\r
{\r
{\r
reader >> frame;\r
}\r
+\r
+ CPU_SANITY_CHECK(frame);\r
}\r
}\r
\r