GPU_PERF_TEST(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); int ksize = GET_PARAM(3); cv::Mat src_host(size, type); fill(src_host, 0.0, 255.0); cv::Mat kernel(ksize, ksize, CV_32FC1); fill(kernel, 0.0, 1.0); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::filter2D(src, dst, -1, kernel); TEST_CYCLE() { cv::gpu::filter2D(src, dst, -1, kernel); } }
GPU_PERF_TEST(MorphologyEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); int morphOp = GET_PARAM(3); cv::Mat src_host(size, type); fill(src_host, 0.0, 255.0); cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3)); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::GpuMat buf1; cv::gpu::GpuMat buf2; cv::gpu::morphologyEx(src, dst, morphOp, ker, buf1, buf2); TEST_CYCLE() { cv::gpu::morphologyEx(src, dst, morphOp, ker, buf1, buf2); } }
GPU_PERF_TEST(ResizeArea, cv::gpu::DeviceInfo, cv::Size, MatType, Scale) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); int interpolation = cv::INTER_AREA; double f = GET_PARAM(3); cv::Mat src_host(size, type); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation); declare.time(1.0); TEST_CYCLE() { cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation); } }
PERF_TEST_P(DevInfo_Size_MatType, transpose, testing::Combine(testing::ValuesIn(devices()), testing::Values(GPU_TYPICAL_MAT_SIZES), testing::Values(CV_8UC1, CV_32SC1, CV_64FC1))) { DeviceInfo devInfo = std::tr1::get<0>(GetParam()); Size size = std::tr1::get<1>(GetParam()); int type = std::tr1::get<2>(GetParam()); setDevice(devInfo.deviceID()); Mat src_host(size, type); declare.in(src_host, WARMUP_RNG); GpuMat src(src_host); GpuMat dst(size.width, size.height, type); declare.time(0.5).iterations(100); SIMPLE_TEST_CYCLE() { transpose(src, dst); } Mat dst_host(dst); SANITY_CHECK(dst_host); }
GPU_PERF_TEST(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); int interpolation = GET_PARAM(3); int borderMode = GET_PARAM(4); cv::Mat src_host(size, type); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; const double aplha = CV_PI / 4; double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2}, {std::sin(aplha), std::cos(aplha), 0}, {0.0, 0.0, 1.0}}; cv::Mat M(3, 3, CV_64F, (void*) mat); cv::gpu::warpPerspective(src, dst, M, size, interpolation, borderMode); TEST_CYCLE() { cv::gpu::warpPerspective(src, dst, M, size, interpolation, borderMode); } }
GPU_PERF_TEST(Remap, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); int interpolation = GET_PARAM(3); int borderMode = GET_PARAM(4); cv::Mat src_host(size, type); fill(src_host, 0, 255); cv::Mat xmap_host(size, CV_32FC1); fill(xmap_host, 0, size.width); cv::Mat ymap_host(size, CV_32FC1); fill(ymap_host, 0, size.height); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat xmap(xmap_host); cv::gpu::GpuMat ymap(ymap_host); cv::gpu::GpuMat dst; cv::gpu::remap(src, dst, xmap, ymap, interpolation, borderMode); declare.time(3.0); TEST_CYCLE() { cv::gpu::remap(src, dst, xmap, ymap, interpolation, borderMode); } }
GPU_PERF_TEST(HistEven_FourChannel, cv::gpu::DeviceInfo, cv::Size, MatDepth) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int depth = GET_PARAM(2); cv::Mat src_host(size, CV_MAKE_TYPE(depth, 4)); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat hist[4]; cv::gpu::GpuMat buf; int histSize[] = {30, 30, 30, 30}; int lowerLevel[] = {0, 0, 0, 0}; int upperLevel[] = {180, 180, 180, 180}; cv::gpu::histEven(src, hist, buf, histSize, lowerLevel, upperLevel); TEST_CYCLE() { cv::gpu::histEven(src, hist, buf, histSize, lowerLevel, upperLevel); } }
GPU_PERF_TEST(CvtColor, cv::gpu::DeviceInfo, cv::Size, MatDepth, CvtColorInfo) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int depth = GET_PARAM(2); CvtColorInfo info = GET_PARAM(3); cv::Mat src_host(size, CV_MAKETYPE(depth, info.scn)); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; if (info.code >= cv::COLOR_BayerBG2BGR && info.code <= cv::COLOR_BayerGR2BGR) info.dcn = 4; cv::gpu::cvtColor(src, dst, info.code, info.dcn); TEST_CYCLE() { cv::gpu::cvtColor(src, dst, info.code, info.dcn); } }
GPU_PERF_TEST(Exp, cv::gpu::DeviceInfo, cv::Size) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::Size size = GET_PARAM(1); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src_host(size, CV_32FC1); fill(src_host, 0.0, 10.0); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; TEST_CYCLE() { cv::gpu::exp(src, dst); } }
GPU_PERF_TEST(ColumnSum, cv::gpu::DeviceInfo, cv::Size) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); cv::Mat src_host(size, CV_32FC1); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::columnSum(src, dst); TEST_CYCLE() { cv::gpu::columnSum(src, dst); } }
GPU_PERF_TEST(Integral_Sqr, cv::gpu::DeviceInfo, cv::Size) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); cv::Mat src_host(size, CV_8UC1); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::sqrIntegral(src, dst); TEST_CYCLE() { cv::gpu::sqrIntegral(src, dst); } }
GPU_PERF_TEST(Transpose, cv::gpu::DeviceInfo, cv::Size, perf::MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src_host(size, type); declare.in(src_host, WARMUP_RNG); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; TEST_CYCLE() { cv::gpu::transpose(src, dst); } }
GPU_PERF_TEST(LUT, cv::gpu::DeviceInfo, cv::Size, perf::MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src_host(size, type); cv::Mat lut(1, 256, CV_8UC1); declare.in(src_host, lut, WARMUP_RNG); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; TEST_CYCLE() { cv::gpu::LUT(src, lut, dst); } }
GPU_PERF_TEST(CountNonZero, cv::gpu::DeviceInfo, cv::Size, perf::MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src_host(size, type); fill(src_host, 0.0, 1.0); cv::gpu::GpuMat src(src_host); int dst; cv::gpu::GpuMat buf; TEST_CYCLE() { dst = cv::gpu::countNonZero(src, buf); } }
GPU_PERF_TEST(MeanStdDev, cv::gpu::DeviceInfo, cv::Size) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::Size size = GET_PARAM(1); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src_host(size, CV_8UC1); declare.in(src_host, WARMUP_RNG); cv::gpu::GpuMat src(src_host); cv::Scalar mean; cv::Scalar stddev; cv::gpu::GpuMat buf; TEST_CYCLE() { cv::gpu::meanStdDev(src, mean, stddev, buf); } }
GPU_PERF_TEST(PyrUp, cv::gpu::DeviceInfo, cv::Size, MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::Mat src_host(size, type); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::pyrUp(src, dst); TEST_CYCLE() { cv::gpu::pyrUp(src, dst); } }
GPU_PERF_TEST(Sum, cv::gpu::DeviceInfo, cv::Size, perf::MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src_host(size, type); declare.in(src_host, WARMUP_RNG); cv::gpu::GpuMat src(src_host); cv::Scalar dst; cv::gpu::GpuMat buf; TEST_CYCLE() { dst = cv::gpu::sum(src, buf); } }
GPU_PERF_TEST(CalcHist, cv::gpu::DeviceInfo, cv::Size) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); cv::Mat src_host(size, CV_8UC1); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat hist; cv::gpu::GpuMat buf; cv::gpu::calcHist(src, hist, buf); TEST_CYCLE() { cv::gpu::calcHist(src, hist, buf); } }
GPU_PERF_TEST(BitwiseScalarAnd, cv::gpu::DeviceInfo, cv::Size, perf::MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src_host(size, type); declare.in(src_host, WARMUP_RNG); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::Scalar sc = cv::Scalar(123, 123, 123, 123); TEST_CYCLE() { cv::gpu::bitwise_and(src, sc, dst); } }
GPU_PERF_TEST(AddScalar, cv::gpu::DeviceInfo, cv::Size, perf::MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src_host(size, type); fill(src_host, 0.0, 100.0); cv::gpu::GpuMat src(src_host); cv::Scalar s(1,2,3,4); cv::gpu::GpuMat dst; TEST_CYCLE() { cv::gpu::add(src, s, dst); } }
GPU_PERF_TEST(MinMax, cv::gpu::DeviceInfo, cv::Size, perf::MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src_host(size, type); declare.in(src_host, WARMUP_RNG); cv::gpu::GpuMat src(src_host); double minVal, maxVal; cv::gpu::GpuMat buf; TEST_CYCLE() { cv::gpu::minMax(src, &minVal, &maxVal, cv::gpu::GpuMat(), buf); } }
GPU_PERF_TEST(SwapChannels, cv::gpu::DeviceInfo, cv::Size) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); cv::Mat src_host(size, CV_8UC4); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); const int dstOrder[] = {2, 1, 0, 3}; cv::gpu::swapChannels(src, dstOrder); TEST_CYCLE() { cv::gpu::swapChannels(src, dstOrder); } }
GPU_PERF_TEST(ImagePyramid_build, cv::gpu::DeviceInfo, cv::Size, MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::Mat src_host(size, type); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::ImagePyramid pyr; pyr.build(src, 5); TEST_CYCLE() { pyr.build(src, 5); } }
GPU_PERF_TEST(HistEven_OneChannel, cv::gpu::DeviceInfo, cv::Size, MatDepth) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int depth = GET_PARAM(2); cv::Mat src_host(size, depth); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat hist; cv::gpu::GpuMat buf; cv::gpu::histEven(src, hist, buf, 30, 0, 180); TEST_CYCLE() { cv::gpu::histEven(src, hist, buf, 30, 0, 180); } }
GPU_PERF_TEST(TransformPoints, cv::gpu::DeviceInfo, Count) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); int count = GET_PARAM(1); cv::Mat src_host(1, count, CV_32FC3); fill(src_host, -100, 100); cv::gpu::GpuMat src(src_host); cv::Mat rvec = cv::Mat::ones(1, 3, CV_32FC1); cv::Mat tvec = cv::Mat::ones(1, 3, CV_32FC1); cv::gpu::GpuMat dst; cv::gpu::transformPoints(src, rvec, tvec, dst); TEST_CYCLE() { cv::gpu::transformPoints(src, rvec, tvec, dst); } }
GPU_PERF_TEST(Threshold, cv::gpu::DeviceInfo, cv::Size, MatDepth, ThreshOp) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int depth = GET_PARAM(2); int threshOp = GET_PARAM(3); cv::Mat src_host(size, depth); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::threshold(src, dst, 100.0, 255.0, threshOp); TEST_CYCLE() { cv::gpu::threshold(src, dst, 100.0, 255.0, threshOp); } }
GPU_PERF_TEST(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, BorderMode) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); int borderType = GET_PARAM(3); cv::Mat src_host(size, type); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType); TEST_CYCLE() { cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType); } }
GPU_PERF_TEST(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); int ksize = GET_PARAM(3); cv::Mat src_host(size, type); fill(src_host, 0.0, 255.0); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::blur(src, dst, cv::Size(ksize, ksize)); TEST_CYCLE() { cv::gpu::blur(src, dst, cv::Size(ksize, ksize)); } }
GPU_PERF_TEST(Rotate, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); int interpolation = GET_PARAM(3); cv::Mat src_host(size, type); fill(src_host, 0, 255); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::rotate(src, dst, size, 30.0, 0, 0, interpolation); TEST_CYCLE() { cv::gpu::rotate(src, dst, size, 30.0, 0, 0, interpolation); } }
GPU_PERF_TEST(Scharr, cv::gpu::DeviceInfo, cv::Size, MatType) { cv::gpu::DeviceInfo devInfo = GET_PARAM(0); cv::gpu::setDevice(devInfo.deviceID()); cv::Size size = GET_PARAM(1); int type = GET_PARAM(2); cv::Mat src_host(size, type); fill(src_host, 0.0, 255.0); cv::gpu::GpuMat src(src_host); cv::gpu::GpuMat dst; cv::gpu::GpuMat buf; cv::gpu::Scharr(src, dst, -1, 1, 0, buf); TEST_CYCLE() { cv::gpu::Scharr(src, dst, -1, 1, 0, buf); } }