{\r
declare.time(5.0);\r
\r
- cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
+ const cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(imgLeft.empty());\r
\r
- cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);\r
+ const cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(imgRight.empty());\r
\r
- cv::gpu::StereoBM_GPU d_bm(0, 256);\r
- cv::gpu::GpuMat d_imgLeft(imgLeft);\r
- cv::gpu::GpuMat d_imgRight(imgRight);\r
- cv::gpu::GpuMat d_dst;\r
+ const int preset = 0;\r
+ const int ndisp = 256;\r
\r
- d_bm(d_imgLeft, d_imgRight, d_dst);\r
-\r
- TEST_CYCLE()\r
+ if (runOnGpu)\r
{\r
+ cv::gpu::StereoBM_GPU d_bm(preset, ndisp);\r
+\r
+ cv::gpu::GpuMat d_imgLeft(imgLeft);\r
+ cv::gpu::GpuMat d_imgRight(imgRight);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
d_bm(d_imgLeft, d_imgRight, d_dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ d_bm(d_imgLeft, d_imgRight, d_dst);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ cv::StereoBM bm(preset, ndisp);\r
+\r
+ cv::Mat dst;\r
+\r
+ bm(imgLeft, imgRight, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ bm(imgLeft, imgRight, dst);\r
+ }\r
}\r
}\r
\r
{\r
declare.time(10.0);\r
\r
- cv::Mat imgLeft = readImage(GetParam().first);\r
+ const cv::Mat imgLeft = readImage(GetParam().first);\r
ASSERT_FALSE(imgLeft.empty());\r
\r
- cv::Mat imgRight = readImage(GetParam().second);\r
+ const cv::Mat imgRight = readImage(GetParam().second);\r
ASSERT_FALSE(imgRight.empty());\r
\r
- cv::gpu::StereoBeliefPropagation d_bp(64);\r
- cv::gpu::GpuMat d_imgLeft(imgLeft);\r
- cv::gpu::GpuMat d_imgRight(imgRight);\r
- cv::gpu::GpuMat d_dst;\r
+ const int ndisp = 64;\r
\r
- d_bp(d_imgLeft, d_imgRight, d_dst);\r
-\r
- TEST_CYCLE()\r
+ if (runOnGpu)\r
{\r
+ cv::gpu::StereoBeliefPropagation d_bp(ndisp);\r
+\r
+ cv::gpu::GpuMat d_imgLeft(imgLeft);\r
+ cv::gpu::GpuMat d_imgRight(imgRight);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
d_bp(d_imgLeft, d_imgRight, d_dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ d_bp(d_imgLeft, d_imgRight, d_dst);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ FAIL();\r
}\r
}\r
\r
{\r
declare.time(10.0);\r
\r
- cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
+ const cv::Mat imgLeft = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(imgLeft.empty());\r
\r
- cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);\r
+ const cv::Mat imgRight = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(imgRight.empty());\r
\r
- cv::gpu::StereoConstantSpaceBP d_csbp(128);\r
- cv::gpu::GpuMat d_imgLeft(imgLeft);\r
- cv::gpu::GpuMat d_imgRight(imgRight);\r
- cv::gpu::GpuMat d_dst;\r
-\r
- d_csbp(d_imgLeft, d_imgRight, d_dst);\r
+ const int ndisp = 128;\r
\r
- TEST_CYCLE()\r
+ if (runOnGpu)\r
{\r
+ cv::gpu::StereoConstantSpaceBP d_csbp(ndisp);\r
+\r
+ cv::gpu::GpuMat d_imgLeft(imgLeft);\r
+ cv::gpu::GpuMat d_imgRight(imgRight);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
d_csbp(d_imgLeft, d_imgRight, d_dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ d_csbp(d_imgLeft, d_imgRight, d_dst);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ FAIL();\r
}\r
}\r
\r
\r
PERF_TEST_P(ImagePair, Calib3D_DisparityBilateralFilter, Values(make_pair<string, string>("gpu/stereobm/aloe-L.png", "gpu/stereobm/aloe-disp.png")))\r
{\r
- cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
+ const cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(img.empty());\r
\r
- cv::Mat disp = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);\r
+ const cv::Mat disp = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(disp.empty());\r
\r
- cv::gpu::DisparityBilateralFilter d_filter(128);\r
- cv::gpu::GpuMat d_img(img);\r
- cv::gpu::GpuMat d_disp(disp);\r
- cv::gpu::GpuMat d_dst;\r
+ const int ndisp = 128;\r
\r
- d_filter(d_disp, d_img, d_dst);\r
-\r
- TEST_CYCLE()\r
+ if (runOnGpu)\r
{\r
+ cv::gpu::DisparityBilateralFilter d_filter(ndisp);\r
+\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_disp(disp);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
d_filter(d_disp, d_img, d_dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ d_filter(d_disp, d_img, d_dst);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ FAIL();\r
}\r
}\r
\r
\r
PERF_TEST_P(Count, Calib3D_TransformPoints, Values(5000, 10000, 20000))\r
{\r
- int count = GetParam();\r
+ const int count = GetParam();\r
\r
cv::Mat src(1, count, CV_32FC3);\r
fillRandom(src, -100, 100);\r
\r
- cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);\r
- cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);\r
+ const cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);\r
+ const cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::transformPoints(d_src, rvec, tvec, d_dst);\r
+ cv::gpu::transformPoints(d_src, rvec, tvec, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::transformPoints(d_src, rvec, tvec, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::transformPoints(d_src, rvec, tvec, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
\r
PERF_TEST_P(Count, Calib3D_ProjectPoints, Values(5000, 10000, 20000))\r
{\r
- int count = GetParam();\r
+ const int count = GetParam();\r
\r
cv::Mat src(1, count, CV_32FC3);\r
fillRandom(src, -100, 100);\r
\r
- cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);\r
- cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);\r
- cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);\r
+ const cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);\r
+ const cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);\r
+ const cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::projectPoints(d_src, rvec, tvec, camera_mat, cv::Mat(), d_dst);\r
+ cv::gpu::projectPoints(d_src, rvec, tvec, camera_mat, cv::Mat(), d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::projectPoints(d_src, rvec, tvec, camera_mat, cv::Mat(), d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::projectPoints(d_src, rvec, tvec, camera_mat, cv::Mat(), d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Count, Calib3D_SolvePnPRansac, Values(5000, 10000, 20000))\r
{\r
- declare.time(3.0);\r
+ declare.time(10.0);\r
\r
- int count = GetParam();\r
+ const int count = GetParam();\r
\r
cv::Mat object(1, count, CV_32FC3);\r
fillRandom(object, -100, 100);\r
camera_mat.at<float>(2, 0) = 0.f;\r
camera_mat.at<float>(2, 1) = 0.f;\r
\r
- cv::Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0));\r
+ const cv::Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0));\r
\r
std::vector<cv::Point2f> image_vec;\r
cv::Mat rvec_gold(1, 3, CV_32FC1);\r
cv::Mat rvec;\r
cv::Mat tvec;\r
\r
- cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);\r
-\r
- TEST_CYCLE()\r
+ if (runOnGpu)\r
{\r
cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Calib3D_ReprojectImageTo3D, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src, 5.0, 30.0);\r
cv::Mat Q(4, 4, CV_32FC1);\r
fillRandom(Q, 0.1, 1.0);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::reprojectImageTo3D(d_src, d_dst, Q);\r
+ cv::gpu::reprojectImageTo3D(d_src, d_dst, Q);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::reprojectImageTo3D(d_src, d_dst, Q);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::reprojectImageTo3D(d_src, d_dst, Q);\r
+ cv::Mat dst;\r
+\r
+ cv::reprojectImageTo3D(src, dst, Q);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::reprojectImageTo3D(src, dst, Q);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Calib3D_DrawColorDisp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int type = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int type = GET_PARAM(1);\r
\r
cv::Mat src(size, type);\r
fillRandom(src, 0, 255);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::drawColorDisp(d_src, d_dst, 255);\r
+ cv::gpu::drawColorDisp(d_src, d_dst, 255);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::drawColorDisp(d_src, d_dst, 255);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::drawColorDisp(d_src, d_dst, 255);\r
+ FAIL();\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Cn, Core_Merge, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, Values(2, 3, 4)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- int channels = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const int channels = GET_PARAM(2);\r
\r
- std::vector<cv::gpu::GpuMat> d_src(channels);\r
+ std::vector<cv::Mat> src(channels);\r
for (int i = 0; i < channels; ++i)\r
- d_src[i] = cv::gpu::GpuMat(size, depth, cv::Scalar::all(i));\r
+ src[i] = cv::Mat(size, depth, cv::Scalar::all(i));\r
\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ std::vector<cv::gpu::GpuMat> d_src(channels);\r
+ for (int i = 0; i < channels; ++i)\r
+ d_src[i].upload(src[i]);\r
\r
- cv::gpu::merge(d_src, d_dst);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- TEST_CYCLE()\r
- {\r
cv::gpu::merge(d_src, d_dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::merge(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ cv::Mat dst;\r
+\r
+ cv::merge(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::merge(src, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Cn, Core_Split, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, Values(2, 3, 4)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- int channels = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const int channels = GET_PARAM(2);\r
\r
- cv::gpu::GpuMat d_src(size, CV_MAKE_TYPE(depth, channels), cv::Scalar(1, 2, 3, 4));\r
+ cv::Mat src(size, CV_MAKE_TYPE(depth, channels), cv::Scalar(1, 2, 3, 4));\r
\r
- std::vector<cv::gpu::GpuMat> d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
\r
- cv::gpu::split(d_src, d_dst);\r
+ std::vector<cv::gpu::GpuMat> d_dst;\r
\r
- TEST_CYCLE()\r
- {\r
cv::gpu::split(d_src, d_dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::split(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ std::vector<cv::Mat> dst;\r
+\r
+ cv::split(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::split(src, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_AddMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::add(d_src1, d_src2, d_dst);\r
+ cv::gpu::add(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::add(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::add(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::add(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::add(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_AddScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
cv::Scalar s(1, 2, 3, 4);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::add(d_src, s, d_dst);\r
+ cv::gpu::add(d_src, s, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::add(d_src, s, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::add(d_src, s, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::add(src, s, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::add(src, s, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_SubtractMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::subtract(d_src1, d_src2, d_dst);\r
+ cv::gpu::subtract(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::subtract(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::subtract(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::subtract(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::subtract(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_SubtractScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
cv::Scalar s(1, 2, 3, 4);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::subtract(d_src, s, d_dst);\r
+ cv::gpu::subtract(d_src, s, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::subtract(d_src, s, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::subtract(d_src, s, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::subtract(src, s, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::subtract(src, s, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_MultiplyMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::multiply(d_src1, d_src2, d_dst);\r
+ cv::gpu::multiply(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::multiply(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::multiply(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::multiply(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::multiply(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_MultiplyScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
cv::Scalar s(1, 2, 3, 4);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::multiply(d_src, s, d_dst);\r
+ cv::gpu::multiply(d_src, s, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::multiply(d_src, s, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::multiply(d_src, s, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::multiply(src, s, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::multiply(src, s, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_DivideMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::divide(d_src1, d_src2, d_dst);\r
+ cv::gpu::divide(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::divide(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::divide(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::divide(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::divide(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_DivideScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
cv::Scalar s(1, 2, 3, 4);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::divide(d_src, s, d_dst);\r
+ cv::gpu::divide(d_src, s, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::divide(d_src, s, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::divide(d_src, s, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::divide(src, s, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::divide(src, s, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_DivideScalarInv, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
double s = 100.0;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::divide(s, d_src, d_dst);\r
+ cv::gpu::divide(s, d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::divide(s, d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::divide(s, d_src, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::divide(s, src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::divide(s, src, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_AbsDiffMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::absdiff(d_src1, d_src2, d_dst);\r
+ cv::gpu::absdiff(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::absdiff(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::absdiff(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::absdiff(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::absdiff(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_AbsDiffScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
cv::Scalar s(1, 2, 3, 4);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::absdiff(d_src, s, d_dst);\r
+ cv::gpu::absdiff(d_src, s, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::absdiff(d_src, s, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::absdiff(d_src, s, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::absdiff(src, s, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::absdiff(src, s, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_Abs, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_16S, CV_32F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::abs(d_src, d_dst);\r
+ cv::gpu::abs(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::abs(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::abs(d_src, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_Sqr, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::sqr(d_src, d_dst);\r
+ cv::gpu::sqr(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::sqr(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::sqr(d_src, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_Sqrt, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::sqrt(d_src, d_dst);\r
+ cv::gpu::sqrt(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::sqrt(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::sqrt(d_src, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::sqrt(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::sqrt(src, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_Log, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src, 1.0, 255.0);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::log(d_src, d_dst);\r
+ cv::gpu::log(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::log(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::log(d_src, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::log(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::log(src, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_Exp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src, 1.0, 10.0);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::exp(d_src, d_dst);\r
+ cv::gpu::exp(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::exp(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::exp(d_src, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::exp(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::exp(src, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Power, Core_Pow, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16S, CV_32F), Values(0.3, 2.0, 2.4)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- double power = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const double power = GET_PARAM(2);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src, 1.0, 10.0);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::pow(d_src, power, d_dst);\r
+ cv::gpu::pow(d_src, power, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::pow(d_src, power, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::pow(d_src, power, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::pow(src, power, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::pow(src, power, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Code, Core_CompareMat, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, ALL_CMP_CODES))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- int cmp_code = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const int cmp_code = GET_PARAM(2);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::compare(d_src1, d_src2, d_dst, cmp_code);\r
+ cv::gpu::compare(d_src1, d_src2, d_dst, cmp_code);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::compare(d_src1, d_src2, d_dst, cmp_code);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::compare(d_src1, d_src2, d_dst, cmp_code);\r
+ cv::Mat dst;\r
+\r
+ cv::compare(src1, src2, dst, cmp_code);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::compare(src1, src2, dst, cmp_code);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Code, Core_CompareScalar, Combine(GPU_TYPICAL_MAT_SIZES, ARITHM_MAT_DEPTH, ALL_CMP_CODES))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- int cmp_code = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const int cmp_code = GET_PARAM(2);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
cv::Scalar s = cv::Scalar::all(100);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::compare(d_src, s, d_dst, cmp_code);\r
+ cv::gpu::compare(d_src, s, d_dst, cmp_code);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::compare(d_src, s, d_dst, cmp_code);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::compare(d_src, s, d_dst, cmp_code);\r
+ cv::Mat dst;\r
+\r
+ cv::compare(src, s, dst, cmp_code);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::compare(src, s, dst, cmp_code);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_BitwiseNot, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::bitwise_not(d_src, d_dst);\r
+ cv::gpu::bitwise_not(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::bitwise_not(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::bitwise_not(d_src, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::bitwise_not(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::bitwise_not(src, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_BitwiseAndMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::bitwise_and(d_src1, d_src2, d_dst);\r
+ cv::gpu::bitwise_and(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::bitwise_and(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::bitwise_and(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::bitwise_and(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::bitwise_and(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseAndScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- int channels = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const int channels = GET_PARAM(2);\r
\r
- int type = CV_MAKE_TYPE(depth, channels);\r
+ const int type = CV_MAKE_TYPE(depth, channels);\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
cv::Scalar s = cv::Scalar::all(100);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::bitwise_and(d_src, s, d_dst);\r
+ cv::gpu::bitwise_and(d_src, s, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::bitwise_and(d_src, s, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::bitwise_and(d_src, s, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::bitwise_and(src, s, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::bitwise_and(src, s, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_BitwiseOrMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::bitwise_or(d_src1, d_src2, d_dst);\r
+ cv::gpu::bitwise_or(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::bitwise_or(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::bitwise_or(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::bitwise_or(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::bitwise_or(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseOrScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- int channels = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const int channels = GET_PARAM(2);\r
\r
- int type = CV_MAKE_TYPE(depth, channels);\r
+ const int type = CV_MAKE_TYPE(depth, channels);\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
cv::Scalar s = cv::Scalar::all(100);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::bitwise_or(d_src, s, d_dst);\r
+ cv::gpu::bitwise_or(d_src, s, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::bitwise_or(d_src, s, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::bitwise_or(d_src, s, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::bitwise_or(src, s, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::bitwise_or(src, s, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_BitwiseXorMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::bitwise_xor(d_src1, d_src2, d_dst);\r
+ cv::gpu::bitwise_xor(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::bitwise_xor(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::bitwise_xor(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::bitwise_xor(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::bitwise_xor(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Cn, Core_BitwiseXorScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- int channels = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const int channels = GET_PARAM(2);\r
\r
- int type = CV_MAKE_TYPE(depth, channels);\r
+ const int type = CV_MAKE_TYPE(depth, channels);\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
cv::Scalar s = cv::Scalar::all(100);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::bitwise_xor(d_src, s, d_dst);\r
+ cv::gpu::bitwise_xor(d_src, s, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::bitwise_xor(d_src, s, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::bitwise_xor(d_src, s, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::bitwise_xor(src, s, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::bitwise_xor(src, s, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Cn, Core_RShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- int channels = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const int channels = GET_PARAM(2);\r
\r
- int type = CV_MAKE_TYPE(depth, channels);\r
+ const int type = CV_MAKE_TYPE(depth, channels);\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::Scalar_<int> val = cv::Scalar_<int>::all(4);\r
+ const cv::Scalar_<int> val = cv::Scalar_<int>::all(4);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::rshift(d_src, val, d_dst);\r
+ cv::gpu::rshift(d_src, val, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::rshift(d_src, val, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::rshift(d_src, val, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth_Cn, Core_LShift, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32S), Values(1, 3, 4)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
- int channels = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
+ const int channels = GET_PARAM(2);\r
\r
- int type = CV_MAKE_TYPE(depth, channels);\r
+ const int type = CV_MAKE_TYPE(depth, channels);\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::Scalar_<int> val = cv::Scalar_<int>::all(4);\r
+ const cv::Scalar_<int> val = cv::Scalar_<int>::all(4);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::lshift(d_src, val, d_dst);\r
+ cv::gpu::lshift(d_src, val, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::lshift(d_src, val, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::lshift(d_src, val, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_MinMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::min(d_src1, d_src2, d_dst);\r
+ cv::gpu::min(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::min(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::min(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::min(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::min(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_MinScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
- double val = 50.0;\r
+ const double val = 50.0;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::min(d_src, val, d_dst);\r
+ cv::gpu::min(d_src, val, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::min(d_src, val, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::min(d_src, val, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::min(src, val, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::min(src, val, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_MaxMat, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src1(size, depth);\r
fillRandom(src1);\r
cv::Mat src2(size, depth);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::max(d_src1, d_src2, d_dst);\r
+ cv::gpu::max(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::max(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::max(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::max(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::max(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Depth, Core_MaxScalar, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth = GET_PARAM(1);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth = GET_PARAM(1);\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
- double val = 50.0;\r
+ const double val = 50.0;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::max(d_src, val, d_dst);\r
+ cv::gpu::max(d_src, val, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::max(d_src, val, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::max(d_src, val, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::max(src, val, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::max(src, val, dst);\r
+ }\r
}\r
}\r
\r
Values(CV_8U, CV_16U, CV_32F, CV_64F),\r
Values(CV_8U, CV_16U, CV_32F, CV_64F)))\r
{\r
- cv::Size size = GET_PARAM(0);\r
- int depth1 = GET_PARAM(1);\r
- int depth2 = GET_PARAM(2);\r
- int dst_depth = GET_PARAM(3);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int depth1 = GET_PARAM(1);\r
+ const int depth2 = GET_PARAM(2);\r
+ const int dst_depth = GET_PARAM(3);\r
\r
cv::Mat src1(size, depth1);\r
fillRandom(src1);\r
cv::Mat src2(size, depth2);\r
fillRandom(src2);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::addWeighted(d_src1, 0.5, d_src2, 0.5, 10.0, d_dst, dst_depth);\r
+ cv::gpu::addWeighted(d_src1, 0.5, d_src2, 0.5, 10.0, d_dst, dst_depth);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::addWeighted(d_src1, 0.5, d_src2, 0.5, 10.0, d_dst, dst_depth);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::addWeighted(d_src1, 0.5, d_src2, 0.5, 10.0, d_dst, dst_depth);\r
+ cv::Mat dst;\r
+\r
+ cv::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);\r
+ }\r
}\r
}\r
\r
{\r
declare.time(5.0);\r
\r
- cv::Size size = GET_PARAM(0);\r
- int type = GET_PARAM(1);\r
- int flags = GET_PARAM(2);\r
+ const cv::Size size = GET_PARAM(0);\r
+ const int type = GET_PARAM(1);\r
+ const int flags = GET_PARAM(2);\r
\r
cv::Mat src1(size, type);\r
fillRandom(src1);\r
cv::Mat src3(size, type);\r
fillRandom(src3);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_src3(src3);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_src3(src3);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst, flags);\r
+ cv::gpu::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst, flags);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst, flags);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::gemm(d_src1, d_src2, 1.0, d_src3, 1.0, d_dst, flags);\r
+ cv::Mat dst;\r
+\r
+ cv::gemm(src1, src2, 1.0, src3, 1.0, dst, flags);\r
+\r
+ declare.time(50.0);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gemm(src1, src2, 1.0, src3, 1.0, dst, flags);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::transpose(d_src, d_dst);\r
+ cv::gpu::transpose(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::transpose(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::transpose(d_src, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::transpose(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::transpose(src, dst);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::flip(d_src, d_dst, flipCode);\r
+ cv::gpu::flip(d_src, d_dst, flipCode);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::flip(d_src, d_dst, flipCode);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::flip(d_src, d_dst, flipCode);\r
+ cv::Mat dst;\r
+\r
+ cv::flip(src, dst, flipCode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::flip(src, dst, flipCode);\r
+ }\r
}\r
}\r
\r
cv::Mat lut(1, 256, CV_8UC1);\r
fillRandom(lut);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::LUT(d_src, lut, d_dst);\r
+ cv::gpu::LUT(d_src, lut, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::LUT(d_src, lut, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::LUT(d_src, lut, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::LUT(src, lut, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::LUT(src, lut, dst);\r
+ }\r
}\r
}\r
\r
cv::Mat lut(1, 256, CV_MAKE_TYPE(CV_8U, src.channels()));\r
fillRandom(lut);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::LUT(d_src, lut, d_dst);\r
+ cv::gpu::LUT(d_src, lut, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::LUT(d_src, lut, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::LUT(d_src, lut, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::LUT(src, lut, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::LUT(src, lut, dst);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, CV_32FC2);\r
fillRandom(src, -100.0, 100.0);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::magnitude(d_src, d_dst);\r
+ cv::gpu::magnitude(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::magnitude(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::magnitude(d_src, d_dst);\r
+ cv::Mat xy[2];\r
+ cv::split(src, xy);\r
+\r
+ cv::Mat dst;\r
+\r
+ cv::magnitude(xy[0], xy[1], dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::magnitude(xy[0], xy[1], dst);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, CV_32FC2);\r
fillRandom(src, -100.0, 100.0);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::magnitudeSqr(d_src, d_dst);\r
+ cv::gpu::magnitudeSqr(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::magnitudeSqr(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::magnitudeSqr(d_src, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat src2(size, CV_32FC1);\r
fillRandom(src2, -100.0, 100.0);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::magnitude(d_src1, d_src2, d_dst);\r
+ cv::gpu::magnitude(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::magnitude(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::magnitude(d_src1, d_src2, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::magnitude(src1, src2, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::magnitude(src1, src2, dst);\r
+ }\r
}\r
}\r
\r
cv::Mat src2(size, CV_32FC1);\r
fillRandom(src2, -100.0, 100.0);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::magnitudeSqr(d_src1, d_src2, d_dst);\r
+ cv::gpu::magnitudeSqr(d_src1, d_src2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::magnitudeSqr(d_src1, d_src2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::magnitudeSqr(d_src1, d_src2, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat src2(size, CV_32FC1);\r
fillRandom(src2, -100.0, 100.0);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::phase(d_src1, d_src2, d_dst, angleInDegrees);\r
+ cv::gpu::phase(d_src1, d_src2, d_dst, angleInDegrees);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::phase(d_src1, d_src2, d_dst, angleInDegrees);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::phase(d_src1, d_src2, d_dst, angleInDegrees);\r
+ cv::Mat dst;\r
+\r
+ cv::phase(src1, src2, dst, angleInDegrees);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::phase(src1, src2, dst, angleInDegrees);\r
+ }\r
}\r
}\r
\r
cv::Mat src2(size, CV_32FC1);\r
fillRandom(src2, -100.0, 100.0);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_magnitude;\r
- cv::gpu::GpuMat d_angle;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_magnitude;\r
+ cv::gpu::GpuMat d_angle;\r
\r
- cv::gpu::cartToPolar(d_src1, d_src2, d_magnitude, d_angle, angleInDegrees);\r
+ cv::gpu::cartToPolar(d_src1, d_src2, d_magnitude, d_angle, angleInDegrees);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::cartToPolar(d_src1, d_src2, d_magnitude, d_angle, angleInDegrees);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::cartToPolar(d_src1, d_src2, d_magnitude, d_angle, angleInDegrees);\r
+ cv::Mat magnitude;\r
+ cv::Mat angle;\r
+\r
+ cv::cartToPolar(src1, src2, magnitude, angle, angleInDegrees);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::cartToPolar(src1, src2, magnitude, angle, angleInDegrees);\r
+ }\r
}\r
}\r
\r
cv::Mat angle(size, CV_32FC1);\r
fillRandom(angle, 0.0, angleInDegrees ? 360.0 : 2 * CV_PI);\r
\r
- cv::gpu::GpuMat d_magnitude(magnitude);\r
- cv::gpu::GpuMat d_angle(angle);\r
- cv::gpu::GpuMat d_x;\r
- cv::gpu::GpuMat d_y;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_magnitude(magnitude);\r
+ cv::gpu::GpuMat d_angle(angle);\r
+ cv::gpu::GpuMat d_x;\r
+ cv::gpu::GpuMat d_y;\r
\r
- cv::gpu::polarToCart(d_magnitude, d_angle, d_x, d_y, angleInDegrees);\r
+ cv::gpu::polarToCart(d_magnitude, d_angle, d_x, d_y, angleInDegrees);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::polarToCart(d_magnitude, d_angle, d_x, d_y, angleInDegrees);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::polarToCart(d_magnitude, d_angle, d_x, d_y, angleInDegrees);\r
+ cv::Mat x;\r
+ cv::Mat y;\r
+\r
+ cv::polarToCart(magnitude, angle, x, y, angleInDegrees);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::polarToCart(magnitude, angle, x, y, angleInDegrees);\r
+ }\r
}\r
}\r
\r
cv::Scalar mean;\r
cv::Scalar stddev;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::meanStdDev(d_src, mean, stddev, d_buf);\r
+ cv::gpu::meanStdDev(d_src, mean, stddev, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::meanStdDev(d_src, mean, stddev, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::meanStdDev(d_src, mean, stddev, d_buf);\r
+ cv::meanStdDev(src, mean, stddev);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::meanStdDev(src, mean, stddev);\r
+ }\r
}\r
}\r
\r
\r
double dst;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_buf;\r
\r
- dst = cv::gpu::norm(d_src, normType, d_buf);\r
+ dst = cv::gpu::norm(d_src, normType, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::gpu::norm(d_src, normType, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- dst = cv::gpu::norm(d_src, normType, d_buf);\r
+ dst = cv::norm(src, normType);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::norm(src, normType);\r
+ }\r
}\r
}\r
\r
\r
double dst;\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
\r
- dst = cv::gpu::norm(d_src1, d_src2, normType);\r
+ dst = cv::gpu::norm(d_src1, d_src2, normType);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::gpu::norm(d_src1, d_src2, normType);\r
+ }\r
+ }\r
+ else\r
{\r
- dst = cv::gpu::norm(d_src1, d_src2, normType);\r
+ dst = cv::norm(src1, src2, normType);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::norm(src1, src2, normType);\r
+ }\r
}\r
}\r
\r
\r
cv::Scalar dst;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_buf;\r
\r
- dst = cv::gpu::sum(d_src, d_buf);\r
+ dst = cv::gpu::sum(d_src, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::gpu::sum(d_src, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- dst = cv::gpu::sum(d_src, d_buf);\r
+ dst = cv::sum(src);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::sum(src);\r
+ }\r
}\r
}\r
\r
\r
cv::Scalar dst;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_buf;\r
\r
- dst = cv::gpu::absSum(d_src, d_buf);\r
+ dst = cv::gpu::absSum(d_src, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::gpu::absSum(d_src, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- dst = cv::gpu::absSum(d_src, d_buf);\r
+ FAIL();\r
}\r
}\r
\r
\r
cv::Scalar dst;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_buf;\r
\r
- dst = cv::gpu::sqrSum(d_src, d_buf);\r
+ dst = cv::gpu::sqrSum(d_src, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::gpu::sqrSum(d_src, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- dst = cv::gpu::sqrSum(d_src, d_buf);\r
+ FAIL();\r
}\r
}\r
\r
\r
double minVal, maxVal;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::minMax(d_src, &minVal, &maxVal, cv::gpu::GpuMat(), d_buf);\r
+ cv::gpu::minMax(d_src, &minVal, &maxVal, cv::gpu::GpuMat(), d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::minMax(d_src, &minVal, &maxVal, cv::gpu::GpuMat(), d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::minMax(d_src, &minVal, &maxVal, cv::gpu::GpuMat(), d_buf);\r
+ FAIL();\r
}\r
}\r
\r
double minVal, maxVal;\r
cv::Point minLoc, maxLoc;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_valbuf, d_locbuf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_valbuf, d_locbuf;\r
\r
- cv::gpu::minMaxLoc(d_src, &minVal, &maxVal, &minLoc, &maxLoc, cv::gpu::GpuMat(), d_valbuf, d_locbuf);\r
+ cv::gpu::minMaxLoc(d_src, &minVal, &maxVal, &minLoc, &maxLoc, cv::gpu::GpuMat(), d_valbuf, d_locbuf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::minMaxLoc(d_src, &minVal, &maxVal, &minLoc, &maxLoc, cv::gpu::GpuMat(), d_valbuf, d_locbuf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::minMaxLoc(d_src, &minVal, &maxVal, &minLoc, &maxLoc, cv::gpu::GpuMat(), d_valbuf, d_locbuf);\r
+ cv::minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc);\r
+ }\r
}\r
}\r
\r
\r
int dst;\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_buf;\r
\r
- dst = cv::gpu::countNonZero(d_src, d_buf);\r
+ dst = cv::gpu::countNonZero(d_src, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::gpu::countNonZero(d_src, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- dst = cv::gpu::countNonZero(d_src, d_buf);\r
+ dst = cv::countNonZero(src);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ dst = cv::countNonZero(src);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::reduce(d_src, d_dst, dim, reduceOp);\r
+ cv::gpu::reduce(d_src, d_dst, dim, reduceOp);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::reduce(d_src, d_dst, dim, reduceOp);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::reduce(d_src, d_dst, dim, reduceOp);\r
+ cv::Mat dst;\r
+\r
+ cv::reduce(src, dst, dim, reduceOp);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::reduce(src, dst, dim, reduceOp);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Image, Features2D_SURF, Values<string>("gpu/perf/aloe.jpg"))\r
{\r
- declare.time(2.0);\r
+ declare.time(50.0);\r
\r
cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(img.empty());\r
\r
- cv::gpu::SURF_GPU d_surf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::SURF_GPU d_surf;\r
\r
- cv::gpu::GpuMat d_img(img);\r
- cv::gpu::GpuMat d_keypoints, d_descriptors;\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_keypoints, d_descriptors;\r
\r
- d_surf(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors);\r
+ d_surf(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_surf(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors);\r
+ }\r
+ }\r
+ else\r
{\r
- d_surf(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors);\r
+ cv::SURF surf;\r
+\r
+ std::vector<cv::KeyPoint> keypoints;\r
+ cv::Mat descriptors;\r
+\r
+ surf(img, cv::noArray(), keypoints, descriptors);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ keypoints.clear();\r
+ surf(img, cv::noArray(), keypoints, descriptors);\r
+ }\r
}\r
}\r
\r
cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(img.empty());\r
\r
- cv::gpu::FAST_GPU d_fast(20);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::FAST_GPU d_fast(20);\r
\r
- cv::gpu::GpuMat d_img(img);\r
- cv::gpu::GpuMat d_keypoints;\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_keypoints;\r
\r
- d_fast(d_img, cv::gpu::GpuMat(), d_keypoints);\r
+ d_fast(d_img, cv::gpu::GpuMat(), d_keypoints);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_fast(d_img, cv::gpu::GpuMat(), d_keypoints);\r
+ }\r
+ }\r
+ else\r
{\r
- d_fast(d_img, cv::gpu::GpuMat(), d_keypoints);\r
+ std::vector<cv::KeyPoint> keypoints;\r
+\r
+ cv::FAST(img, keypoints, 20);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ keypoints.clear();\r
+ cv::FAST(img, keypoints, 20);\r
+ }\r
}\r
}\r
\r
cv::Mat img = readImage(GetParam(), cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(img.empty());\r
\r
- cv::gpu::ORB_GPU d_orb(4000);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::ORB_GPU d_orb(4000);\r
\r
- cv::gpu::GpuMat d_img(img);\r
- cv::gpu::GpuMat d_keypoints, d_descriptors;\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_keypoints, d_descriptors;\r
\r
- d_orb(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors);\r
+ d_orb(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_orb(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors);\r
+ }\r
+ }\r
+ else\r
{\r
- d_orb(d_img, cv::gpu::GpuMat(), d_keypoints, d_descriptors);\r
+ cv::ORB orb(4000);\r
+\r
+ std::vector<cv::KeyPoint> keypoints;\r
+ cv::Mat descriptors;\r
+\r
+ orb(img, cv::noArray(), keypoints, descriptors);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ keypoints.clear();\r
+ orb(img, cv::noArray(), keypoints, descriptors);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(DescSize_Norm, Features2D_BFMatch, Combine(Values(64, 128, 256), Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))))\r
{\r
- declare.time(3.0);\r
+ declare.time(20.0);\r
\r
int desc_size = GET_PARAM(0);\r
int normType = GET_PARAM(1);\r
cv::Mat train(3000, desc_size, type);\r
fillRandom(train);\r
\r
- cv::gpu::BFMatcher_GPU d_matcher(normType);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::BFMatcher_GPU d_matcher(normType);\r
\r
- cv::gpu::GpuMat d_query(query);\r
- cv::gpu::GpuMat d_train(train);\r
- cv::gpu::GpuMat d_trainIdx, d_distance;\r
+ cv::gpu::GpuMat d_query(query);\r
+ cv::gpu::GpuMat d_train(train);\r
+ cv::gpu::GpuMat d_trainIdx, d_distance;\r
\r
- d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance);\r
+ d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance);\r
+ }\r
+ }\r
+ else\r
{\r
- d_matcher.matchSingle(d_query, d_train, d_trainIdx, d_distance);\r
+ cv::BFMatcher matcher(normType);\r
+\r
+ std::vector<cv::DMatch> matches;\r
+\r
+ matcher.match(query, train, matches);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ matcher.match(query, train, matches);\r
+ }\r
}\r
}\r
\r
Values(2, 3),\r
Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))))\r
{\r
- declare.time(3.0);\r
+ declare.time(30.0);\r
\r
int desc_size = GET_PARAM(0);\r
int k = GET_PARAM(1);\r
cv::Mat train(3000, desc_size, type);\r
fillRandom(train);\r
\r
- cv::gpu::BFMatcher_GPU d_matcher(normType);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::BFMatcher_GPU d_matcher(normType);\r
\r
- cv::gpu::GpuMat d_query(query);\r
- cv::gpu::GpuMat d_train(train);\r
- cv::gpu::GpuMat d_trainIdx, d_distance, d_allDist;\r
+ cv::gpu::GpuMat d_query(query);\r
+ cv::gpu::GpuMat d_train(train);\r
+ cv::gpu::GpuMat d_trainIdx, d_distance, d_allDist;\r
\r
- d_matcher.knnMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_allDist, k);\r
+ d_matcher.knnMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_allDist, k);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_matcher.knnMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_allDist, k);\r
+ }\r
+ }\r
+ else\r
{\r
- d_matcher.knnMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_allDist, k);\r
+ cv::BFMatcher matcher(normType);\r
+\r
+ std::vector< std::vector<cv::DMatch> > matches;\r
+\r
+ matcher.knnMatch(query, train, matches, k);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ matcher.knnMatch(query, train, matches, k);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(DescSize_Norm, Features2D_BFRadiusMatch, Combine(Values(64, 128, 256), Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))))\r
{\r
- declare.time(3.0);\r
+ declare.time(30.0);\r
\r
int desc_size = GET_PARAM(0);\r
int normType = GET_PARAM(1);\r
cv::Mat train(3000, desc_size, type);\r
fillRandom(train, 0.0, 1.0);\r
\r
- cv::gpu::BFMatcher_GPU d_matcher(normType);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::BFMatcher_GPU d_matcher(normType);\r
\r
- cv::gpu::GpuMat d_query(query);\r
- cv::gpu::GpuMat d_train(train);\r
- cv::gpu::GpuMat d_trainIdx, d_nMatches, d_distance;\r
+ cv::gpu::GpuMat d_query(query);\r
+ cv::gpu::GpuMat d_train(train);\r
+ cv::gpu::GpuMat d_trainIdx, d_nMatches, d_distance;\r
\r
- d_matcher.radiusMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_nMatches, 2.0);\r
+ d_matcher.radiusMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_nMatches, 2.0);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_matcher.radiusMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_nMatches, 2.0);\r
+ }\r
+ }\r
+ else\r
{\r
- d_matcher.radiusMatchSingle(d_query, d_train, d_trainIdx, d_distance, d_nMatches, 2.0);\r
+ cv::BFMatcher matcher(normType);\r
+\r
+ std::vector< std::vector<cv::DMatch> > matches;\r
+\r
+ matcher.radiusMatch(query, train, matches, 2.0);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ matcher.radiusMatch(query, train, matches, 2.0);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Type_KernelSz, Filters_Blur, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4), Values(3, 5, 7)))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
int ksize = GET_PARAM(2);\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::blur(d_src, d_dst, cv::Size(ksize, ksize));\r
+ cv::gpu::blur(d_src, d_dst, cv::Size(ksize, ksize));\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::blur(d_src, d_dst, cv::Size(ksize, ksize));\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::blur(d_src, d_dst, cv::Size(ksize, ksize));\r
+ cv::Mat dst;\r
+\r
+ cv::blur(src, dst, cv::Size(ksize, ksize));\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::blur(src, dst, cv::Size(ksize, ksize));\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Type_KernelSz, Filters_Sobel, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1), Values(3, 5, 7, 9, 11, 13, 15)))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
int ksize = GET_PARAM(2);\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::Sobel(d_src, d_dst, -1, 1, 1, d_buf, ksize);\r
+ cv::gpu::Sobel(d_src, d_dst, -1, 1, 1, d_buf, ksize);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::Sobel(d_src, d_dst, -1, 1, 1, d_buf, ksize);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::Sobel(d_src, d_dst, -1, 1, 1, d_buf, ksize);\r
+ cv::Mat dst;\r
+\r
+ cv::Sobel(src, dst, -1, 1, 1, ksize);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::Sobel(src, dst, -1, 1, 1, ksize);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Type, Filters_Scharr, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1)))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::Scharr(d_src, d_dst, -1, 1, 0, d_buf);\r
+ cv::gpu::Scharr(d_src, d_dst, -1, 1, 0, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::Scharr(d_src, d_dst, -1, 1, 0, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::Scharr(d_src, d_dst, -1, 1, 0, d_buf);\r
+ cv::Mat dst;\r
+\r
+ cv::Scharr(src, dst, -1, 1, 0);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::Scharr(src, dst, -1, 1, 0);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Type_KernelSz, Filters_GaussianBlur, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1), Values(3, 5, 7, 9, 11, 13, 15)))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
int ksize = GET_PARAM(2);\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::GaussianBlur(d_src, d_dst, cv::Size(ksize, ksize), d_buf, 0.5);\r
+ cv::gpu::GaussianBlur(d_src, d_dst, cv::Size(ksize, ksize), d_buf, 0.5);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::GaussianBlur(d_src, d_dst, cv::Size(ksize, ksize), d_buf, 0.5);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::GaussianBlur(d_src, d_dst, cv::Size(ksize, ksize), d_buf, 0.5);\r
+ cv::Mat dst;\r
+\r
+ cv::GaussianBlur(src, dst, cv::Size(ksize, ksize), 0.5);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::GaussianBlur(src, dst, cv::Size(ksize, ksize), 0.5);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Type_KernelSz, Filters_Laplacian, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4), Values(1, 3)))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
int ksize = GET_PARAM(2);\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::Laplacian(d_src, d_dst, -1, ksize);\r
+ cv::gpu::Laplacian(d_src, d_dst, -1, ksize);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::Laplacian(d_src, d_dst, -1, ksize);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::Laplacian(d_src, d_dst, -1, ksize);\r
+ cv::Mat dst;\r
+\r
+ cv::Laplacian(src, dst, -1, ksize);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::Laplacian(src, dst, -1, ksize);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Type, Filters_Erode, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4)))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
\r
\r
cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::erode(d_src, d_dst, ker, d_buf);\r
+ cv::gpu::erode(d_src, d_dst, ker, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::erode(d_src, d_dst, ker, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::erode(d_src, d_dst, ker, d_buf);\r
+ cv::Mat dst;\r
+\r
+ cv::erode(src, dst, ker);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::erode(src, dst, ker);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Type, Filters_Dilate, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4)))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
\r
\r
cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::dilate(d_src, d_dst, ker, d_buf);\r
+ cv::gpu::dilate(d_src, d_dst, ker, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::dilate(d_src, d_dst, ker, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::dilate(d_src, d_dst, ker, d_buf);\r
+ cv::Mat dst;\r
+\r
+ cv::dilate(src, dst, ker);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::dilate(src, dst, ker);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Type_Op, Filters_MorphologyEx, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4), ALL_MORPH_OPS))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
int morphOp = GET_PARAM(2);\r
\r
cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_buf1;\r
- cv::gpu::GpuMat d_buf2;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_buf1;\r
+ cv::gpu::GpuMat d_buf2;\r
\r
- cv::gpu::morphologyEx(d_src, d_dst, morphOp, ker, d_buf1, d_buf2);\r
+ cv::gpu::morphologyEx(d_src, d_dst, morphOp, ker, d_buf1, d_buf2);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::morphologyEx(d_src, d_dst, morphOp, ker, d_buf1, d_buf2);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::morphologyEx(d_src, d_dst, morphOp, ker, d_buf1, d_buf2);\r
+ cv::Mat dst;\r
+\r
+ cv::morphologyEx(src, dst, morphOp, ker);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::morphologyEx(src, dst, morphOp, ker);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_Type_KernelSz, Filters_Filter2D, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4), Values(3, 5, 7, 9, 11, 13, 15)))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
int ksize = GET_PARAM(2);\r
cv::Mat kernel(ksize, ksize, CV_32FC1);\r
fillRandom(kernel, 0.0, 1.0);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::filter2D(d_src, d_dst, -1, kernel);\r
+ cv::gpu::filter2D(d_src, d_dst, -1, kernel);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::filter2D(d_src, d_dst, -1, kernel);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::filter2D(d_src, d_dst, -1, kernel);\r
+ cv::Mat dst;\r
+\r
+ cv::filter2D(src, dst, -1, kernel);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::filter2D(src, dst, -1, kernel);\r
+ }\r
}\r
}\r
\r
ALL_BORDER_MODES,\r
ALL_REMAP_MODES))\r
{\r
- declare.time(3.0);\r
+ declare.time(20.0);\r
\r
cv::Size size = GET_PARAM(0);\r
int depth = GET_PARAM(1);\r
\r
generateMap(xmap, ymap, remapMode);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_xmap(xmap);\r
- cv::gpu::GpuMat d_ymap(ymap);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_xmap(xmap);\r
+ cv::gpu::GpuMat d_ymap(ymap);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);\r
+ cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);\r
+ cv::Mat dst;\r
+\r
+ cv::remap(src, dst, xmap, ymap, interpolation, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::remap(src, dst, xmap, ymap, interpolation, borderMode);\r
+ }\r
}\r
}\r
\r
ALL_INTERPOLATIONS,\r
Values(0.5, 0.3, 2.0)))\r
{\r
- declare.time(1.0);\r
+ declare.time(20.0);\r
\r
cv::Size size = GET_PARAM(0);\r
int depth = GET_PARAM(1);\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
+ cv::Mat dst;\r
+\r
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
+ cv::Mat dst;\r
+\r
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
+ }\r
}\r
}\r
\r
Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),\r
ALL_BORDER_MODES))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int depth = GET_PARAM(1);\r
int channels = GET_PARAM(2);\r
{std::sin(aplha), std::cos(aplha), 0}};\r
cv::Mat M(2, 3, CV_64F, (void*) mat);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);\r
+ cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);\r
+ cv::Mat dst;\r
+\r
+ cv::warpAffine(src, dst, M, size, interpolation, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::warpAffine(src, dst, M, size, interpolation, borderMode);\r
+ }\r
}\r
}\r
\r
Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),\r
ALL_BORDER_MODES))\r
{\r
+ declare.time(20.0);\r
+\r
cv::Size size = GET_PARAM(0);\r
int depth = GET_PARAM(1);\r
int channels = GET_PARAM(2);\r
{0.0, 0.0, 1.0}};\r
cv::Mat M(3, 3, CV_64F, (void*) mat);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);\r
+ cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);\r
+ cv::Mat dst;\r
+\r
+ cv::warpPerspective(src, dst, M, size, interpolation, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::warpPerspective(src, dst, M, size, interpolation, borderMode);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);\r
+ cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);\r
+ cv::Mat dst;\r
+\r
+ cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);\r
+ cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);\r
+ cv::Mat dst;\r
+\r
+ cv::threshold(src, dst, 100.0, 255.0, threshOp);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::threshold(src, dst, 100.0, 255.0, threshOp);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, CV_8UC1);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::integralBuffered(d_src, d_dst, d_buf);\r
+ cv::gpu::integralBuffered(d_src, d_dst, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::integralBuffered(d_src, d_dst, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::integralBuffered(d_src, d_dst, d_buf);\r
+ cv::Mat dst;\r
+\r
+ cv::integral(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::integral(src, dst);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, CV_8UC1);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::sqrIntegral(d_src, d_dst);\r
+ cv::gpu::sqrIntegral(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::sqrIntegral(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::sqrIntegral(d_src, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat src(size, depth);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_hist;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_hist;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);\r
+ cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);\r
+ int hbins = 30;\r
+ float hranges[] = {0.0f, 180.0f};\r
+ int histSize[] = {hbins};\r
+ const float* ranges[] = {hranges};\r
+ int channels[] = {0};\r
+\r
+ cv::Mat hist;\r
+\r
+ cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);\r
+ }\r
}\r
}\r
\r
int lowerLevel[] = {0, 0, 0, 0};\r
int upperLevel[] = {180, 180, 180, 180};\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_hist[4];\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_hist[4];\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel);\r
+ cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat src(size, CV_8UC1);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_hist;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_hist;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::calcHist(d_src, d_hist, d_buf);\r
+ cv::gpu::calcHist(d_src, d_hist, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::calcHist(d_src, d_hist, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::calcHist(d_src, d_hist, d_buf);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat src(size, CV_8UC1);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_hist;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_hist;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf);\r
+ cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf);\r
+ cv::Mat dst;\r
+\r
+ cv::equalizeHist(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::equalizeHist(src, dst);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, CV_32FC1);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::columnSum(d_src, d_dst);\r
+ cv::gpu::columnSum(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::columnSum(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::columnSum(d_src, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(image.empty());\r
\r
- cv::gpu::GpuMat d_image(image);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::CannyBuf d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_image(image);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::CannyBuf d_buf;\r
\r
- cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient);\r
+ cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient);\r
+ cv::Mat dst;\r
+\r
+ cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Image, ImgProc_MeanShiftFiltering, Values<string>("gpu/meanshift/cones.png"))\r
{\r
- declare.time(5.0);\r
+ declare.time(15.0);\r
\r
cv::Mat img = readImage(GetParam());\r
ASSERT_FALSE(img.empty());\r
cv::Mat rgba;\r
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);\r
\r
- cv::gpu::GpuMat d_src(rgba);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(rgba);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);\r
+ cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);\r
+ cv::Mat dst;\r
+\r
+ cv::pyrMeanShiftFiltering(img, dst, 50, 50);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::pyrMeanShiftFiltering(img, dst, 50, 50);\r
+ }\r
}\r
}\r
\r
cv::Mat rgba;\r
cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);\r
\r
- cv::gpu::GpuMat d_src(rgba);\r
- cv::gpu::GpuMat d_dstr;\r
- cv::gpu::GpuMat d_dstsp;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(rgba);\r
+ cv::gpu::GpuMat d_dstr;\r
+ cv::gpu::GpuMat d_dstsp;\r
\r
- cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);\r
+ cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);\r
+ FAIL();\r
}\r
}\r
\r
\r
cv::Mat dst;\r
\r
- cv::gpu::GpuMat d_src(rgba);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(rgba);\r
\r
- cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);\r
+ cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat img2(size, type);\r
fillRandom(img2);\r
\r
- cv::gpu::GpuMat d_img1(img1);\r
- cv::gpu::GpuMat d_img2(img2);\r
- cv::gpu::GpuMat d_weights1(size, CV_32FC1, cv::Scalar::all(0.5));\r
- cv::gpu::GpuMat d_weights2(size, CV_32FC1, cv::Scalar::all(0.5));\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_img1(img1);\r
+ cv::gpu::GpuMat d_img2(img2);\r
+ cv::gpu::GpuMat d_weights1(size, CV_32FC1, cv::Scalar::all(0.5));\r
+ cv::gpu::GpuMat d_weights2(size, CV_32FC1, cv::Scalar::all(0.5));\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst);\r
+ cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst);\r
+ FAIL();\r
}\r
}\r
\r
\r
PERF_TEST_P(Sz_KernelSz_Ccorr, ImgProc_Convolve, Combine(GPU_TYPICAL_MAT_SIZES, Values(17, 27, 32, 64), Bool()))\r
{\r
- declare.time(2.0);\r
+ declare.time(10.0);\r
\r
cv::Size size = GET_PARAM(0);\r
int templ_size = GET_PARAM(1);\r
bool ccorr = GET_PARAM(2);\r
\r
- cv::gpu::GpuMat d_image = cv::gpu::createContinuous(size, CV_32FC1);\r
- d_image.setTo(cv::Scalar(1.0));\r
+ cv::Mat image(size, CV_32FC1);\r
+ image.setTo(1.0);\r
\r
- cv::gpu::GpuMat d_templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1);\r
- d_templ.setTo(cv::Scalar(1.0));\r
+ cv::Mat templ(templ_size, templ_size, CV_32FC1);\r
+ templ.setTo(1.0);\r
\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::ConvolveBuf d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_image = cv::gpu::createContinuous(size, CV_32FC1);\r
+ d_image.upload(image);\r
\r
- cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf);\r
+ cv::gpu::GpuMat d_templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1);\r
+ d_templ.upload(templ);\r
+\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::ConvolveBuf d_buf;\r
\r
- TEST_CYCLE()\r
- {\r
cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ ASSERT_FALSE(ccorr);\r
+\r
+ cv::Mat dst;\r
+\r
+ cv::filter2D(image, dst, image.depth(), templ);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::filter2D(image, dst, image.depth(), templ);\r
+ }\r
}\r
}\r
\r
cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_8U, cn));\r
fillRandom(templ);\r
\r
- cv::gpu::GpuMat d_image(image);\r
- cv::gpu::GpuMat d_templ(templ);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_image(image);\r
+ cv::gpu::GpuMat d_templ(templ);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
+ cv::Mat dst;\r
+\r
+ cv::matchTemplate(image, templ, dst, method);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::matchTemplate(image, templ, dst, method);\r
+ }\r
}\r
};\r
\r
cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_32F, cn));\r
fillRandom(templ);\r
\r
- cv::gpu::GpuMat d_image(image);\r
- cv::gpu::GpuMat d_templ(templ);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_image(image);\r
+ cv::gpu::GpuMat d_templ(templ);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
+ cv::Mat dst;\r
+\r
+ cv::matchTemplate(image, templ, dst, method);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::matchTemplate(image, templ, dst, method);\r
+ }\r
}\r
};\r
\r
cv::Mat b(size, CV_32FC2);\r
fillRandom(b, 0, 100);\r
\r
- cv::gpu::GpuMat d_a(a);\r
- cv::gpu::GpuMat d_b(b);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_a(a);\r
+ cv::gpu::GpuMat d_b(b);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);\r
+ cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);\r
+ cv::Mat dst;\r
+\r
+ cv::mulSpectrums(a, b, dst, flag);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::mulSpectrums(a, b, dst, flag);\r
+ }\r
}\r
}\r
\r
cv::Mat src2(size, CV_32FC2);\r
fillRandom(src2, 0, 100);\r
\r
- cv::gpu::GpuMat d_src1(src1);\r
- cv::gpu::GpuMat d_src2(src2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);\r
+ cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);\r
+ FAIL();\r
}\r
}\r
\r
GPU_TYPICAL_MAT_SIZES,\r
Values(0, DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE))))\r
{\r
- declare.time(2.0);\r
+ declare.time(10.0);\r
\r
cv::Size size = GET_PARAM(0);\r
int flag = GET_PARAM(1);\r
cv::Mat src(size, CV_32FC2);\r
fillRandom(src, 0, 100);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::dft(d_src, d_dst, size, flag);\r
+ cv::gpu::dft(d_src, d_dst, size, flag);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::dft(d_src, d_dst, size, flag);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::dft(d_src, d_dst, size, flag);\r
+ cv::Mat dst;\r
+\r
+ cv::dft(src, dst, flag);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::dft(src, dst, flag);\r
+ }\r
}\r
}\r
\r
Values(3, 5, 7),\r
Values(0, 3, 5, 7)))\r
{\r
- double k = 0.5;\r
-\r
string fileName = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
int borderMode = GET_PARAM(2);\r
\r
cv::Mat img = readImage(fileName, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(img.empty());\r
-\r
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);\r
\r
- cv::gpu::GpuMat d_img(img);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_Dx;\r
- cv::gpu::GpuMat d_Dy;\r
- cv::gpu::GpuMat d_buf;\r
-\r
- cv::gpu::cornerHarris(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode);\r
+ double k = 0.5;\r
\r
- TEST_CYCLE()\r
+ if (runOnGpu)\r
{\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_Dx;\r
+ cv::gpu::GpuMat d_Dy;\r
+ cv::gpu::GpuMat d_buf;\r
+\r
cv::gpu::cornerHarris(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::cornerHarris(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ cv::Mat dst;\r
+\r
+ cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode);\r
+ }\r
}\r
}\r
\r
\r
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);\r
\r
- cv::gpu::GpuMat d_img(img);\r
- cv::gpu::GpuMat d_dst;\r
- cv::gpu::GpuMat d_Dx;\r
- cv::gpu::GpuMat d_Dy;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_Dx;\r
+ cv::gpu::GpuMat d_Dy;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode);\r
+ cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode);\r
+ cv::Mat dst;\r
+\r
+ cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode);\r
+ }\r
}\r
}\r
\r
cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);\r
cv::Mat T = cv::Mat::zeros(1, 3, CV_32F);\r
\r
- cv::gpu::GpuMat d_map_x;\r
- cv::gpu::GpuMat d_map_y;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_map_x;\r
+ cv::gpu::GpuMat d_map_y;\r
\r
- cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y);\r
+ cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);\r
cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);\r
\r
- cv::gpu::GpuMat d_map_x;\r
- cv::gpu::GpuMat d_map_y;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_map_x;\r
+ cv::gpu::GpuMat d_map_y;\r
\r
- cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
+ cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);\r
cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);\r
\r
- cv::gpu::GpuMat d_map_x;\r
- cv::gpu::GpuMat d_map_y;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_map_x;\r
+ cv::gpu::GpuMat d_map_y;\r
\r
- cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
+ cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);\r
+ cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::pyrDown(d_src, d_dst);\r
+ cv::gpu::pyrDown(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::pyrDown(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::pyrDown(d_src, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::pyrDown(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::pyrDown(src, dst);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::pyrUp(d_src, d_dst);\r
+ cv::gpu::pyrUp(d_src, d_dst);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::pyrUp(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::pyrUp(d_src, d_dst);\r
+ cv::Mat dst;\r
+\r
+ cv::pyrUp(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::pyrUp(src, dst);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, CV_MAKETYPE(depth, info.scn));\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);\r
+ cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);\r
+ cv::Mat dst;\r
+\r
+ cv::cvtColor(src, dst, info.code, info.dcn);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::cvtColor(src, dst, info.code, info.dcn);\r
+ }\r
}\r
}\r
\r
\r
const int dstOrder[] = {2, 1, 0, 3};\r
\r
- cv::gpu::GpuMat d_src(src);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
\r
- cv::gpu::swapChannels(d_src, dstOrder);\r
+ cv::gpu::swapChannels(d_src, dstOrder);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::swapChannels(d_src, dstOrder);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::swapChannels(d_src, dstOrder);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat img2(size, type);\r
fillRandom(img2);\r
\r
- cv::gpu::GpuMat d_img1(img1);\r
- cv::gpu::GpuMat d_img2(img2);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_img1(img1);\r
+ cv::gpu::GpuMat d_img2(img2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);\r
+ cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat src(size, type);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
\r
- cv::gpu::ImagePyramid d_pyr;\r
+ cv::gpu::ImagePyramid d_pyr;\r
\r
- d_pyr.build(d_src, 5);\r
+ d_pyr.build(d_src, 5);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_pyr.build(d_src, 5);\r
+ }\r
+ }\r
+ else\r
{\r
- d_pyr.build(d_src, 5);\r
+ FAIL();\r
}\r
}\r
\r
\r
cv::Size dstSize(size.width / 2 + 10, size.height / 2 + 10);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::ImagePyramid d_pyr(d_src, 3);\r
+ cv::gpu::ImagePyramid d_pyr(d_src, 3);\r
\r
- d_pyr.getLayer(d_dst, dstSize);\r
+ d_pyr.getLayer(d_dst, dstSize);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_pyr.getLayer(d_dst, dstSize);\r
+ }\r
+ }\r
+ else\r
{\r
- d_pyr.getLayer(d_dst, dstSize);\r
+ FAIL();\r
}\r
}\r
\r
cv::line(src, p1, p2, cv::Scalar::all(255), 2);\r
}\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_lines;\r
- cv::gpu::GpuMat d_accum;\r
- cv::gpu::GpuMat d_buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_lines;\r
+ cv::gpu::GpuMat d_accum;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::HoughLines(d_src, d_lines, d_accum, d_buf, rho, theta, threshold, doSort);\r
+ cv::gpu::HoughLines(d_src, d_lines, d_accum, d_buf, rho, theta, threshold, doSort);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::HoughLines(d_src, d_lines, d_accum, d_buf, rho, theta, threshold, doSort);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::HoughLines(d_src, d_lines, d_accum, d_buf, rho, theta, threshold, doSort);\r
+ std::vector<cv::Vec2f> lines;\r
+ cv::HoughLines(src, lines, rho, theta, threshold);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::HoughLines(src, lines, rho, theta, threshold);\r
+ }\r
}\r
}\r
\r
DEF_PARAM_TEST_1(Image, string);
-PERF_TEST_P(Image, Labeling_ConnectedComponents, Values<string>("gpu/labeling/aloe-disp.png"))
+struct GreedyLabeling
{
- cv::Mat image = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
+ struct dot
+ {
+ int x;
+ int y;
+
+ static dot make(int i, int j)
+ {
+ dot d; d.x = i; d.y = j;
+ return d;
+ }
+ };
+
+ struct InInterval
+ {
+ InInterval(const int& _lo, const int& _hi) : lo(-_lo), hi(_hi) {};
+ const int lo, hi;
+
+ bool operator() (const unsigned char a, const unsigned char b) const
+ {
+ int d = a - b;
+ return lo <= d && d <= hi;
+ }
+ };
+
+ GreedyLabeling(cv::Mat img)
+ : image(img), _labels(image.size(), CV_32SC1, cv::Scalar::all(-1)) {stack = new dot[image.cols * image.rows];}
+
+ ~GreedyLabeling(){delete[] stack;}
+
+ void operator() (cv::Mat labels) const
+ {
+ labels.setTo(cv::Scalar::all(-1));
+ InInterval inInt(0, 2);
+ int cc = -1;
+
+ int* dist_labels = (int*)labels.data;
+ int pitch = labels.step1();
+
+ unsigned char* source = (unsigned char*)image.data;
+ int width = image.cols;
+ int height = image.rows;
+
+ for (int j = 0; j < image.rows; ++j)
+ for (int i = 0; i < image.cols; ++i)
+ {
+ if (dist_labels[j * pitch + i] != -1) continue;
+
+ dot* top = stack;
+ dot p = dot::make(i, j);
+ cc++;
+
+ dist_labels[j * pitch + i] = cc;
+
+ while (top >= stack)
+ {
+ int* dl = &dist_labels[p.y * pitch + p.x];
+ unsigned char* sp = &source[p.y * image.step1() + p.x];
- // cv::threshold(image, image, 150, 255, CV_THRESH_BINARY);
+ dl[0] = cc;
- cv::gpu::GpuMat mask;
- mask.create(image.rows, image.cols, CV_8UC1);
+ //right
+ if( p.x < (width - 1) && dl[ +1] == -1 && inInt(sp[0], sp[+1]))
+ *top++ = dot::make(p.x + 1, p.y);
- cv::gpu::GpuMat components;
- components.create(image.rows, image.cols, CV_32SC1);
+ //left
+ if( p.x > 0 && dl[-1] == -1 && inInt(sp[0], sp[-1]))
+ *top++ = dot::make(p.x - 1, p.y);
- cv::gpu::connectivityMask(cv::gpu::GpuMat(image), mask, cv::Scalar::all(0), cv::Scalar::all(2));
+ //bottom
+ if( p.y < (height - 1) && dl[+pitch] == -1 && inInt(sp[0], sp[+image.step1()]))
+ *top++ = dot::make(p.x, p.y + 1);
- ASSERT_NO_THROW(cv::gpu::labelComponents(mask, components));
+ //top
+ if( p.y > 0 && dl[-pitch] == -1 && inInt(sp[0], sp[-image.step1()]))
+ *top++ = dot::make(p.x, p.y - 1);
+ p = *--top;
+ }
+ }
+ }
+
+ cv::Mat image;
+ cv::Mat _labels;
+ dot* stack;
+};
+
+PERF_TEST_P(Image, Labeling_ConnectedComponents, Values<string>("gpu/labeling/aloe-disp.png"))
+{
declare.time(1.0);
- TEST_CYCLE()
+ cv::Mat image = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
+
+ if (runOnGpu)
+ {
+ cv::gpu::GpuMat mask;
+ mask.create(image.rows, image.cols, CV_8UC1);
+
+ cv::gpu::GpuMat components;
+ components.create(image.rows, image.cols, CV_32SC1);
+
+ cv::gpu::connectivityMask(cv::gpu::GpuMat(image), mask, cv::Scalar::all(0), cv::Scalar::all(2));
+
+ ASSERT_NO_THROW(cv::gpu::labelComponents(mask, components));
+
+ TEST_CYCLE()
+ {
+ cv::gpu::labelComponents(mask, components);
+ }
+ }
+ else
{
- cv::gpu::labelComponents(mask, components);
+ GreedyLabeling host(image);
+
+ host(host._labels);
+
+ declare.time(1.0);
+
+ TEST_CYCLE()
+ {
+ host(host._labels);
+ }
}
}
\r
cv::Scalar val(1, 2, 3, 4);\r
\r
- cv::gpu::GpuMat d_src(size, type);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(size, type);\r
\r
- d_src.setTo(val);\r
+ d_src.setTo(val);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_src.setTo(val);\r
+ }\r
+ }\r
+ else\r
{\r
- d_src.setTo(val);\r
+ cv::Mat src(size, type);\r
+\r
+ src.setTo(val);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ src.setTo(val);\r
+ }\r
}\r
}\r
\r
\r
cv::Scalar val(1, 2, 3, 4);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_mask(mask);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_mask(mask);\r
\r
- d_src.setTo(val, d_mask);\r
+ d_src.setTo(val, d_mask);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_src.setTo(val, d_mask);\r
+ }\r
+ }\r
+ else\r
{\r
- d_src.setTo(val, d_mask);\r
+ src.setTo(val, mask);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ src.setTo(val, mask);\r
+ }\r
}\r
}\r
\r
cv::Mat mask(size, CV_8UC1);\r
fillRandom(mask, 0, 2);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_mask(mask);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_mask(mask);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- d_src.copyTo(d_dst, d_mask);\r
+ d_src.copyTo(d_dst, d_mask);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_src.copyTo(d_dst, d_mask);\r
+ }\r
+ }\r
+ else\r
{\r
- d_src.copyTo(d_dst, d_mask);\r
+ cv::Mat dst;\r
+\r
+ src.copyTo(dst, mask);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ src.copyTo(dst, mask);\r
+ }\r
}\r
}\r
\r
cv::Mat src(size, depth1);\r
fillRandom(src);\r
\r
- cv::gpu::GpuMat d_src(src);\r
- cv::gpu::GpuMat d_dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- d_src.convertTo(d_dst, depth2, 0.5, 1.0);\r
+ d_src.convertTo(d_dst, depth2, 0.5, 1.0);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_src.convertTo(d_dst, depth2, 0.5, 1.0);\r
+ }\r
+ }\r
+ else\r
{\r
- d_src.convertTo(d_dst, depth2, 0.5, 1.0);\r
+ cv::Mat dst;\r
+\r
+ src.convertTo(dst, depth2, 0.5, 1.0);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ src.convertTo(dst, depth2, 0.5, 1.0);\r
+ }\r
}\r
}\r
\r
\r
std::vector<cv::Rect> found_locations;\r
\r
- cv::gpu::GpuMat d_img(img);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_img(img);\r
\r
- cv::gpu::HOGDescriptor d_hog;\r
- d_hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());\r
+ cv::gpu::HOGDescriptor d_hog;\r
+ d_hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());\r
\r
- d_hog.detectMultiScale(d_img, found_locations);\r
+ d_hog.detectMultiScale(d_img, found_locations);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_hog.detectMultiScale(d_img, found_locations);\r
+ }\r
+ }\r
+ else\r
{\r
- d_hog.detectMultiScale(d_img, found_locations);\r
+ cv::HOGDescriptor hog;\r
+ hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());\r
+\r
+ hog.detectMultiScale(img, found_locations);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ hog.detectMultiScale(img, found_locations);\r
+ }\r
}\r
}\r
\r
cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(img.empty());\r
\r
- cv::gpu::CascadeClassifier_GPU d_cascade;\r
-\r
- ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second)));\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::CascadeClassifier_GPU d_cascade;\r
+ ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second)));\r
\r
- cv::gpu::GpuMat d_img(img);\r
- cv::gpu::GpuMat d_objects_buffer;\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_objects_buffer;\r
\r
- d_cascade.detectMultiScale(d_img, d_objects_buffer);\r
+ d_cascade.detectMultiScale(d_img, d_objects_buffer);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_cascade.detectMultiScale(d_img, d_objects_buffer);\r
+ }\r
+ }\r
+ else\r
{\r
- d_cascade.detectMultiScale(d_img, d_objects_buffer);\r
+ cv::CascadeClassifier cascade;\r
+ ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/perf/haarcascade_frontalface_alt.xml")));\r
+\r
+ std::vector<cv::Rect> rects;\r
+\r
+ cascade.detectMultiScale(img, rects);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cascade.detectMultiScale(img, rects);\r
+ }\r
}\r
}\r
\r
cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(img.empty());\r
\r
- cv::gpu::CascadeClassifier_GPU d_cascade;\r
-\r
- ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second)));\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::CascadeClassifier_GPU d_cascade;\r
+ ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second)));\r
\r
- cv::gpu::GpuMat d_img(img);\r
- cv::gpu::GpuMat d_gpu_rects;\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_gpu_rects;\r
\r
- d_cascade.detectMultiScale(d_img, d_gpu_rects);\r
+ d_cascade.detectMultiScale(d_img, d_gpu_rects);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_cascade.detectMultiScale(d_img, d_gpu_rects);\r
+ }\r
+ }\r
+ else\r
{\r
- d_cascade.detectMultiScale(d_img, d_gpu_rects);\r
+ cv::CascadeClassifier cascade;\r
+ ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/lbpcascade/lbpcascade_frontalface.xml")));\r
+\r
+ std::vector<cv::Rect> rects;\r
+\r
+ cascade.detectMultiScale(img, rects);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cascade.detectMultiScale(img, rects);\r
+ }\r
}\r
}\r
\r
using namespace std;\r
using namespace testing;\r
\r
+namespace cv\r
+{\r
+ template<> void Ptr<CvBGStatModel>::delete_obj()\r
+ {\r
+ cvReleaseBGStatModel(&obj);\r
+ }\r
+}\r
+\r
namespace {\r
\r
//////////////////////////////////////////////////////\r
frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0);\r
frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0);\r
\r
- cv::gpu::GpuMat d_frame0(frame0);\r
- cv::gpu::GpuMat d_frame1(frame1);\r
- cv::gpu::GpuMat d_u;\r
- cv::gpu::GpuMat d_v;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_frame0(frame0);\r
+ cv::gpu::GpuMat d_frame1(frame1);\r
+ cv::gpu::GpuMat d_u;\r
+ cv::gpu::GpuMat d_v;\r
\r
- cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,\r
- 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);\r
+ cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,\r
+ 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);\r
\r
- d_flow(d_frame0, d_frame1, d_u, d_v);\r
+ d_flow(d_frame0, d_frame1, d_u, d_v);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_flow(d_frame0, d_frame1, d_u, d_v);\r
+ }\r
+ }\r
+ else\r
{\r
- d_flow(d_frame0, d_frame1, d_u, d_v);\r
+ FAIL();\r
}\r
}\r
\r
frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0);\r
frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0);\r
\r
- cv::gpu::GpuMat d_frame0(frame0);\r
- cv::gpu::GpuMat d_frame1(frame1);\r
- cv::gpu::GpuMat d_fu, d_fv;\r
- cv::gpu::GpuMat d_bu, d_bv;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_frame0(frame0);\r
+ cv::gpu::GpuMat d_frame1(frame1);\r
+ cv::gpu::GpuMat d_fu, d_fv;\r
+ cv::gpu::GpuMat d_bu, d_bv;\r
\r
- cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,\r
- 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);\r
+ cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,\r
+ 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);\r
\r
- d_flow(d_frame0, d_frame1, d_fu, d_fv);\r
- d_flow(d_frame1, d_frame0, d_bu, d_bv);\r
+ d_flow(d_frame0, d_frame1, d_fu, d_fv);\r
+ d_flow(d_frame1, d_frame0, d_bu, d_bv);\r
\r
- cv::gpu::GpuMat d_newFrame;\r
- cv::gpu::GpuMat d_buf;\r
+ cv::gpu::GpuMat d_newFrame;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::interpolateFrames(d_frame0, d_frame1, d_fu, d_fv, d_bu, d_bv, 0.5f, d_newFrame, d_buf);\r
+ cv::gpu::interpolateFrames(d_frame0, d_frame1, d_fu, d_fv, d_bu, d_bv, 0.5f, d_newFrame, d_buf);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\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
+ else\r
{\r
- cv::gpu::interpolateFrames(d_frame0, d_frame1, d_fu, d_fv, d_bu, d_bv, 0.5f, d_newFrame, d_buf);\r
+ FAIL();\r
}\r
}\r
\r
frame0.convertTo(frame0, CV_32FC1, 1.0 / 255.0);\r
frame1.convertTo(frame1, CV_32FC1, 1.0 / 255.0);\r
\r
- cv::gpu::GpuMat d_frame0(frame0);\r
- cv::gpu::GpuMat d_frame1(frame1);\r
- cv::gpu::GpuMat d_u;\r
- cv::gpu::GpuMat d_v;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_frame0(frame0);\r
+ cv::gpu::GpuMat d_frame1(frame1);\r
+ cv::gpu::GpuMat d_u;\r
+ cv::gpu::GpuMat d_v;\r
\r
- cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,\r
- 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);\r
+ cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,\r
+ 10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);\r
\r
- d_flow(d_frame0, d_frame1, d_u, d_v);\r
+ d_flow(d_frame0, d_frame1, d_u, d_v);\r
\r
- cv::gpu::GpuMat d_vertex, d_colors;\r
+ cv::gpu::GpuMat d_vertex, d_colors;\r
\r
- cv::gpu::createOpticalFlowNeedleMap(d_u, d_v, d_vertex, d_colors);\r
+ cv::gpu::createOpticalFlowNeedleMap(d_u, d_v, d_vertex, d_colors);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::createOpticalFlowNeedleMap(d_u, d_v, d_vertex, d_colors);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::createOpticalFlowNeedleMap(d_u, d_v, d_vertex, d_colors);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(image.empty());\r
\r
- cv::gpu::GoodFeaturesToTrackDetector_GPU d_detector(8000, 0.01, minDistance);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GoodFeaturesToTrackDetector_GPU d_detector(8000, 0.01, minDistance);\r
\r
- cv::gpu::GpuMat d_image(image);\r
- cv::gpu::GpuMat d_pts;\r
+ cv::gpu::GpuMat d_image(image);\r
+ cv::gpu::GpuMat d_pts;\r
\r
- d_detector(d_image, d_pts);\r
+ d_detector(d_image, d_pts);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_detector(d_image, d_pts);\r
+ }\r
+ }\r
+ else\r
{\r
- d_detector(d_image, d_pts);\r
+ cv::Mat pts;\r
+\r
+ cv::goodFeaturesToTrack(image, pts, 8000, 0.01, minDistance);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::goodFeaturesToTrack(image, pts, 8000, 0.01, minDistance);\r
+ }\r
}\r
}\r
\r
Values(1, 2, 3),\r
Values(1, 10, 30)))\r
{\r
+ declare.time(20.0);\r
+\r
pair_string imagePair = GET_PARAM(0);\r
bool useGray = GET_PARAM(1);\r
int points = GET_PARAM(2);\r
else\r
cv::cvtColor(frame0, gray_frame, cv::COLOR_BGR2GRAY);\r
\r
- cv::gpu::GpuMat d_pts;\r
+ cv::Mat pts;\r
+ cv::goodFeaturesToTrack(gray_frame, pts, points, 0.01, 0.0);\r
\r
- cv::gpu::GoodFeaturesToTrackDetector_GPU d_detector(points, 0.01, 0.0);\r
- d_detector(cv::gpu::GpuMat(gray_frame), d_pts);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_pts(pts);\r
\r
- cv::gpu::PyrLKOpticalFlow d_pyrLK;\r
- d_pyrLK.winSize = cv::Size(winSize, winSize);\r
- d_pyrLK.maxLevel = levels - 1;\r
- d_pyrLK.iters = iters;\r
+ cv::gpu::PyrLKOpticalFlow d_pyrLK;\r
+ d_pyrLK.winSize = cv::Size(winSize, winSize);\r
+ d_pyrLK.maxLevel = levels - 1;\r
+ d_pyrLK.iters = iters;\r
\r
- cv::gpu::GpuMat d_frame0(frame0);\r
- cv::gpu::GpuMat d_frame1(frame1);\r
- cv::gpu::GpuMat d_nextPts;\r
- cv::gpu::GpuMat d_status;\r
+ cv::gpu::GpuMat d_frame0(frame0);\r
+ cv::gpu::GpuMat d_frame1(frame1);\r
+ cv::gpu::GpuMat d_nextPts;\r
+ cv::gpu::GpuMat d_status;\r
\r
- d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status);\r
+ d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status);\r
+ }\r
+ }\r
+ else\r
{\r
- d_pyrLK.sparse(d_frame0, d_frame1, d_pts, d_nextPts, d_status);\r
+ cv::Mat nextPts;\r
+ cv::Mat status;\r
+\r
+ cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, cv::noArray(),\r
+ cv::Size(winSize, winSize), levels - 1,\r
+ cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, iters, 0.01));\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, cv::noArray(),\r
+ cv::Size(winSize, winSize), levels - 1,\r
+ cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, iters, 0.01));\r
+ }\r
}\r
}\r
\r
cv::Mat frame1 = readImage(imagePair.second, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(frame1.empty());\r
\r
- cv::gpu::GpuMat d_frame0(frame0);\r
- cv::gpu::GpuMat d_frame1(frame1);\r
- cv::gpu::GpuMat d_u;\r
- cv::gpu::GpuMat d_v;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_frame0(frame0);\r
+ cv::gpu::GpuMat d_frame1(frame1);\r
+ cv::gpu::GpuMat d_u;\r
+ cv::gpu::GpuMat d_v;\r
\r
- cv::gpu::PyrLKOpticalFlow d_pyrLK;\r
- d_pyrLK.winSize = cv::Size(winSize, winSize);\r
- d_pyrLK.maxLevel = levels - 1;\r
- d_pyrLK.iters = iters;\r
+ cv::gpu::PyrLKOpticalFlow d_pyrLK;\r
+ d_pyrLK.winSize = cv::Size(winSize, winSize);\r
+ d_pyrLK.maxLevel = levels - 1;\r
+ d_pyrLK.iters = iters;\r
\r
- d_pyrLK.dense(d_frame0, d_frame1, d_u, d_v);\r
+ d_pyrLK.dense(d_frame0, d_frame1, d_u, d_v);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_pyrLK.dense(d_frame0, d_frame1, d_u, d_v);\r
+ }\r
+ }\r
+ else\r
{\r
- d_pyrLK.dense(d_frame0, d_frame1, d_u, d_v);\r
+ FAIL();\r
}\r
}\r
\r
cv::Mat frame1 = readImage(GetParam().second, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(frame1.empty());\r
\r
- cv::gpu::GpuMat d_frame0(frame0);\r
- cv::gpu::GpuMat d_frame1(frame1);\r
- cv::gpu::GpuMat d_u;\r
- cv::gpu::GpuMat d_v;\r
+ int numLevels = 5;\r
+ double pyrScale = 0.5;\r
+ int winSize = 13;\r
+ int numIters = 10;\r
+ int polyN = 5;\r
+ double polySigma = 1.1;\r
+ int flags = 0;\r
\r
- cv::gpu::FarnebackOpticalFlow d_farneback;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_frame0(frame0);\r
+ cv::gpu::GpuMat d_frame1(frame1);\r
+ cv::gpu::GpuMat d_u;\r
+ cv::gpu::GpuMat d_v;\r
+\r
+ cv::gpu::FarnebackOpticalFlow d_farneback;\r
+ d_farneback.numLevels = numLevels;\r
+ d_farneback.pyrScale = pyrScale;\r
+ d_farneback.winSize = winSize;\r
+ d_farneback.numIters = numIters;\r
+ d_farneback.polyN = polyN;\r
+ d_farneback.polySigma = polySigma;\r
+ d_farneback.flags = flags;\r
\r
- d_farneback(d_frame0, d_frame1, d_u, d_v);\r
+ d_farneback(d_frame0, d_frame1, d_u, d_v);\r
\r
- TEST_CYCLE()\r
+ TEST_CYCLE()\r
+ {\r
+ d_farneback(d_frame0, d_frame1, d_u, d_v);\r
+ }\r
+ }\r
+ else\r
{\r
- d_farneback(d_frame0, d_frame1, d_u, d_v);\r
+ cv::Mat flow;\r
+\r
+ cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags);\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Video, Video_FGDStatModel, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"))\r
{\r
- declare.time(10);\r
+ declare.time(60);\r
\r
string inputFile = perf::TestBase::getDataPath(GetParam());\r
\r
cap >> frame;\r
ASSERT_FALSE(frame.empty());\r
\r
- cv::gpu::GpuMat d_frame(frame);\r
- cv::gpu::FGDStatModel d_model(4);\r
- d_model.create(d_frame);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_frame(frame);\r
+\r
+ cv::gpu::FGDStatModel d_model(4);\r
+ d_model.create(d_frame);\r
+\r
+ for (int i = 0; i < 10; ++i)\r
+ {\r
+ cap >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
\r
- for (int i = 0; i < 10; ++i)\r
+ d_frame.upload(frame);\r
+\r
+ startTimer(); next();\r
+ d_model.update(d_frame);\r
+ stopTimer();\r
+ }\r
+ }\r
+ else\r
{\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
+ IplImage ipl_frame = frame;\r
+ cv::Ptr<CvBGStatModel> model(cvCreateFGDStatModel(&ipl_frame));\r
+\r
+ for (int i = 0; i < 10; ++i)\r
+ {\r
+ cap >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
\r
- d_frame.upload(frame);\r
+ ipl_frame = frame;\r
\r
- startTimer(); next();\r
- d_model.update(d_frame);\r
- stopTimer();\r
+ startTimer(); next();\r
+ cvUpdateBGStatModel(&ipl_frame, model);\r
+ stopTimer();\r
+ }\r
}\r
}\r
\r
\r
cv::Mat frame;\r
\r
- cv::gpu::GpuMat d_frame;\r
- cv::gpu::MOG_GPU d_mog;\r
- cv::gpu::GpuMat d_foreground;\r
-\r
cap >> frame;\r
ASSERT_FALSE(frame.empty());\r
\r
cv::swap(temp, frame);\r
}\r
\r
- d_frame.upload(frame);\r
-\r
- d_mog(d_frame, d_foreground, learningRate);\r
-\r
- for (int i = 0; i < 10; ++i)\r
+ if (runOnGpu)\r
{\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
+ cv::gpu::GpuMat d_frame(frame);\r
+ cv::gpu::MOG_GPU d_mog;\r
+ cv::gpu::GpuMat d_foreground;\r
\r
- if (cn != 3)\r
+ d_mog(d_frame, d_foreground, learningRate);\r
+\r
+ for (int i = 0; i < 10; ++i)\r
{\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
+ cap >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
+\r
+ if (cn != 3)\r
+ {\r
+ cv::Mat temp;\r
+ if (cn == 1)\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
+ else\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
+ cv::swap(temp, frame);\r
+ }\r
+\r
+ d_frame.upload(frame);\r
+\r
+ startTimer(); next();\r
+ d_mog(d_frame, d_foreground, learningRate);\r
+ stopTimer();\r
}\r
+ }\r
+ else\r
+ {\r
+ cv::BackgroundSubtractorMOG mog;\r
+ cv::Mat foreground;\r
\r
- d_frame.upload(frame);\r
+ mog(frame, foreground, learningRate);\r
\r
- startTimer(); next();\r
- d_mog(d_frame, d_foreground, learningRate);\r
- stopTimer();\r
+ for (int i = 0; i < 10; ++i)\r
+ {\r
+ cap >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
+\r
+ if (cn != 3)\r
+ {\r
+ cv::Mat temp;\r
+ if (cn == 1)\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
+ else\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
+ cv::swap(temp, frame);\r
+ }\r
+\r
+ startTimer(); next();\r
+ mog(frame, foreground, learningRate);\r
+ stopTimer();\r
+ }\r
}\r
}\r
\r
\r
cv::Mat frame;\r
\r
- cv::gpu::GpuMat d_frame;\r
- cv::gpu::MOG2_GPU d_mog2;\r
- cv::gpu::GpuMat d_foreground;\r
-\r
cap >> frame;\r
ASSERT_FALSE(frame.empty());\r
\r
cv::swap(temp, frame);\r
}\r
\r
- d_frame.upload(frame);\r
-\r
- d_mog2(d_frame, d_foreground);\r
-\r
- for (int i = 0; i < 10; ++i)\r
+ if (runOnGpu)\r
{\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
+ cv::gpu::GpuMat d_frame(frame);\r
+ cv::gpu::MOG2_GPU d_mog2;\r
+ cv::gpu::GpuMat d_foreground;\r
+\r
+ d_mog2(d_frame, d_foreground);\r
\r
- if (cn != 3)\r
+ for (int i = 0; i < 10; ++i)\r
{\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
+ cap >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
+\r
+ if (cn != 3)\r
+ {\r
+ cv::Mat temp;\r
+ if (cn == 1)\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
+ else\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
+ cv::swap(temp, frame);\r
+ }\r
+\r
+ d_frame.upload(frame);\r
+\r
+ startTimer(); next();\r
+ d_mog2(d_frame, d_foreground);\r
+ stopTimer();\r
}\r
+ }\r
+ else\r
+ {\r
+ cv::BackgroundSubtractorMOG2 mog2;\r
+ cv::Mat foreground;\r
\r
- d_frame.upload(frame);\r
+ mog2(frame, foreground);\r
\r
- startTimer(); next();\r
- d_mog2(d_frame, d_foreground);\r
- stopTimer();\r
+ for (int i = 0; i < 10; ++i)\r
+ {\r
+ cap >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
+\r
+ if (cn != 3)\r
+ {\r
+ cv::Mat temp;\r
+ if (cn == 1)\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
+ else\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
+ cv::swap(temp, frame);\r
+ }\r
+\r
+ startTimer(); next();\r
+ mog2(frame, foreground);\r
+ stopTimer();\r
+ }\r
}\r
}\r
\r
\r
cv::Mat frame;\r
\r
- cv::gpu::GpuMat d_frame;\r
- cv::gpu::MOG2_GPU d_mog2;\r
- cv::gpu::GpuMat d_foreground;\r
-\r
- for (int i = 0; i < 10; ++i)\r
+ if (runOnGpu)\r
{\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
+ cv::gpu::GpuMat d_frame;\r
+ cv::gpu::MOG2_GPU d_mog2;\r
+ cv::gpu::GpuMat d_foreground;\r
\r
- if (cn != 3)\r
+ for (int i = 0; i < 10; ++i)\r
{\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
+ cap >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
+\r
+ if (cn != 3)\r
+ {\r
+ cv::Mat temp;\r
+ if (cn == 1)\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
+ else\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
+ cv::swap(temp, frame);\r
+ }\r
+\r
+ d_frame.upload(frame);\r
+\r
+ d_mog2(d_frame, d_foreground);\r
}\r
\r
- d_frame.upload(frame);\r
+ cv::gpu::GpuMat d_background;\r
+ d_mog2.getBackgroundImage(d_background);\r
\r
- d_mog2(d_frame, d_foreground);\r
+ TEST_CYCLE()\r
+ {\r
+ d_mog2.getBackgroundImage(d_background);\r
+ }\r
}\r
+ else\r
+ {\r
+ cv::BackgroundSubtractorMOG2 mog2;\r
+ cv::Mat foreground;\r
\r
- cv::gpu::GpuMat d_background;\r
- d_mog2.getBackgroundImage(d_background);\r
+ for (int i = 0; i < 10; ++i)\r
+ {\r
+ cap >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
+\r
+ if (cn != 3)\r
+ {\r
+ cv::Mat temp;\r
+ if (cn == 1)\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
+ else\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
+ cv::swap(temp, frame);\r
+ }\r
+\r
+ mog2(frame, foreground);\r
+ }\r
\r
- TEST_CYCLE()\r
- {\r
- d_mog2.getBackgroundImage(d_background);\r
+ cv::Mat background;\r
+ mog2.getBackgroundImage(background);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ mog2.getBackgroundImage(background);\r
+ }\r
}\r
}\r
\r
cv::swap(temp, frame);\r
}\r
\r
- cv::gpu::GpuMat d_frame(frame);\r
- cv::gpu::VIBE_GPU d_vibe;\r
- cv::gpu::GpuMat d_foreground;\r
-\r
- d_vibe(d_frame, d_foreground);\r
-\r
- for (int i = 0; i < 10; ++i)\r
+ if (runOnGpu)\r
{\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
+ cv::gpu::GpuMat d_frame(frame);\r
+ cv::gpu::VIBE_GPU d_vibe;\r
+ cv::gpu::GpuMat d_foreground;\r
\r
- if (cn != 3)\r
+ d_vibe(d_frame, d_foreground);\r
+\r
+ for (int i = 0; i < 10; ++i)\r
{\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
+ cap >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
+\r
+ if (cn != 3)\r
+ {\r
+ cv::Mat temp;\r
+ if (cn == 1)\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
+ else\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
+ cv::swap(temp, frame);\r
+ }\r
+\r
+ d_frame.upload(frame);\r
+\r
+ startTimer(); next();\r
+ d_vibe(d_frame, d_foreground);\r
+ stopTimer();\r
}\r
-\r
- d_frame.upload(frame);\r
-\r
- startTimer(); next();\r
- d_vibe(d_frame, d_foreground);\r
- stopTimer();\r
+ }\r
+ else\r
+ {\r
+ FAIL();\r
}\r
}\r
\r
cv::swap(temp, frame);\r
}\r
\r
- cv::gpu::GpuMat d_frame(frame);\r
- cv::gpu::GpuMat d_fgmask;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_frame(frame);\r
+ cv::gpu::GpuMat d_fgmask;\r
\r
- cv::gpu::GMG_GPU d_gmg;\r
- d_gmg.maxFeatures = maxFeatures;\r
+ cv::gpu::GMG_GPU d_gmg;\r
+ d_gmg.maxFeatures = maxFeatures;\r
\r
- d_gmg(d_frame, d_fgmask);\r
+ d_gmg(d_frame, d_fgmask);\r
\r
- for (int i = 0; i < 150; ++i)\r
- {\r
- cap >> frame;\r
- if (frame.empty())\r
+ for (int i = 0; i < 150; ++i)\r
{\r
- cap.open(inputFile);\r
cap >> frame;\r
+ if (frame.empty())\r
+ {\r
+ cap.open(inputFile);\r
+ cap >> frame;\r
+ }\r
+\r
+ if (cn != 3)\r
+ {\r
+ cv::Mat temp;\r
+ if (cn == 1)\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
+ else\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
+ cv::swap(temp, frame);\r
+ }\r
+\r
+ d_frame.upload(frame);\r
+\r
+ startTimer(); next();\r
+ d_gmg(d_frame, d_fgmask);\r
+ stopTimer();\r
}\r
+ }\r
+ else\r
+ {\r
+ cv::Mat fgmask;\r
+ cv::Mat zeros(frame.size(), CV_8UC1, cv::Scalar::all(0));\r
\r
- if (cn != 3)\r
- {\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
- }\r
+ cv::BackgroundSubtractorGMG gmg;\r
+ gmg.set("maxFeatures", maxFeatures);\r
+ gmg.initialize(frame.size(), 0.0, 255.0);\r
\r
- d_frame.upload(frame);\r
+ gmg(frame, fgmask);\r
\r
- startTimer(); next();\r
- d_gmg(d_frame, d_fgmask);\r
- stopTimer();\r
+ for (int i = 0; i < 150; ++i)\r
+ {\r
+ cap >> frame;\r
+ if (frame.empty())\r
+ {\r
+ cap.open(inputFile);\r
+ cap >> frame;\r
+ }\r
+\r
+ if (cn != 3)\r
+ {\r
+ cv::Mat temp;\r
+ if (cn == 1)\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
+ else\r
+ cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
+ cv::swap(temp, frame);\r
+ }\r
+\r
+ startTimer(); next();\r
+ gmg(frame, fgmask);\r
+ stopTimer();\r
+ }\r
}\r
}\r
\r
\r
PERF_TEST_P(Video, Video_VideoWriter, Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"))\r
{\r
+ declare.time(30);\r
+\r
string inputFile = perf::TestBase::getDataPath(GetParam());\r
string outputFile = cv::tempfile(".avi");\r
\r
cv::VideoCapture reader(inputFile);\r
ASSERT_TRUE( reader.isOpened() );\r
\r
- cv::gpu::VideoWriter_GPU d_writer;\r
-\r
cv::Mat frame;\r
- cv::gpu::GpuMat d_frame;\r
\r
- declare.time(10);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::VideoWriter_GPU d_writer;\r
+\r
+ cv::gpu::GpuMat d_frame;\r
+\r
+ for (int i = 0; i < 10; ++i)\r
+ {\r
+ reader >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
+\r
+ d_frame.upload(frame);\r
+\r
+ if (!d_writer.isOpened())\r
+ d_writer.open(outputFile, frame.size(), FPS);\r
\r
- for (int i = 0; i < 10; ++i)\r
+ startTimer(); next();\r
+ d_writer.write(d_frame);\r
+ stopTimer();\r
+ }\r
+ }\r
+ else\r
{\r
- reader >> frame;\r
- ASSERT_FALSE(frame.empty());\r
+ cv::VideoWriter writer;\r
\r
- d_frame.upload(frame);\r
+ for (int i = 0; i < 10; ++i)\r
+ {\r
+ reader >> frame;\r
+ ASSERT_FALSE(frame.empty());\r
\r
- if (!d_writer.isOpened())\r
- d_writer.open(outputFile, frame.size(), FPS);\r
+ if (!writer.isOpened())\r
+ writer.open(outputFile, CV_FOURCC('X', 'V', 'I', 'D'), FPS, frame.size());\r
\r
- startTimer(); next();\r
- d_writer.write(d_frame);\r
- stopTimer();\r
+ startTimer(); next();\r
+ writer.write(frame);\r
+ stopTimer();\r
+ }\r
}\r
}\r
\r
\r
string inputFile = perf::TestBase::getDataPath(GetParam());\r
\r
- cv::gpu::VideoReader_GPU d_reader(inputFile);\r
- ASSERT_TRUE( d_reader.isOpened() );\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::VideoReader_GPU d_reader(inputFile);\r
+ ASSERT_TRUE( d_reader.isOpened() );\r
\r
- cv::gpu::GpuMat d_frame;\r
+ cv::gpu::GpuMat d_frame;\r
\r
- d_reader.read(d_frame);\r
+ d_reader.read(d_frame);\r
\r
- TEST_CYCLE_N(10)\r
+ TEST_CYCLE_N(10)\r
+ {\r
+ d_reader.read(d_frame);\r
+ }\r
+ }\r
+ else\r
{\r
- d_reader.read(d_frame);\r
+ cv::VideoCapture reader(inputFile);\r
+ ASSERT_TRUE( reader.isOpened() );\r
+\r
+ cv::Mat frame;\r
+\r
+ reader >> frame;\r
+\r
+ TEST_CYCLE_N(10)\r
+ {\r
+ reader >> frame;\r
+ }\r
}\r
}\r
\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-#ifdef HAVE_CUDA\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// StereoBM\r
-\r
-GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo)\r
-{\r
- cv::Mat img_l = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img_l.empty());\r
-\r
- cv::Mat img_r = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img_r.empty());\r
-\r
- cv::StereoBM bm(0, 256);\r
-\r
- cv::Mat dst;\r
-\r
- bm(img_l, img_r, dst);\r
-\r
- declare.time(5.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- bm(img_l, img_r, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Calib3D, StereoBM, ALL_DEVICES);\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// ProjectPoints\r
-\r
-IMPLEMENT_PARAM_CLASS(Count, int)\r
-\r
-GPU_PERF_TEST(ProjectPoints, cv::gpu::DeviceInfo, Count)\r
-{\r
- int count = GET_PARAM(1);\r
-\r
- cv::Mat src(1, count, CV_32FC3);\r
- fill(src, -100, 100);\r
-\r
- cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1);\r
- cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1);\r
- cv::Mat camera_mat = cv::Mat::ones(3, 3, CV_32FC1);\r
- cv::Mat dst;\r
-\r
- cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::projectPoints(src, rvec, tvec, camera_mat, cv::noArray(), dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Calib3D, ProjectPoints, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values<Count>(5000, 10000, 20000)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// SolvePnPRansac\r
-\r
-GPU_PERF_TEST(SolvePnPRansac, cv::gpu::DeviceInfo, Count)\r
-{\r
- int count = GET_PARAM(1);\r
-\r
- cv::Mat object(1, count, CV_32FC3);\r
- fill(object, -100, 100);\r
-\r
- cv::Mat camera_mat(3, 3, CV_32FC1);\r
- fill(camera_mat, 0.5, 1);\r
- camera_mat.at<float>(0, 1) = 0.f;\r
- camera_mat.at<float>(1, 0) = 0.f;\r
- camera_mat.at<float>(2, 0) = 0.f;\r
- camera_mat.at<float>(2, 1) = 0.f;\r
-\r
- cv::Mat dist_coef(1, 8, CV_32F, cv::Scalar::all(0));\r
-\r
- std::vector<cv::Point2f> image_vec;\r
- cv::Mat rvec_gold(1, 3, CV_32FC1);\r
- fill(rvec_gold, 0, 1);\r
- cv::Mat tvec_gold(1, 3, CV_32FC1);\r
- fill(tvec_gold, 0, 1);\r
- cv::projectPoints(object, rvec_gold, tvec_gold, camera_mat, dist_coef, image_vec);\r
-\r
- cv::Mat image(1, count, CV_32FC2, &image_vec[0]);\r
-\r
- cv::Mat rvec;\r
- cv::Mat tvec;\r
-\r
- cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);\r
-\r
- declare.time(10.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::solvePnPRansac(object, image, camera_mat, dist_coef, rvec, tvec);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Calib3D, SolvePnPRansac, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values<Count>(5000, 10000, 20000)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// ReprojectImageTo3D\r
-\r
-GPU_PERF_TEST(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 5.0, 30.0);\r
-\r
- cv::Mat Q(4, 4, CV_32FC1);\r
- fill(Q, 0.1, 1.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::reprojectImageTo3D(src, dst, Q);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::reprojectImageTo3D(src, dst, Q);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Calib3D, ReprojectImageTo3D, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16S)));\r
-\r
-#endif\r
-\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-#ifdef HAVE_CUDA\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Merge\r
-\r
-GPU_PERF_TEST(Merge, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int channels = GET_PARAM(3);\r
-\r
- std::vector<cv::Mat> src(channels);\r
- for (int i = 0; i < channels; ++i)\r
- src[i] = cv::Mat(size, depth, cv::Scalar::all(i));\r
-\r
- cv::Mat dst;\r
-\r
- cv::merge(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::merge(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Merge, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F),\r
- testing::Values<Channels>(2, 3, 4)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Split\r
-\r
-GPU_PERF_TEST(Split, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int channels = GET_PARAM(3);\r
-\r
- cv::Mat src(size, CV_MAKE_TYPE(depth, channels), cv::Scalar(1, 2, 3, 4));\r
-\r
- std::vector<cv::Mat> dst;\r
-\r
- cv::split(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::split(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Split, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F),\r
- testing::Values<Channels>(2, 3, 4)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Add_Mat\r
-\r
-GPU_PERF_TEST(Add_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0.0, 100.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::add(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::add(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Add_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Add_Scalar\r
-\r
-GPU_PERF_TEST(Add_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Scalar s(1, 2, 3, 4);\r
- cv::Mat dst;\r
-\r
- cv::add(src, s, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::add(src, s, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Add_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Subtract_Mat\r
-\r
-GPU_PERF_TEST(Subtract_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0.0, 100.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::subtract(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::subtract(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Subtract_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Subtract_Scalar\r
-\r
-GPU_PERF_TEST(Subtract_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Scalar s(1, 2, 3, 4);\r
- cv::Mat dst;\r
-\r
- cv::subtract(src, s, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::subtract(src, s, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Subtract_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Multiply_Mat\r
-\r
-GPU_PERF_TEST(Multiply_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0.0, 100.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::multiply(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::multiply(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Multiply_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Multiply_Scalar\r
-\r
-GPU_PERF_TEST(Multiply_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Scalar s(1, 2, 3, 4);\r
- cv::Mat dst;\r
-\r
- cv::multiply(src, s, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::multiply(src, s, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Multiply_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Divide_Mat\r
-\r
-GPU_PERF_TEST(Divide_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0.0, 100.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::divide(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::divide(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Divide_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Divide_Scalar\r
-\r
-GPU_PERF_TEST(Divide_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Scalar s(1, 2, 3, 4);\r
- cv::Mat dst;\r
-\r
- cv::divide(src, s, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::divide(src, s, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Divide_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Divide_Scalar_Inv\r
-\r
-GPU_PERF_TEST(Divide_Scalar_Inv, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 100.0);\r
-\r
- double scale = 100.0;\r
- cv::Mat dst;\r
-\r
- cv::divide(scale, src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::divide(scale, src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Divide_Scalar_Inv, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// AbsDiff_Mat\r
-\r
-GPU_PERF_TEST(AbsDiff_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0.0, 100.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::absdiff(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::absdiff(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, AbsDiff_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// AbsDiff_Scalar\r
-\r
-GPU_PERF_TEST(AbsDiff_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Scalar s(1, 2, 3, 4);\r
- cv::Mat dst;\r
-\r
- cv::absdiff(src, s, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::absdiff(src, s, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, AbsDiff_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Sqrt\r
-\r
-GPU_PERF_TEST(Sqrt, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::sqrt(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::sqrt(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Sqrt, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16S, CV_32F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Log\r
-\r
-GPU_PERF_TEST(Log, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 1.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::log(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::log(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Log, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16S, CV_32F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Exp\r
-\r
-GPU_PERF_TEST(Exp, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 1.0, 10.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::exp(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::exp(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Exp, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16S, CV_32F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Pow\r
-\r
-GPU_PERF_TEST(Pow, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 1.0, 10.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::pow(src, 2.3, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::pow(src, 2.3, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Pow, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16S, CV_32F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Compare_Mat\r
-\r
-CV_ENUM(CmpCode, cv::CMP_EQ, cv::CMP_GT, cv::CMP_GE, cv::CMP_LT, cv::CMP_LE, cv::CMP_NE)\r
-#define ALL_CMP_CODES testing::Values(CmpCode(cv::CMP_EQ), CmpCode(cv::CMP_NE), CmpCode(cv::CMP_GT), CmpCode(cv::CMP_GE), CmpCode(cv::CMP_LT), CmpCode(cv::CMP_LE))\r
-\r
-GPU_PERF_TEST(Compare_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth, CmpCode)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int cmp_code = GET_PARAM(3);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0, 100.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::compare(src1, src2, dst, cmp_code);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::compare(src1, src2, dst, cmp_code);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Compare_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F),\r
- ALL_CMP_CODES));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Compare_Scalar\r
-\r
-GPU_PERF_TEST(Compare_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, CmpCode)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int cmp_code = GET_PARAM(3);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0, 100.0);\r
-\r
- cv::Scalar s = cv::Scalar::all(50);\r
- cv::Mat dst;\r
-\r
- cv::compare(src, s, dst, cmp_code);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::compare(src, s, dst, cmp_code);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Compare_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F),\r
- ALL_CMP_CODES));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Bitwise_Not\r
-\r
-GPU_PERF_TEST(Bitwise_Not, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::bitwise_not(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::bitwise_not(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Not, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32S)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Bitwise_And_Mat\r
-\r
-GPU_PERF_TEST(Bitwise_And_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0, 100.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::bitwise_and(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::bitwise_and(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_And_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32S)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Bitwise_And_Scalar\r
-\r
-GPU_PERF_TEST(Bitwise_And_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int channels = GET_PARAM(3);\r
-\r
- int type = CV_MAKE_TYPE(depth, channels);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 100.0);\r
-\r
- cv::Scalar s = cv::Scalar(50, 50, 50, 50);\r
- cv::Mat dst;\r
-\r
- cv::bitwise_and(src, s, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::bitwise_and(src, s, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_And_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32S),\r
- testing::Values<Channels>(1, 3, 4)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Bitwise_Or_Mat\r
-\r
-GPU_PERF_TEST(Bitwise_Or_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0, 100.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::bitwise_or(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::bitwise_or(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Or_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32S)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Bitwise_Or_Scalar\r
-\r
-GPU_PERF_TEST(Bitwise_Or_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int channels = GET_PARAM(3);\r
-\r
- int type = CV_MAKE_TYPE(depth, channels);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 100.0);\r
-\r
- cv::Scalar s = cv::Scalar(50, 50, 50, 50);\r
- cv::Mat dst;\r
-\r
- cv::bitwise_or(src, s, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::bitwise_or(src, s, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Or_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32S),\r
- testing::Values<Channels>(1, 3, 4)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Bitwise_Xor_Mat\r
-\r
-GPU_PERF_TEST(Bitwise_Xor_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0, 100.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::bitwise_xor(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::bitwise_xor(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Xor_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32S)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Bitwise_Xor_Scalar\r
-\r
-GPU_PERF_TEST(Bitwise_Xor_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int channels = GET_PARAM(3);\r
-\r
- int type = CV_MAKE_TYPE(depth, channels);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 100.0);\r
-\r
- cv::Scalar s = cv::Scalar(50, 50, 50, 50);\r
- cv::Mat dst;\r
-\r
- cv::bitwise_xor(src, s, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::bitwise_xor(src, s, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Bitwise_Xor_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32S),\r
- testing::Values<Channels>(1, 3, 4)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Min_Mat\r
-\r
-GPU_PERF_TEST(Min_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0, 255.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0, 255.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::min(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::min(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Min_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Min_Scalar\r
-\r
-GPU_PERF_TEST(Min_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0, 255.0);\r
-\r
- double val = 50.0;\r
- cv::Mat dst;\r
-\r
- cv::min(src, val, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::min(src, val, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Min_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Max_Mat\r
-\r
-GPU_PERF_TEST(Max_Mat, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, depth);\r
- fill(src1, 0, 255.0);\r
-\r
- cv::Mat src2(size, depth);\r
- fill(src2, 0, 255.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::max(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::max(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Max_Mat, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Max_Scalar\r
-\r
-GPU_PERF_TEST(Max_Scalar, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0, 255.0);\r
-\r
- double val = 50.0;\r
- cv::Mat dst;\r
-\r
- cv::max(src, val, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::max(src, val, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Max_Scalar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// AddWeighted\r
-\r
-GPU_PERF_TEST(AddWeighted, cv::gpu::DeviceInfo, cv::Size, MatDepth, MatDepth, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth1 = GET_PARAM(2);\r
- int depth2 = GET_PARAM(3);\r
- int dst_depth = GET_PARAM(4);\r
-\r
- cv::Mat src1(size, depth1);\r
- fill(src1, 0, 100.0);\r
-\r
- cv::Mat src2(size, depth2);\r
- fill(src2, 0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::addWeighted(src1, 0.5, src2, 0.5, 10.0, dst, dst_depth);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, AddWeighted, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F),\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F),\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// GEMM\r
-\r
-CV_FLAGS(GemmFlags, 0, cv::GEMM_1_T, cv::GEMM_2_T, cv::GEMM_3_T)\r
-#define ALL_GEMM_FLAGS testing::Values(GemmFlags(0), GemmFlags(cv::GEMM_1_T), GemmFlags(cv::GEMM_2_T), GemmFlags(cv::GEMM_3_T), GemmFlags(cv::GEMM_1_T | cv::GEMM_2_T), GemmFlags(cv::GEMM_1_T | cv::GEMM_3_T), GemmFlags(cv::GEMM_1_T | cv::GEMM_2_T | cv::GEMM_3_T))\r
-\r
-GPU_PERF_TEST(GEMM, cv::gpu::DeviceInfo, cv::Size, MatType, GemmFlags)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int flags = GET_PARAM(3);\r
-\r
- cv::Mat src1(size, type);\r
- fill(src1, 0.0, 10.0);\r
-\r
- cv::Mat src2(size, type);\r
- fill(src2, 0.0, 10.0);\r
-\r
- cv::Mat src3(size, type);\r
- fill(src3, 0.0, 10.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::gemm(src1, src2, 1.0, src3, 1.0, dst, flags);\r
-\r
- declare.time(50.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::gemm(src1, src2, 1.0, src3, 1.0, dst, flags);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, GEMM, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(cv::Size(512, 512), cv::Size(1024, 1024)),\r
- testing::Values<MatType>(CV_32FC1, CV_32FC2, CV_64FC1, CV_64FC2),\r
- ALL_GEMM_FLAGS));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Transpose\r
-\r
-GPU_PERF_TEST(Transpose, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::transpose(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::transpose(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Transpose, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatType>(CV_8UC1, CV_8UC4, CV_16UC2, CV_16SC2, CV_32SC1, CV_32SC2, CV_64FC1)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Flip\r
-\r
-enum {FLIP_BOTH = 0, FLIP_X = 1, FLIP_Y = -1};\r
-CV_ENUM(FlipCode, FLIP_BOTH, FLIP_X, FLIP_Y)\r
-#define ALL_FLIP_CODES testing::Values(FlipCode(FLIP_BOTH), FlipCode(FLIP_X), FlipCode(FLIP_Y))\r
-\r
-GPU_PERF_TEST(Flip, cv::gpu::DeviceInfo, cv::Size, MatType, FlipCode)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int flipCode = GET_PARAM(3);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::flip(src, dst, flipCode);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::flip(src, dst, flipCode);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Flip, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatType>(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4),\r
- ALL_FLIP_CODES));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// LUT_OneChannel\r
-\r
-GPU_PERF_TEST(LUT_OneChannel, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Mat lut(1, 256, CV_8UC1);\r
- fill(lut, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::LUT(src, lut, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::LUT(src, lut, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, LUT_OneChannel, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatType>(CV_8UC1, CV_8UC3)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// LUT_MultiChannel\r
-\r
-GPU_PERF_TEST(LUT_MultiChannel, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 100.0);\r
-\r
- cv::Mat lut(1, 256, CV_MAKE_TYPE(CV_8U, src.channels()));\r
- fill(lut, 0.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::LUT(src, lut, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::LUT(src, lut, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, LUT_MultiChannel, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatType>(CV_8UC3)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Magnitude_Complex\r
-\r
-GPU_PERF_TEST(Magnitude_Complex, cv::gpu::DeviceInfo, cv::Size)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
-\r
- cv::Mat src(size, CV_32FC2);\r
- fill(src, -100.0, 100.0);\r
-\r
- cv::Mat srcs[2];\r
- cv::split(src, srcs);\r
-\r
- cv::Mat dst;\r
-\r
- cv::magnitude(srcs[0], srcs[1], dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::magnitude(srcs[0], srcs[1], dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Magnitude_Complex, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Magnitude\r
-\r
-GPU_PERF_TEST(Magnitude, cv::gpu::DeviceInfo, cv::Size)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
-\r
- cv::Mat src1(size, CV_32FC1);\r
- fill(src1, -100.0, 100.0);\r
-\r
- cv::Mat src2(size, CV_32FC1);\r
- fill(src2, -100.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::magnitude(src1, src2, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::magnitude(src1, src2, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Magnitude, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Phase\r
-\r
-IMPLEMENT_PARAM_CLASS(AngleInDegrees, bool)\r
-\r
-GPU_PERF_TEST(Phase, cv::gpu::DeviceInfo, cv::Size, AngleInDegrees)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- bool angleInDegrees = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, CV_32FC1);\r
- fill(src1, -100.0, 100.0);\r
-\r
- cv::Mat src2(size, CV_32FC1);\r
- fill(src2, -100.0, 100.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::phase(src1, src2, dst, angleInDegrees);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::phase(src1, src2, dst, angleInDegrees);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Phase, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<AngleInDegrees>(false, true)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// CartToPolar\r
-\r
-GPU_PERF_TEST(CartToPolar, cv::gpu::DeviceInfo, cv::Size, AngleInDegrees)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- bool angleInDegrees = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, CV_32FC1);\r
- fill(src1, -100.0, 100.0);\r
-\r
- cv::Mat src2(size, CV_32FC1);\r
- fill(src2, -100.0, 100.0);\r
-\r
- cv::Mat magnitude;\r
- cv::Mat angle;\r
-\r
- cv::cartToPolar(src1, src2, magnitude, angle, angleInDegrees);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::cartToPolar(src1, src2, magnitude, angle, angleInDegrees);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, CartToPolar, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<AngleInDegrees>(false, true)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// PolarToCart\r
-\r
-GPU_PERF_TEST(PolarToCart, cv::gpu::DeviceInfo, cv::Size, AngleInDegrees)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- bool angleInDegrees = GET_PARAM(2);\r
-\r
- cv::Mat magnitude(size, CV_32FC1);\r
- fill(magnitude, 0.0, 100.0);\r
-\r
- cv::Mat angle(size, CV_32FC1);\r
- fill(angle, 0.0, angleInDegrees ? 360.0 : 2 * CV_PI);\r
-\r
- cv::Mat x;\r
- cv::Mat y;\r
-\r
- cv::polarToCart(magnitude, angle, x, y, angleInDegrees);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::polarToCart(magnitude, angle, x, y, angleInDegrees);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, PolarToCart, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<AngleInDegrees>(false, true)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// MeanStdDev\r
-\r
-GPU_PERF_TEST(MeanStdDev, cv::gpu::DeviceInfo, cv::Size)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
-\r
- cv::Mat src(size, CV_8UC1);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Scalar mean;\r
- cv::Scalar stddev;\r
-\r
- cv::meanStdDev(src, mean, stddev);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::meanStdDev(src, mean, stddev);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, MeanStdDev, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Norm\r
-\r
-GPU_PERF_TEST(Norm, cv::gpu::DeviceInfo, cv::Size, MatDepth, NormType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int normType = GET_PARAM(3);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 255.0);\r
-\r
- double dst;\r
- cv::Mat buf;\r
-\r
- dst = cv::norm(src, normType);\r
-\r
- TEST_CYCLE()\r
- {\r
- dst = cv::norm(src, normType);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Norm, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32S, CV_32F),\r
- testing::Values(NormType(cv::NORM_INF), NormType(cv::NORM_L1), NormType(cv::NORM_L2))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// NormDiff\r
-\r
-GPU_PERF_TEST(NormDiff, cv::gpu::DeviceInfo, cv::Size, NormType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int normType = GET_PARAM(2);\r
-\r
- cv::Mat src1(size, CV_8UC1);\r
- fill(src1, 0.0, 255.0);\r
-\r
- cv::Mat src2(size, CV_8UC1);\r
- fill(src2, 0.0, 255.0);\r
-\r
- double dst;\r
-\r
- dst = cv::norm(src1, src2, normType);\r
-\r
- TEST_CYCLE()\r
- {\r
- dst = cv::norm(src1, src2, normType);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, NormDiff, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(NormType(cv::NORM_INF), NormType(cv::NORM_L1), NormType(cv::NORM_L2))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Sum\r
-\r
-GPU_PERF_TEST(Sum, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Scalar dst;\r
-\r
- dst = cv::sum(src);\r
-\r
- TEST_CYCLE()\r
- {\r
- dst = cv::sum(src);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Sum, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatType>(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// MinMaxLoc\r
-\r
-GPU_PERF_TEST(MinMaxLoc, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 255.0);\r
-\r
- double minVal, maxVal;\r
- cv::Point minLoc, maxLoc;\r
-\r
- cv::minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, MinMaxLoc, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// CountNonZero\r
-\r
-GPU_PERF_TEST(CountNonZero, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0.0, 1.5);\r
-\r
- int dst;\r
-\r
- dst = cv::countNonZero(src);\r
-\r
- TEST_CYCLE()\r
- {\r
- dst = cv::countNonZero(src);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, CountNonZero, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_32F, CV_64F)));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Reduce\r
-\r
-CV_ENUM(ReduceCode, CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN)\r
-#define ALL_REDUCE_CODES testing::Values<ReduceCode>(CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN)\r
-\r
-enum {Rows = 0, Cols = 1};\r
-CV_ENUM(ReduceDim, Rows, Cols)\r
-\r
-GPU_PERF_TEST(Reduce, cv::gpu::DeviceInfo, cv::Size, MatDepth, Channels, ReduceCode, ReduceDim)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int channels = GET_PARAM(3);\r
- int reduceOp = GET_PARAM(4);\r
- int dim = GET_PARAM(5);\r
-\r
- int type = CV_MAKE_TYPE(depth, channels);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 10.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::reduce(src, dst, dim, reduceOp);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::reduce(src, dst, dim, reduceOp);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Core, Reduce, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values<MatDepth>(CV_8U, CV_16U, CV_16S, CV_32F),\r
- testing::Values<Channels>(1, 2, 3, 4),\r
- ALL_REDUCE_CODES,\r
- testing::Values(ReduceDim(Rows), ReduceDim(Cols))));\r
-\r
-#endif\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"
+++ /dev/null
-#ifdef __GNUC__\r
-# pragma GCC diagnostic ignored "-Wmissing-declarations"\r
-# pragma GCC diagnostic ignored "-Wmissing-prototypes" //OSX\r
-#endif\r
-\r
-#ifndef __OPENCV_PERF_CPU_PRECOMP_HPP__\r
-#define __OPENCV_PERF_CPU_PRECOMP_HPP__\r
-\r
-#include <cstdio>\r
-#include <iostream>\r
-\r
-#include "cvconfig.h"\r
-\r
-#include "opencv2/ts/ts.hpp"\r
-#include "opencv2/ts/ts_perf.hpp"\r
-\r
-#include "opencv2/core/core.hpp"\r
-#include "opencv2/highgui/highgui.hpp"\r
-#include "opencv2/gpu/gpu.hpp"\r
-#include "opencv2/imgproc/imgproc.hpp"\r
-#include "opencv2/video/video.hpp"\r
-#include "opencv2/calib3d/calib3d.hpp"\r
-#include "opencv2/nonfree/nonfree.hpp"\r
-#include "opencv2/legacy/legacy.hpp"\r
-\r
-#include "perf_utility.hpp"\r
-\r
-#ifdef GTEST_CREATE_SHARED_LIBRARY\r
-#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-#ifdef HAVE_CUDA\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// SURF\r
-\r
-GPU_PERF_TEST_1(SURF, cv::gpu::DeviceInfo)\r
-{\r
- cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img.empty());\r
-\r
- cv::SURF surf;\r
-\r
- std::vector<cv::KeyPoint> keypoints;\r
- cv::Mat descriptors;\r
-\r
- surf(img, cv::noArray(), keypoints, descriptors);\r
-\r
- declare.time(50.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- keypoints.clear();\r
- surf(img, cv::noArray(), keypoints, descriptors);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Features2D, SURF, ALL_DEVICES);\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// FAST\r
-\r
-GPU_PERF_TEST_1(FAST, cv::gpu::DeviceInfo)\r
-{\r
- cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img.empty());\r
-\r
- std::vector<cv::KeyPoint> keypoints;\r
-\r
- cv::FAST(img, keypoints, 20);\r
-\r
- TEST_CYCLE()\r
- {\r
- keypoints.clear();\r
- cv::FAST(img, keypoints, 20);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Features2D, FAST, ALL_DEVICES);\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// ORB\r
-\r
-GPU_PERF_TEST_1(ORB, cv::gpu::DeviceInfo)\r
-{\r
- cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img.empty());\r
-\r
- cv::ORB orb(4000);\r
-\r
- std::vector<cv::KeyPoint> keypoints;\r
- cv::Mat descriptors;\r
-\r
- orb(img, cv::noArray(), keypoints, descriptors);\r
-\r
- TEST_CYCLE()\r
- {\r
- keypoints.clear();\r
- orb(img, cv::noArray(), keypoints, descriptors);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Features2D, ORB, ALL_DEVICES);\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// BruteForceMatcher_match\r
-\r
-IMPLEMENT_PARAM_CLASS(DescriptorSize, int)\r
-\r
-GPU_PERF_TEST(BruteForceMatcher_match, cv::gpu::DeviceInfo, DescriptorSize, NormType)\r
-{\r
- int desc_size = GET_PARAM(1);\r
- int normType = GET_PARAM(2);\r
-\r
- int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;\r
-\r
- cv::Mat query(3000, desc_size, type);\r
- fill(query, 0.0, 10.0);\r
-\r
- cv::Mat train(3000, desc_size, type);\r
- fill(train, 0.0, 10.0);\r
-\r
- cv::BFMatcher matcher(normType);\r
-\r
- std::vector<cv::DMatch> matches;\r
-\r
- matcher.match(query, train, matches);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- matcher.match(query, train, matches);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_match, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),\r
- testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// BruteForceMatcher_knnMatch\r
-\r
-IMPLEMENT_PARAM_CLASS(K, int)\r
-\r
-GPU_PERF_TEST(BruteForceMatcher_knnMatch, cv::gpu::DeviceInfo, DescriptorSize, K, NormType)\r
-{\r
- int desc_size = GET_PARAM(1);\r
- int k = GET_PARAM(2);\r
- int normType = GET_PARAM(3);\r
-\r
- int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;\r
-\r
- cv::Mat query(3000, desc_size, type);\r
- fill(query, 0.0, 10.0);\r
-\r
- cv::Mat train(3000, desc_size, type);\r
- fill(train, 0.0, 10.0);\r
-\r
- cv::BFMatcher matcher(normType);\r
-\r
- std::vector< std::vector<cv::DMatch> > matches;\r
-\r
- matcher.knnMatch(query, train, matches, k);\r
-\r
- declare.time(30.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- matcher.knnMatch(query, train, matches, k);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_knnMatch, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),\r
- testing::Values(K(2), K(3)),\r
- testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// BruteForceMatcher_radiusMatch\r
-\r
-GPU_PERF_TEST(BruteForceMatcher_radiusMatch, cv::gpu::DeviceInfo, DescriptorSize, NormType)\r
-{\r
- int desc_size = GET_PARAM(1);\r
- int normType = GET_PARAM(2);\r
-\r
- int type = normType == cv::NORM_HAMMING ? CV_8U : CV_32F;\r
-\r
- cv::Mat query(3000, desc_size, type);\r
- fill(query, 0.0, 1.0);\r
-\r
- cv::Mat train(3000, desc_size, type);\r
- fill(train, 0.0, 1.0);\r
-\r
- cv::BFMatcher matcher(normType);\r
-\r
- std::vector< std::vector<cv::DMatch> > matches;\r
-\r
- matcher.radiusMatch(query, train, matches, 2.0);\r
-\r
- declare.time(30.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- matcher.radiusMatch(query, train, matches, 2.0);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_radiusMatch, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(DescriptorSize(64), DescriptorSize(128), DescriptorSize(256)),\r
- testing::Values(NormType(cv::NORM_L1), NormType(cv::NORM_L2), NormType(cv::NORM_HAMMING))));\r
-\r
-#endif\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-#ifdef HAVE_CUDA\r
-\r
-IMPLEMENT_PARAM_CLASS(KernelSize, int)\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Blur\r
-\r
-GPU_PERF_TEST(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int ksize = GET_PARAM(3);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::blur(src, dst, cv::Size(ksize, ksize));\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::blur(src, dst, cv::Size(ksize, ksize));\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Filters, Blur, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),\r
- testing::Values(KernelSize(3), KernelSize(5), KernelSize(7))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Sobel\r
-\r
-GPU_PERF_TEST(Sobel, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int ksize = GET_PARAM(3);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::Sobel(src, dst, -1, 1, 1, ksize);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::Sobel(src, dst, -1, 1, 1, ksize);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Filters, Sobel, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),\r
- testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Scharr\r
-\r
-GPU_PERF_TEST(Scharr, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::Scharr(src, dst, -1, 1, 0);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::Scharr(src, dst, -1, 1, 0);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Filters, Scharr, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// GaussianBlur\r
-\r
-GPU_PERF_TEST(GaussianBlur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int ksize = GET_PARAM(3);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::GaussianBlur(src, dst, cv::Size(ksize, ksize), 0.5);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::GaussianBlur(src, dst, cv::Size(ksize, ksize), 0.5);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Filters, GaussianBlur, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),\r
- testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Laplacian\r
-\r
-GPU_PERF_TEST(Laplacian, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int ksize = GET_PARAM(3);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::Laplacian(src, dst, -1, ksize);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::Laplacian(src, dst, -1, ksize);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Filters, Laplacian, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),\r
- testing::Values(KernelSize(1), KernelSize(3))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Erode\r
-\r
-GPU_PERF_TEST(Erode, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
-\r
- cv::Mat dst;\r
-\r
- cv::erode(src, dst, ker);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::erode(src, dst, ker);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Filters, Erode, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Dilate\r
-\r
-GPU_PERF_TEST(Dilate, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
-\r
- cv::Mat dst;\r
-\r
- cv::dilate(src, dst, ker);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::dilate(src, dst, ker);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Filters, Dilate, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// MorphologyEx\r
-\r
-CV_ENUM(MorphOp, cv::MORPH_OPEN, cv::MORPH_CLOSE, cv::MORPH_GRADIENT, cv::MORPH_TOPHAT, cv::MORPH_BLACKHAT)\r
-#define ALL_MORPH_OPS testing::Values(MorphOp(cv::MORPH_OPEN), MorphOp(cv::MORPH_CLOSE), MorphOp(cv::MORPH_GRADIENT), MorphOp(cv::MORPH_TOPHAT), MorphOp(cv::MORPH_BLACKHAT))\r
-\r
-GPU_PERF_TEST(MorphologyEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int morphOp = GET_PARAM(3);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
-\r
- cv::morphologyEx(src, dst, morphOp, ker);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::morphologyEx(src, dst, morphOp, ker);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Filters, MorphologyEx, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),\r
- ALL_MORPH_OPS));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Filter2D\r
-\r
-GPU_PERF_TEST(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int ksize = GET_PARAM(3);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0.0, 255.0);\r
-\r
- cv::Mat kernel(ksize, ksize, CV_32FC1);\r
- fill(kernel, 0.0, 1.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::filter2D(src, dst, -1, kernel);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::filter2D(src, dst, -1, kernel);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Filters, Filter2D, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),\r
- testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));\r
-\r
-#endif\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-#ifdef HAVE_CUDA\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Remap\r
-\r
-GPU_PERF_TEST(Remap, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int interpolation = GET_PARAM(3);\r
- int borderMode = GET_PARAM(4);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat xmap(size, CV_32FC1);\r
- fill(xmap, 0, size.width);\r
-\r
- cv::Mat ymap(size, CV_32FC1);\r
- fill(ymap, 0, size.height);\r
-\r
- cv::Mat dst;\r
-\r
- cv::remap(src, dst, xmap, ymap, interpolation, borderMode);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::remap(src, dst, xmap, ymap, interpolation, borderMode);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Remap, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),\r
- testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),\r
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));\r
-\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Resize\r
-\r
-IMPLEMENT_PARAM_CLASS(Scale, double)\r
-\r
-GPU_PERF_TEST(Resize, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, Scale)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int interpolation = GET_PARAM(3);\r
- double f = GET_PARAM(4);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),\r
- testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR),\r
- Interpolation(cv::INTER_CUBIC), Interpolation(cv::INTER_AREA)),\r
- testing::Values(Scale(0.5), Scale(0.3), Scale(2.0))));\r
-\r
-GPU_PERF_TEST(ResizeArea, cv::gpu::DeviceInfo, cv::Size, MatType, Scale)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int interpolation = cv::INTER_AREA;\r
- double f = GET_PARAM(3);\r
-\r
- cv::Mat src_host(size, type);\r
- fill(src_host, 0, 255);\r
-\r
- cv::Mat src(src_host);\r
- cv::Mat dst;\r
-\r
- cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
-\r
- declare.time(1.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, ResizeArea, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(perf::sz1080p, cv::Size(4096, 2048)),\r
- testing::Values(MatType(CV_8UC1)/*, MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)*/),\r
- testing::Values(Scale(0.2),Scale(0.1),Scale(0.05))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// WarpAffine\r
-\r
-GPU_PERF_TEST(WarpAffine, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int interpolation = GET_PARAM(3);\r
- int borderMode = GET_PARAM(4);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- const double aplha = CV_PI / 4;\r
- double mat[2][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},\r
- {std::sin(aplha), std::cos(aplha), 0}};\r
- cv::Mat M(2, 3, CV_64F, (void*) mat);\r
-\r
- cv::warpAffine(src, dst, M, size, interpolation, borderMode);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::warpAffine(src, dst, M, size, interpolation, borderMode);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, WarpAffine, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),\r
- testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),\r
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// WarpPerspective\r
-\r
-GPU_PERF_TEST(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int interpolation = GET_PARAM(3);\r
- int borderMode = GET_PARAM(4);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- const double aplha = CV_PI / 4;\r
- double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},\r
- {std::sin(aplha), std::cos(aplha), 0},\r
- {0.0, 0.0, 1.0}};\r
- cv::Mat M(3, 3, CV_64F, (void*) mat);\r
-\r
- cv::warpPerspective(src, dst, M, size, interpolation, borderMode);\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::warpPerspective(src, dst, M, size, interpolation, borderMode);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, WarpPerspective, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),\r
- testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),\r
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// CopyMakeBorder\r
-\r
-GPU_PERF_TEST(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, BorderMode)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int borderType = GET_PARAM(3);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, CopyMakeBorder, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),\r
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Threshold\r
-\r
-CV_ENUM(ThreshOp, cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)\r
-#define ALL_THRESH_OPS testing::Values(ThreshOp(cv::THRESH_BINARY), ThreshOp(cv::THRESH_BINARY_INV), ThreshOp(cv::THRESH_TRUNC), ThreshOp(cv::THRESH_TOZERO), ThreshOp(cv::THRESH_TOZERO_INV))\r
-\r
-GPU_PERF_TEST(Threshold, cv::gpu::DeviceInfo, cv::Size, MatDepth, ThreshOp)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- int threshOp = GET_PARAM(3);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::threshold(src, dst, 100.0, 255.0, threshOp);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::threshold(src, dst, 100.0, 255.0, threshOp);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Threshold, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F)),\r
- ALL_THRESH_OPS));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Integral\r
-\r
-GPU_PERF_TEST(Integral, cv::gpu::DeviceInfo, cv::Size)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
-\r
- cv::Mat src(size, CV_8UC1);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::integral(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::integral(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// HistEven_OneChannel\r
-\r
-GPU_PERF_TEST(HistEven_OneChannel, cv::gpu::DeviceInfo, cv::Size, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
-\r
- cv::Mat src(size, depth);\r
- fill(src, 0, 255);\r
-\r
- int hbins = 30;\r
- float hranges[] = {0.0f, 180.0f};\r
- cv::Mat hist;\r
- int histSize[] = {hbins};\r
- const float* ranges[] = {hranges};\r
- int channels[] = {0};\r
-\r
- cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, HistEven_OneChannel, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// EqualizeHist\r
-\r
-GPU_PERF_TEST(EqualizeHist, cv::gpu::DeviceInfo, cv::Size)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
-\r
- cv::Mat src(size, CV_8UC1);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::equalizeHist(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::equalizeHist(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, EqualizeHist, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Canny\r
-\r
-IMPLEMENT_PARAM_CLASS(AppertureSize, int)\r
-IMPLEMENT_PARAM_CLASS(L2gradient, bool)\r
-\r
-GPU_PERF_TEST(Canny, cv::gpu::DeviceInfo, AppertureSize, L2gradient)\r
-{\r
- int apperture_size = GET_PARAM(1);\r
- bool useL2gradient = GET_PARAM(2);\r
-\r
- cv::Mat image = readImage("perf/1280x1024.jpg", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(image.empty());\r
-\r
- cv::Mat dst;\r
-\r
- cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Canny, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(AppertureSize(3), AppertureSize(5)),\r
- testing::Values(L2gradient(false), L2gradient(true))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// MeanShiftFiltering\r
-\r
-GPU_PERF_TEST_1(MeanShiftFiltering, cv::gpu::DeviceInfo)\r
-{\r
- cv::Mat img = readImage("gpu/meanshift/cones.png");\r
- ASSERT_FALSE(img.empty());\r
-\r
- cv::Mat dst;\r
-\r
- cv::pyrMeanShiftFiltering(img, dst, 50, 50);\r
-\r
- declare.time(15.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::pyrMeanShiftFiltering(img, dst, 50, 50);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftFiltering, ALL_DEVICES);\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Convolve\r
-\r
-IMPLEMENT_PARAM_CLASS(KSize, int)\r
-IMPLEMENT_PARAM_CLASS(Ccorr, bool)\r
-\r
-GPU_PERF_TEST(Convolve, cv::gpu::DeviceInfo, cv::Size, KSize, Ccorr)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int templ_size = GET_PARAM(2);\r
- bool ccorr = GET_PARAM(3);\r
-\r
- ASSERT_FALSE(ccorr);\r
-\r
- cv::Mat image(size, CV_32FC1);\r
- image.setTo(1.0);\r
-\r
- cv::Mat templ(templ_size, templ_size, CV_32FC1);\r
- templ.setTo(1.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::filter2D(image, dst, image.depth(), templ);\r
-\r
- declare.time(10.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::filter2D(image, dst, image.depth(), templ);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Convolve, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(KSize(3), KSize(9), KSize(17), KSize(27), KSize(32), KSize(64)),\r
- testing::Values(Ccorr(false), Ccorr(true))));\r
-\r
-////////////////////////////////////////////////////////////////////////////////\r
-// MatchTemplate_8U\r
-\r
-CV_ENUM(TemplateMethod, cv::TM_SQDIFF, cv::TM_SQDIFF_NORMED, cv::TM_CCORR, cv::TM_CCORR_NORMED, cv::TM_CCOEFF, cv::TM_CCOEFF_NORMED)\r
-#define ALL_TEMPLATE_METHODS testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_SQDIFF_NORMED), TemplateMethod(cv::TM_CCORR), TemplateMethod(cv::TM_CCORR_NORMED), TemplateMethod(cv::TM_CCOEFF), TemplateMethod(cv::TM_CCOEFF_NORMED))\r
-\r
-IMPLEMENT_PARAM_CLASS(TemplateSize, cv::Size)\r
-\r
-GPU_PERF_TEST(MatchTemplate_8U, cv::gpu::DeviceInfo, cv::Size, TemplateSize, Channels, TemplateMethod)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- cv::Size templ_size = GET_PARAM(2);\r
- int cn = GET_PARAM(3);\r
- int method = GET_PARAM(4);\r
-\r
- cv::Mat image(size, CV_MAKE_TYPE(CV_8U, cn));\r
- fill(image, 0, 255);\r
-\r
- cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_8U, cn));\r
- fill(templ, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::matchTemplate(image, templ, dst, method);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::matchTemplate(image, templ, dst, method);\r
- }\r
-};\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate_8U, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))),\r
- testing::Values(Channels(1), Channels(3), Channels(4)),\r
- ALL_TEMPLATE_METHODS));\r
-\r
-////////////////////////////////////////////////////////////////////////////////\r
-// MatchTemplate_32F\r
-\r
-GPU_PERF_TEST(MatchTemplate_32F, cv::gpu::DeviceInfo, cv::Size, TemplateSize, Channels, TemplateMethod)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- cv::Size templ_size = GET_PARAM(2);\r
- int cn = GET_PARAM(3);\r
- int method = GET_PARAM(4);\r
-\r
- cv::Mat image(size, CV_MAKE_TYPE(CV_32F, cn));\r
- fill(image, 0, 255);\r
-\r
- cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_32F, cn));\r
- fill(templ, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::matchTemplate(image, templ, dst, method);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::matchTemplate(image, templ, dst, method);\r
- }\r
-};\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate_32F, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))),\r
- testing::Values(Channels(1), Channels(3), Channels(4)),\r
- testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// MulSpectrums\r
-\r
-CV_FLAGS(DftFlags, 0, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMPLEX_OUTPUT, cv::DFT_REAL_OUTPUT)\r
-\r
-GPU_PERF_TEST(MulSpectrums, cv::gpu::DeviceInfo, cv::Size, DftFlags)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int flag = GET_PARAM(2);\r
-\r
- cv::Mat a(size, CV_32FC2);\r
- fill(a, 0, 100);\r
-\r
- cv::Mat b(size, CV_32FC2);\r
- fill(b, 0, 100);\r
-\r
- cv::Mat dst;\r
-\r
- cv::mulSpectrums(a, b, dst, flag);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::mulSpectrums(a, b, dst, flag);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, MulSpectrums, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(DftFlags(0), DftFlags(cv::DFT_ROWS))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// Dft\r
-\r
-GPU_PERF_TEST(Dft, cv::gpu::DeviceInfo, cv::Size, DftFlags)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int flag = GET_PARAM(2);\r
-\r
- cv::Mat src(size, CV_32FC2);\r
- fill(src, 0, 100);\r
-\r
- cv::Mat dst;\r
-\r
- cv::dft(src, dst, flag);\r
-\r
- declare.time(10.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::dft(src, dst, flag);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Dft, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(DftFlags(0), DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// CornerHarris\r
-\r
-IMPLEMENT_PARAM_CLASS(BlockSize, int)\r
-IMPLEMENT_PARAM_CLASS(ApertureSize, int)\r
-\r
-GPU_PERF_TEST(CornerHarris, cv::gpu::DeviceInfo, MatType, BorderMode, BlockSize, ApertureSize)\r
-{\r
- int type = GET_PARAM(1);\r
- int borderType = GET_PARAM(2);\r
- int blockSize = GET_PARAM(3);\r
- int apertureSize = GET_PARAM(4);\r
-\r
- cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img.empty());\r
-\r
- img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);\r
-\r
- cv::Mat dst;\r
-\r
- double k = 0.5;\r
-\r
- cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderType);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderType);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, CornerHarris, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),\r
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),\r
- testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),\r
- testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// CornerMinEigenVal\r
-\r
-GPU_PERF_TEST(CornerMinEigenVal, cv::gpu::DeviceInfo, MatType, BorderMode, BlockSize, ApertureSize)\r
-{\r
- int type = GET_PARAM(1);\r
- int borderType = GET_PARAM(2);\r
- int blockSize = GET_PARAM(3);\r
- int apertureSize = GET_PARAM(4);\r
-\r
- cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img.empty());\r
-\r
- img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);\r
-\r
- cv::Mat dst;\r
-\r
- cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderType);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderType);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, CornerMinEigenVal, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),\r
- testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),\r
- testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),\r
- testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// PyrDown\r
-\r
-GPU_PERF_TEST(PyrDown, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::pyrDown(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::pyrDown(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// PyrUp\r
-\r
-GPU_PERF_TEST(PyrUp, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::pyrUp(src, dst);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::pyrUp(src, dst);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// CvtColor\r
-\r
-GPU_PERF_TEST(CvtColor, cv::gpu::DeviceInfo, cv::Size, MatDepth, CvtColorInfo)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth = GET_PARAM(2);\r
- CvtColorInfo info = GET_PARAM(3);\r
-\r
- cv::Mat src(size, CV_MAKETYPE(depth, info.scn));\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- cv::cvtColor(src, dst, info.code, info.dcn);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::cvtColor(src, dst, info.code, info.dcn);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F)),\r
- testing::Values(CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA),\r
- CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY),\r
- CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA),\r
- CvtColorInfo(3, 3, cv::COLOR_BGR2XYZ),\r
- CvtColorInfo(3, 3, cv::COLOR_XYZ2BGR),\r
- CvtColorInfo(3, 3, cv::COLOR_BGR2YCrCb),\r
- CvtColorInfo(3, 3, cv::COLOR_YCrCb2BGR),\r
- CvtColorInfo(3, 3, cv::COLOR_BGR2YUV),\r
- CvtColorInfo(3, 3, cv::COLOR_YUV2BGR),\r
- CvtColorInfo(3, 3, cv::COLOR_BGR2HSV),\r
- CvtColorInfo(3, 3, cv::COLOR_HSV2BGR),\r
- CvtColorInfo(3, 3, cv::COLOR_BGR2HLS),\r
- CvtColorInfo(3, 3, cv::COLOR_HLS2BGR),\r
- CvtColorInfo(3, 3, cv::COLOR_BGR2Lab),\r
- CvtColorInfo(3, 3, cv::COLOR_RGB2Lab),\r
- CvtColorInfo(3, 3, cv::COLOR_BGR2Luv),\r
- CvtColorInfo(3, 3, cv::COLOR_RGB2Luv),\r
- CvtColorInfo(3, 3, cv::COLOR_Lab2BGR),\r
- CvtColorInfo(3, 3, cv::COLOR_Lab2RGB),\r
- CvtColorInfo(3, 3, cv::COLOR_Luv2BGR),\r
- CvtColorInfo(3, 3, cv::COLOR_Luv2RGB),\r
- CvtColorInfo(1, 3, cv::COLOR_BayerBG2BGR),\r
- CvtColorInfo(1, 3, cv::COLOR_BayerGB2BGR),\r
- CvtColorInfo(1, 3, cv::COLOR_BayerRG2BGR),\r
- CvtColorInfo(1, 3, cv::COLOR_BayerGR2BGR),\r
- CvtColorInfo(4, 4, cv::COLOR_RGBA2mRGBA))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// HoughLines\r
-\r
-IMPLEMENT_PARAM_CLASS(DoSort, bool)\r
-\r
-GPU_PERF_TEST(HoughLines, cv::gpu::DeviceInfo, cv::Size, DoSort)\r
-{\r
- declare.time(30.0);\r
-\r
- const cv::Size size = GET_PARAM(1);\r
-\r
- const float rho = 1.0f;\r
- const float theta = CV_PI / 180.0f;\r
- const int threshold = 300;\r
-\r
- cv::RNG rng(123456789);\r
-\r
- cv::Mat src(size, CV_8UC1, cv::Scalar::all(0));\r
-\r
- const int numLines = rng.uniform(500, 2000);\r
- for (int i = 0; i < numLines; ++i)\r
- {\r
- cv::Point p1(rng.uniform(0, src.cols), rng.uniform(0, src.rows));\r
- cv::Point p2(rng.uniform(0, src.cols), rng.uniform(0, src.rows));\r
- cv::line(src, p1, p2, cv::Scalar::all(255), 2);\r
- }\r
-\r
- std::vector<cv::Vec2f> lines;\r
- cv::HoughLines(src, lines, rho, theta, threshold);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::HoughLines(src, lines, rho, theta, threshold);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ImgProc, HoughLines, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(DoSort(false), DoSort(true))));\r
-\r
-#endif\r
+++ /dev/null
-/*M///////////////////////////////////////////////////////////////////////////////////////
-//
-// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
-//
-// By downloading, copying, installing or using the software you agree to this license.
-// If you do not agree to this license, do not download, install,
-// copy or use the software.
-//
-//
-// License Agreement
-// For Open Source Computer Vision Library
-//
-// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
-// Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved.
-// Third party copyrights are property of their respective owners.
-//
-// Redistribution and use in source and binary forms, with or without modification,
-// are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// * The name of the copyright holders may not be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// This software is provided by the copyright holders and contributors "as is" and
-// any express or implied warranties, including, but not limited to, the implied
-// warranties of merchantability and fitness for a particular purpose are disclaimed.
-// In no event shall the Intel Corporation or contributors be liable for any direct,
-// indirect, incidental, special, exemplary, or consequential damages
-// (including, but not limited to, procurement of substitute goods or services;
-// loss of use, data, or profits; or business interruption) however caused
-// and on any theory of liability, whether in contract, strict liability,
-// or tort (including negligence or otherwise) arising in any way out of
-// the use of this software, even if advised of the possibility of such damage.
-//M*/
-
-#include "perf_precomp.hpp"
-
-#ifdef HAVE_CUDA
-
-namespace {
-
- struct GreedyLabeling
- {
- struct dot
- {
- int x;
- int y;
-
- static dot make(int i, int j)
- {
- dot d; d.x = i; d.y = j;
- return d;
- }
- };
-
- struct InInterval
- {
- InInterval(const int& _lo, const int& _hi) : lo(-_lo), hi(_hi) {};
- const int lo, hi;
-
- bool operator() (const unsigned char a, const unsigned char b) const
- {
- int d = a - b;
- return lo <= d && d <= hi;
- }
- };
-
- GreedyLabeling(cv::Mat img)
- : image(img), _labels(image.size(), CV_32SC1, cv::Scalar::all(-1)) {stack = new dot[image.cols * image.rows];}
-
- ~GreedyLabeling(){delete[] stack;}
-
- void operator() (cv::Mat labels) const
- {
- labels.setTo(cv::Scalar::all(-1));
- InInterval inInt(0, 2);
- int cc = -1;
-
- int* dist_labels = (int*)labels.data;
- int pitch = labels.step1();
-
- unsigned char* source = (unsigned char*)image.data;
- int width = image.cols;
- int height = image.rows;
-
- for (int j = 0; j < image.rows; ++j)
- for (int i = 0; i < image.cols; ++i)
- {
- if (dist_labels[j * pitch + i] != -1) continue;
-
- dot* top = stack;
- dot p = dot::make(i, j);
- cc++;
-
- dist_labels[j * pitch + i] = cc;
-
- while (top >= stack)
- {
- int* dl = &dist_labels[p.y * pitch + p.x];
- unsigned char* sp = &source[p.y * image.step1() + p.x];
-
- dl[0] = cc;
-
- //right
- if( p.x < (width - 1) && dl[ +1] == -1 && inInt(sp[0], sp[+1]))
- *top++ = dot::make(p.x + 1, p.y);
-
- //left
- if( p.x > 0 && dl[-1] == -1 && inInt(sp[0], sp[-1]))
- *top++ = dot::make(p.x - 1, p.y);
-
- //bottom
- if( p.y < (height - 1) && dl[+pitch] == -1 && inInt(sp[0], sp[+image.step1()]))
- *top++ = dot::make(p.x, p.y + 1);
-
- //top
- if( p.y > 0 && dl[-pitch] == -1 && inInt(sp[0], sp[-image.step1()]))
- *top++ = dot::make(p.x, p.y - 1);
-
- p = *--top;
- }
- }
- }
-
- cv::Mat image;
- cv::Mat _labels;
- dot* stack;
- };
-}
-
-GPU_PERF_TEST(ConnectedComponents, cv::gpu::DeviceInfo, cv::Size)
-{
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
- cv::gpu::setDevice(devInfo.deviceID());
-
- cv::Mat image = readImage("gpu/labeling/aloe-disp.png", cv::IMREAD_GRAYSCALE);
-
- GreedyLabeling host(image);
-
- host(host._labels);
-
- declare.time(1.0);
-
- TEST_CYCLE()
- {
- host(host._labels);
- }
-}
-
-INSTANTIATE_TEST_CASE_P(Labeling, ConnectedComponents, testing::Combine(ALL_DEVICES, testing::Values(cv::Size(261, 262))));
-
-#endif
\ No newline at end of file
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-#ifdef HAVE_CUDA\r
-\r
-int main(int argc, char **argv)\r
-{\r
- testing::InitGoogleTest(&argc, argv);\r
- perf::TestBase::Init(argc, argv);\r
- return RUN_ALL_TESTS();\r
-}\r
-\r
-#else\r
-\r
-int main()\r
-{\r
- printf("OpenCV was built without CUDA support\n");\r
- return 0;\r
-}\r
-\r
-#endif\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-#ifdef HAVE_CUDA\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// SetTo\r
-\r
-GPU_PERF_TEST(SetTo, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- cv::Scalar val(1, 2, 3, 4);\r
-\r
- src.setTo(val);\r
-\r
- TEST_CYCLE()\r
- {\r
- src.setTo(val);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(MatOp, SetTo, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4),\r
- MatType(CV_64FC1), MatType(CV_64FC3), MatType(CV_64FC4))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// SetToMasked\r
-\r
-GPU_PERF_TEST(SetToMasked, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat mask(size, CV_8UC1);\r
- fill(mask, 0, 2);\r
-\r
- cv::Scalar val(1, 2, 3, 4);\r
-\r
- src.setTo(val, mask);\r
-\r
- TEST_CYCLE()\r
- {\r
- src.setTo(val, mask);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(MatOp, SetToMasked, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4),\r
- MatType(CV_64FC1), MatType(CV_64FC3), MatType(CV_64FC4))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// CopyToMasked\r
-\r
-GPU_PERF_TEST(CopyToMasked, cv::gpu::DeviceInfo, cv::Size, MatType)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
-\r
- cv::Mat src(size, type);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat mask(size, CV_8UC1);\r
- fill(mask, 0, 2);\r
-\r
- cv::Mat dst;\r
-\r
- src.copyTo(dst, mask);\r
-\r
- TEST_CYCLE()\r
- {\r
- src.copyTo(dst, mask);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(MatOp, CopyToMasked, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),\r
- MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),\r
- MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4),\r
- MatType(CV_64FC1), MatType(CV_64FC3), MatType(CV_64FC4))));\r
-\r
-//////////////////////////////////////////////////////////////////////\r
-// ConvertTo\r
-\r
-GPU_PERF_TEST(ConvertTo, cv::gpu::DeviceInfo, cv::Size, MatDepth, MatDepth)\r
-{\r
- cv::Size size = GET_PARAM(1);\r
- int depth1 = GET_PARAM(2);\r
- int depth2 = GET_PARAM(3);\r
-\r
- cv::Mat src(size, depth1);\r
- fill(src, 0, 255);\r
-\r
- cv::Mat dst;\r
-\r
- src.convertTo(dst, depth2, 0.5, 1.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- src.convertTo(dst, depth2, 0.5, 1.0);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(MatOp, ConvertTo, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F)),\r
- testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F))));\r
-\r
-#endif\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-#ifdef HAVE_CUDA\r
-\r
-///////////////////////////////////////////////////////////////\r
-// HOG\r
-\r
-GPU_PERF_TEST_1(HOG, cv::gpu::DeviceInfo)\r
-{\r
- cv::Mat img = readImage("gpu/hog/road.png", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img.empty());\r
-\r
- std::vector<cv::Rect> found_locations;\r
-\r
- cv::HOGDescriptor hog;\r
- hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());\r
-\r
- hog.detectMultiScale(img, found_locations);\r
-\r
- TEST_CYCLE()\r
- {\r
- hog.detectMultiScale(img, found_locations);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ObjDetect, HOG, ALL_DEVICES);\r
-\r
-///////////////////////////////////////////////////////////////\r
-// HaarClassifier\r
-\r
-GPU_PERF_TEST_1(HaarClassifier, cv::gpu::DeviceInfo)\r
-{\r
- cv::Mat img = readImage("gpu/haarcascade/group_1_640x480_VGA.pgm", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img.empty());\r
-\r
- cv::CascadeClassifier cascade;\r
-\r
- ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/perf/haarcascade_frontalface_alt.xml")));\r
-\r
- std::vector<cv::Rect> rects;\r
-\r
- cascade.detectMultiScale(img, rects);\r
-\r
- TEST_CYCLE()\r
- {\r
- cascade.detectMultiScale(img, rects);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ObjDetect, HaarClassifier, ALL_DEVICES);\r
-\r
-//===================== LBP cascade ==========================//\r
-GPU_PERF_TEST_1(LBPClassifier, cv::gpu::DeviceInfo)\r
-{\r
- cv::Mat img = readImage("gpu/haarcascade/group_1_640x480_VGA.pgm", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(img.empty());\r
-\r
- cv::CascadeClassifier cascade;\r
-\r
- ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath("gpu/lbpcascade/lbpcascade_frontalface.xml")));\r
-\r
- std::vector<cv::Rect> rects;\r
-\r
- cascade.detectMultiScale(img, rects);\r
-\r
- TEST_CYCLE()\r
- {\r
- cascade.detectMultiScale(img, rects);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(ObjDetect, LBPClassifier, ALL_DEVICES);\r
-\r
-#endif\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-using namespace std;\r
-using namespace cv;\r
-using namespace cv::gpu;\r
-\r
-void fill(Mat& m, double a, double b)\r
-{\r
- RNG rng(123456789);\r
- rng.fill(m, RNG::UNIFORM, a, b);\r
-}\r
-\r
-void PrintTo(const CvtColorInfo& info, ostream* os)\r
-{\r
- static const char* str[] =\r
- {\r
- "BGR2BGRA",\r
- "BGRA2BGR",\r
- "BGR2RGBA",\r
- "RGBA2BGR",\r
- "BGR2RGB",\r
- "BGRA2RGBA",\r
-\r
- "BGR2GRAY",\r
- "RGB2GRAY",\r
- "GRAY2BGR",\r
- "GRAY2BGRA",\r
- "BGRA2GRAY",\r
- "RGBA2GRAY",\r
-\r
- "BGR2BGR565",\r
- "RGB2BGR565",\r
- "BGR5652BGR",\r
- "BGR5652RGB",\r
- "BGRA2BGR565",\r
- "RGBA2BGR565",\r
- "BGR5652BGRA",\r
- "BGR5652RGBA",\r
-\r
- "GRAY2BGR565",\r
- "BGR5652GRAY",\r
-\r
- "BGR2BGR555",\r
- "RGB2BGR555",\r
- "BGR5552BGR",\r
- "BGR5552RGB",\r
- "BGRA2BGR555",\r
- "RGBA2BGR555",\r
- "BGR5552BGRA",\r
- "BGR5552RGBA",\r
-\r
- "GRAY2BGR555",\r
- "BGR5552GRAY",\r
-\r
- "BGR2XYZ",\r
- "RGB2XYZ",\r
- "XYZ2BGR",\r
- "XYZ2RGB",\r
-\r
- "BGR2YCrCb",\r
- "RGB2YCrCb",\r
- "YCrCb2BGR",\r
- "YCrCb2RGB",\r
-\r
- "BGR2HSV",\r
- "RGB2HSV",\r
-\r
- "",\r
- "",\r
-\r
- "BGR2Lab",\r
- "RGB2Lab",\r
-\r
- "BayerBG2BGR",\r
- "BayerGB2BGR",\r
- "BayerRG2BGR",\r
- "BayerGR2BGR",\r
-\r
- "BGR2Luv",\r
- "RGB2Luv",\r
-\r
- "BGR2HLS",\r
- "RGB2HLS",\r
-\r
- "HSV2BGR",\r
- "HSV2RGB",\r
-\r
- "Lab2BGR",\r
- "Lab2RGB",\r
- "Luv2BGR",\r
- "Luv2RGB",\r
-\r
- "HLS2BGR",\r
- "HLS2RGB",\r
-\r
- "BayerBG2BGR_VNG",\r
- "BayerGB2BGR_VNG",\r
- "BayerRG2BGR_VNG",\r
- "BayerGR2BGR_VNG",\r
-\r
- "BGR2HSV_FULL",\r
- "RGB2HSV_FULL",\r
- "BGR2HLS_FULL",\r
- "RGB2HLS_FULL",\r
-\r
- "HSV2BGR_FULL",\r
- "HSV2RGB_FULL",\r
- "HLS2BGR_FULL",\r
- "HLS2RGB_FULL",\r
-\r
- "LBGR2Lab",\r
- "LRGB2Lab",\r
- "LBGR2Luv",\r
- "LRGB2Luv",\r
-\r
- "Lab2LBGR",\r
- "Lab2LRGB",\r
- "Luv2LBGR",\r
- "Luv2LRGB",\r
-\r
- "BGR2YUV",\r
- "RGB2YUV",\r
- "YUV2BGR",\r
- "YUV2RGB",\r
-\r
- "BayerBG2GRAY",\r
- "BayerGB2GRAY",\r
- "BayerRG2GRAY",\r
- "BayerGR2GRAY",\r
-\r
- //YUV 4:2:0 formats family\r
- "YUV2RGB_NV12",\r
- "YUV2BGR_NV12",\r
- "YUV2RGB_NV21",\r
- "YUV2BGR_NV21",\r
-\r
- "YUV2RGBA_NV12",\r
- "YUV2BGRA_NV12",\r
- "YUV2RGBA_NV21",\r
- "YUV2BGRA_NV21",\r
-\r
- "YUV2RGB_YV12",\r
- "YUV2BGR_YV12",\r
- "YUV2RGB_IYUV",\r
- "YUV2BGR_IYUV",\r
-\r
- "YUV2RGBA_YV12",\r
- "YUV2BGRA_YV12",\r
- "YUV2RGBA_IYUV",\r
- "YUV2BGRA_IYUV",\r
-\r
- "YUV2GRAY_420",\r
-\r
- //YUV 4:2:2 formats family\r
- "YUV2RGB_UYVY",\r
- "YUV2BGR_UYVY",\r
- "YUV2RGB_VYUY",\r
- "YUV2BGR_VYUY",\r
-\r
- "YUV2RGBA_UYVY",\r
- "YUV2BGRA_UYVY",\r
- "YUV2RGBA_VYUY",\r
- "YUV2BGRA_VYUY",\r
-\r
- "YUV2RGB_YUY2",\r
- "YUV2BGR_YUY2",\r
- "YUV2RGB_YVYU",\r
- "YUV2BGR_YVYU",\r
-\r
- "YUV2RGBA_YUY2",\r
- "YUV2BGRA_YUY2",\r
- "YUV2RGBA_YVYU",\r
- "YUV2BGRA_YVYU",\r
-\r
- "YUV2GRAY_UYVY",\r
- "YUV2GRAY_YUY2",\r
-\r
- // alpha premultiplication\r
- "RGBA2mRGBA",\r
- "mRGBA2RGBA",\r
-\r
- "COLORCVT_MAX"\r
- };\r
-\r
- *os << str[info.code];\r
-}\r
-\r
-void cv::gpu::PrintTo(const DeviceInfo& info, ostream* os)\r
-{\r
- *os << info.name();\r
-}\r
-\r
-Mat readImage(const string& fileName, int flags)\r
-{\r
- return imread(perf::TestBase::getDataPath(fileName), flags);\r
-}\r
-\r
-const vector<DeviceInfo>& devices()\r
-{\r
- static vector<DeviceInfo> devs;\r
- static bool first = true;\r
-\r
- if (first)\r
- {\r
- int deviceCount = getCudaEnabledDeviceCount();\r
-\r
- devs.reserve(deviceCount);\r
-\r
- for (int i = 0; i < deviceCount; ++i)\r
- {\r
- DeviceInfo info(i);\r
- if (info.isCompatible())\r
- devs.push_back(info);\r
- }\r
-\r
- first = false;\r
- }\r
-\r
- return devs;\r
-}\r
+++ /dev/null
-#ifndef __OPENCV_PERF_GPU_UTILITY_HPP__\r
-#define __OPENCV_PERF_GPU_UTILITY_HPP__\r
-\r
-void fill(cv::Mat& m, double a, double b);\r
-\r
-using perf::MatType;\r
-using perf::MatDepth;\r
-\r
-CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP)\r
- CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA)\r
-CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_HAMMING)\r
-\r
-struct CvtColorInfo\r
-{\r
- int scn;\r
- int dcn;\r
- int code;\r
-\r
- explicit CvtColorInfo(int scn_=0, int dcn_=0, int code_=0) : scn(scn_), dcn(dcn_), code(code_) {}\r
-};\r
-\r
-void PrintTo(const CvtColorInfo& info, std::ostream* os);\r
-\r
-#define IMPLEMENT_PARAM_CLASS(name, type) \\r
- class name \\r
- { \\r
- public: \\r
- name ( type arg = type ()) : val_(arg) {} \\r
- operator type () const {return val_;} \\r
- private: \\r
- type val_; \\r
- }; \\r
- inline void PrintTo( name param, std::ostream* os) \\r
- { \\r
- *os << #name << " = " << testing::PrintToString(static_cast< type >(param)); \\r
- }\r
-\r
-IMPLEMENT_PARAM_CLASS(Channels, int)\r
-\r
-namespace cv { namespace gpu\r
-{\r
- void PrintTo(const cv::gpu::DeviceInfo& info, std::ostream* os);\r
-}}\r
-\r
-#define GPU_PERF_TEST(name, ...) \\r
- struct name : perf::TestBaseWithParam< std::tr1::tuple< __VA_ARGS__ > > \\r
- { \\r
- public: \\r
- name() {} \\r
- protected: \\r
- void PerfTestBody(); \\r
- }; \\r
- TEST_P(name, perf){ RunPerfTestBody(); } \\r
- void name :: PerfTestBody()\r
-\r
-#define GPU_PERF_TEST_1(name, param_type) \\r
- struct name : perf::TestBaseWithParam< param_type > \\r
- { \\r
- public: \\r
- name() {} \\r
- protected: \\r
- void PerfTestBody(); \\r
- }; \\r
- TEST_P(name, perf){ RunPerfTestBody(); } \\r
- void name :: PerfTestBody()\r
-\r
-#define GPU_TYPICAL_MAT_SIZES testing::Values(perf::szSXGA, perf::sz1080p, cv::Size(1800, 1500))\r
-\r
-cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR);\r
-\r
-const std::vector<cv::gpu::DeviceInfo>& devices();\r
-\r
-#define ALL_DEVICES testing::ValuesIn(devices())\r
-\r
-#define GET_PARAM(k) std::tr1::get< k >(GetParam())\r
-\r
-#endif // __OPENCV_PERF_GPU_UTILITY_HPP__\r
+++ /dev/null
-#include "perf_cpu_precomp.hpp"\r
-\r
-#ifdef HAVE_CUDA\r
-\r
-//////////////////////////////////////////////////////\r
-// GoodFeaturesToTrack\r
-\r
-IMPLEMENT_PARAM_CLASS(MinDistance, double)\r
-\r
-GPU_PERF_TEST(GoodFeaturesToTrack, cv::gpu::DeviceInfo, MinDistance)\r
-{\r
- double minDistance = GET_PARAM(1);\r
-\r
- cv::Mat image = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(image.empty());\r
-\r
- cv::Mat corners;\r
-\r
- cv::goodFeaturesToTrack(image, corners, 8000, 0.01, minDistance);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::goodFeaturesToTrack(image, corners, 8000, 0.01, minDistance);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, GoodFeaturesToTrack, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(MinDistance(0.0), MinDistance(3.0))));\r
-\r
-//////////////////////////////////////////////////////\r
-// PyrLKOpticalFlowSparse\r
-\r
-IMPLEMENT_PARAM_CLASS(GraySource, bool)\r
-IMPLEMENT_PARAM_CLASS(Points, int)\r
-IMPLEMENT_PARAM_CLASS(WinSize, int)\r
-IMPLEMENT_PARAM_CLASS(Levels, int)\r
-IMPLEMENT_PARAM_CLASS(Iters, int)\r
-\r
-GPU_PERF_TEST(PyrLKOpticalFlowSparse, cv::gpu::DeviceInfo, GraySource, Points, WinSize, Levels, Iters)\r
-{\r
- bool useGray = GET_PARAM(1);\r
- int points = GET_PARAM(2);\r
- int win_size = GET_PARAM(3);\r
- int levels = GET_PARAM(4);\r
- int iters = GET_PARAM(5);\r
-\r
- cv::Mat frame0 = readImage("gpu/opticalflow/frame0.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);\r
- ASSERT_FALSE(frame0.empty());\r
-\r
- cv::Mat frame1 = readImage("gpu/opticalflow/frame1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);\r
- ASSERT_FALSE(frame1.empty());\r
-\r
- cv::Mat gray_frame;\r
- if (useGray)\r
- gray_frame = frame0;\r
- else\r
- cv::cvtColor(frame0, gray_frame, cv::COLOR_BGR2GRAY);\r
-\r
- cv::Mat pts;\r
- cv::goodFeaturesToTrack(gray_frame, pts, points, 0.01, 0.0);\r
-\r
- cv::Mat nextPts;\r
- cv::Mat status;\r
-\r
- cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, cv::noArray(),\r
- cv::Size(win_size, win_size), levels - 1,\r
- cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, iters, 0.01));\r
-\r
- declare.time(20.0);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, cv::noArray(),\r
- cv::Size(win_size, win_size), levels - 1,\r
- cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, iters, 0.01));\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowSparse, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(GraySource(true), GraySource(false)),\r
- testing::Values(Points(1000), Points(2000), Points(4000), Points(8000)),\r
- testing::Values(WinSize(9), WinSize(13), WinSize(17), WinSize(21)),\r
- testing::Values(Levels(1), Levels(2), Levels(3)),\r
- testing::Values(Iters(1), Iters(10), Iters(30))));\r
-\r
-//////////////////////////////////////////////////////\r
-// FarnebackOpticalFlowTest\r
-\r
-GPU_PERF_TEST_1(FarnebackOpticalFlowTest, cv::gpu::DeviceInfo)\r
-{\r
- cv::Mat frame0 = readImage("gpu/opticalflow/frame0.png", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(frame0.empty());\r
-\r
- cv::Mat frame1 = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(frame1.empty());\r
-\r
- cv::Mat flow;\r
-\r
- int numLevels = 5;\r
- double pyrScale = 0.5;\r
- int winSize = 13;\r
- int numIters = 10;\r
- int polyN = 5;\r
- double polySigma = 1.1;\r
- int flags = 0;\r
-\r
- cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags);\r
-\r
- declare.time(10);\r
-\r
- TEST_CYCLE()\r
- {\r
- cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, FarnebackOpticalFlowTest, ALL_DEVICES);\r
-\r
-//////////////////////////////////////////////////////\r
-// FGDStatModel\r
-\r
-namespace cv\r
-{\r
- template<> void Ptr<CvBGStatModel>::delete_obj()\r
- {\r
- cvReleaseBGStatModel(&obj);\r
- }\r
-}\r
-\r
-GPU_PERF_TEST(FGDStatModel, cv::gpu::DeviceInfo, std::string)\r
-{\r
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));\r
-\r
- cv::VideoCapture cap(inputFile);\r
- ASSERT_TRUE(cap.isOpened());\r
-\r
- cv::Mat frame;\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
-\r
- IplImage ipl_frame = frame;\r
- cv::Ptr<CvBGStatModel> model(cvCreateFGDStatModel(&ipl_frame));\r
-\r
- declare.time(60);\r
-\r
- for (int i = 0; i < 10; ++i)\r
- {\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
-\r
- ipl_frame = frame;\r
-\r
- startTimer();\r
- next();\r
-\r
- cvUpdateBGStatModel(&ipl_frame, model);\r
-\r
- stopTimer();\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, FGDStatModel, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi"))));\r
-\r
-//////////////////////////////////////////////////////\r
-// MOG\r
-\r
-IMPLEMENT_PARAM_CLASS(LearningRate, double)\r
-\r
-GPU_PERF_TEST(MOG, cv::gpu::DeviceInfo, std::string, Channels, LearningRate)\r
-{\r
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));\r
- int cn = GET_PARAM(2);\r
- double learningRate = GET_PARAM(3);\r
-\r
- cv::VideoCapture cap(inputFile);\r
- ASSERT_TRUE(cap.isOpened());\r
-\r
- cv::Mat frame;\r
-\r
- cv::BackgroundSubtractorMOG mog;\r
- cv::Mat foreground;\r
-\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
-\r
- if (cn != 3)\r
- {\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
- }\r
-\r
- mog(frame, foreground, learningRate);\r
-\r
- for (int i = 0; i < 10; ++i)\r
- {\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
-\r
- if (cn != 3)\r
- {\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
- }\r
-\r
- startTimer(); next();\r
- mog(frame, foreground, learningRate);\r
- stopTimer();\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, MOG, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi")),\r
- testing::Values(Channels(1), Channels(3)/*, Channels(4)*/),\r
- testing::Values(LearningRate(0.0), LearningRate(0.01))));\r
-\r
-//////////////////////////////////////////////////////\r
-// MOG2\r
-\r
-GPU_PERF_TEST(MOG2_update, cv::gpu::DeviceInfo, std::string, Channels)\r
-{\r
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));\r
- int cn = GET_PARAM(2);\r
-\r
- cv::VideoCapture cap(inputFile);\r
- ASSERT_TRUE(cap.isOpened());\r
-\r
- cv::Mat frame;\r
-\r
- cv::BackgroundSubtractorMOG2 mog2;\r
- cv::Mat foreground;\r
-\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
-\r
- if (cn != 3)\r
- {\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
- }\r
-\r
- mog2(frame, foreground);\r
-\r
- for (int i = 0; i < 10; ++i)\r
- {\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
-\r
- if (cn != 3)\r
- {\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
- }\r
-\r
- startTimer(); next();\r
- mog2(frame, foreground);\r
- stopTimer();\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, MOG2_update, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi")),\r
- testing::Values(Channels(1), Channels(3)/*, Channels(4)*/)));\r
-\r
-GPU_PERF_TEST(MOG2_getBackgroundImage, cv::gpu::DeviceInfo, std::string, Channels)\r
-{\r
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));\r
- int cn = GET_PARAM(2);\r
-\r
- cv::VideoCapture cap(inputFile);\r
- ASSERT_TRUE(cap.isOpened());\r
-\r
- cv::Mat frame;\r
-\r
- cv::BackgroundSubtractorMOG2 mog2;\r
- cv::Mat foreground;\r
-\r
- for (int i = 0; i < 10; ++i)\r
- {\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
-\r
- if (cn != 3)\r
- {\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
- }\r
-\r
- mog2(frame, foreground);\r
- }\r
-\r
- cv::Mat background;\r
- mog2.getBackgroundImage(background);\r
-\r
- TEST_CYCLE()\r
- {\r
- mog2.getBackgroundImage(background);\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, MOG2_getBackgroundImage, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi")),\r
- testing::Values(/*Channels(1),*/ Channels(3)/*, Channels(4)*/)));\r
-\r
-//////////////////////////////////////////////////////\r
-// GMG\r
-\r
-IMPLEMENT_PARAM_CLASS(MaxFeatures, int)\r
-\r
-GPU_PERF_TEST(GMG, cv::gpu::DeviceInfo, std::string, Channels, MaxFeatures)\r
-{\r
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));\r
- int cn = GET_PARAM(2);\r
- int maxFeatures = GET_PARAM(3);\r
-\r
- cv::VideoCapture cap(inputFile);\r
- ASSERT_TRUE(cap.isOpened());\r
-\r
- cv::Mat frame;\r
- cap >> frame;\r
- ASSERT_FALSE(frame.empty());\r
-\r
- if (cn != 3)\r
- {\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
- }\r
-\r
- cv::Mat fgmask;\r
- cv::Mat zeros(frame.size(), CV_8UC1, cv::Scalar::all(0));\r
-\r
- cv::BackgroundSubtractorGMG gmg;\r
- gmg.set("maxFeatures", maxFeatures);\r
- gmg.initialize(frame.size(), 0.0, 255.0);\r
-\r
- gmg(frame, fgmask);\r
-\r
- for (int i = 0; i < 150; ++i)\r
- {\r
- cap >> frame;\r
- if (frame.empty())\r
- {\r
- cap.open(inputFile);\r
- cap >> frame;\r
- }\r
-\r
- if (cn != 3)\r
- {\r
- cv::Mat temp;\r
- if (cn == 1)\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2GRAY);\r
- else\r
- cv::cvtColor(frame, temp, cv::COLOR_BGR2BGRA);\r
- cv::swap(temp, frame);\r
- }\r
-\r
- startTimer(); next();\r
- gmg(frame, fgmask);\r
- stopTimer();\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, GMG, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi")),\r
- testing::Values(Channels(1), Channels(3), Channels(4)),\r
- testing::Values(MaxFeatures(20), MaxFeatures(40), MaxFeatures(60))));\r
-\r
-//////////////////////////////////////////////////////\r
-// VideoWriter\r
-\r
-#ifdef WIN32\r
-\r
-GPU_PERF_TEST(VideoWriter, cv::gpu::DeviceInfo, std::string)\r
-{\r
- const double FPS = 25.0;\r
-\r
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));\r
- std::string outputFile = cv::tempfile(".avi");\r
-\r
- cv::VideoCapture reader(inputFile);\r
- ASSERT_TRUE( reader.isOpened() );\r
-\r
- cv::VideoWriter writer;\r
-\r
- cv::Mat frame;\r
-\r
- declare.time(30);\r
-\r
- for (int i = 0; i < 10; ++i)\r
- {\r
- reader >> frame;\r
- ASSERT_FALSE(frame.empty());\r
-\r
- if (!writer.isOpened())\r
- writer.open(outputFile, CV_FOURCC('X', 'V', 'I', 'D'), FPS, frame.size());\r
-\r
- startTimer(); next();\r
- writer.write(frame);\r
- stopTimer();\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, VideoWriter, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi"))));\r
-\r
-#endif // WIN32\r
-\r
-//////////////////////////////////////////////////////\r
-// VideoReader\r
-\r
-GPU_PERF_TEST(VideoReader, cv::gpu::DeviceInfo, std::string)\r
-{\r
- std::string inputFile = perf::TestBase::getDataPath(std::string("gpu/video/") + GET_PARAM(1));\r
-\r
- cv::VideoCapture reader(inputFile);\r
- ASSERT_TRUE( reader.isOpened() );\r
-\r
- cv::Mat frame;\r
-\r
- reader >> frame;\r
-\r
- declare.time(20);\r
-\r
- TEST_CYCLE_N(10)\r
- {\r
- reader >> frame;\r
- }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(Video, VideoReader, testing::Combine(\r
- ALL_DEVICES,\r
- testing::Values(std::string("768x576.avi"), std::string("1920x1080.avi"))));\r
-\r
-#endif\r