Commit 1d579116 authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

updated gpu-vs-cpu performance tests

parent ddf7fde3
...@@ -513,7 +513,7 @@ macro(ocv_add_precompiled_headers the_target) ...@@ -513,7 +513,7 @@ macro(ocv_add_precompiled_headers the_target)
if("${the_target}" MATCHES "^opencv_test_.*$") if("${the_target}" MATCHES "^opencv_test_.*$")
SET(pch_path "test/test_") SET(pch_path "test/test_")
elseif("${the_target}" MATCHES "opencv_perf_gpu_cpu") elseif("${the_target}" MATCHES "opencv_perf_gpu_cpu")
SET(pch_path "perf_cpu/perf_") SET(pch_path "perf_cpu/perf_cpu_")
elseif("${the_target}" MATCHES "^opencv_perf_.*$") elseif("${the_target}" MATCHES "^opencv_perf_.*$")
SET(pch_path "perf/perf_") SET(pch_path "perf/perf_")
else() else()
......
...@@ -125,7 +125,7 @@ ocv_add_perf_tests() ...@@ -125,7 +125,7 @@ ocv_add_perf_tests()
set(perf_cpu_path "${CMAKE_CURRENT_SOURCE_DIR}/perf_cpu") set(perf_cpu_path "${CMAKE_CURRENT_SOURCE_DIR}/perf_cpu")
if(BUILD_PERF_TESTS AND EXISTS "${perf_cpu_path}") if(BUILD_PERF_TESTS AND EXISTS "${perf_cpu_path}")
# opencv_highgui is required for imread/imwrite # opencv_highgui is required for imread/imwrite
set(perf_deps ${the_module} opencv_ts opencv_highgui) set(perf_deps ${the_module} opencv_ts opencv_highgui opencv_imgproc opencv_calib3d opencv_objdetect opencv_video opencv_nonfree)
ocv_check_dependencies(${perf_deps}) ocv_check_dependencies(${perf_deps})
if(OCV_DEPENDENCIES_FOUND) if(OCV_DEPENDENCIES_FOUND)
......
This diff is collapsed.
#include "perf_precomp.hpp" #include "perf_cpu_precomp.hpp"
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
//////////////////////////////////////////////////////////////////////
// TransformPoints
GPU_PERF_TEST_1(TransformPoints, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat src_host(1, 10000, CV_32FC3);
declare.in(src_host, WARMUP_RNG);
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
TEST_CYCLE()
{
cv::gpu::transformPoints(src, cv::Mat::ones(1, 3, CV_32FC1), cv::Mat::ones(1, 3, CV_32FC1), dst);
}
}
INSTANTIATE_TEST_CASE_P(Calib3D, TransformPoints, ALL_DEVICES);
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// ProjectPoints // ProjectPoints
GPU_PERF_TEST_1(ProjectPoints, cv::gpu::DeviceInfo) GPU_PERF_TEST_1(ProjectPoints, cv::gpu::DeviceInfo)
{ {
cv::gpu::DeviceInfo devInfo = GetParam(); cv::Mat src(1, 10000, CV_32FC3);
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat src_host(1, 10000, CV_32FC3); declare.in(src, WARMUP_RNG);
declare.in(src_host, WARMUP_RNG); cv::Mat dst;
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
TEST_CYCLE() TEST_CYCLE()
{ {
cv::gpu::projectPoints(src, cv::Mat::ones(1, 3, CV_32FC1), cv::Mat::ones(1, 3, CV_32FC1), cv::Mat::ones(3, 3, CV_32FC1), cv::Mat(), dst); cv::projectPoints(src, cv::Mat::ones(1, 3, CV_32FC1), cv::Mat::ones(1, 3, CV_32FC1), cv::Mat::ones(3, 3, CV_32FC1), cv::Mat(), dst);
} }
} }
...@@ -55,10 +26,6 @@ INSTANTIATE_TEST_CASE_P(Calib3D, ProjectPoints, ALL_DEVICES); ...@@ -55,10 +26,6 @@ INSTANTIATE_TEST_CASE_P(Calib3D, ProjectPoints, ALL_DEVICES);
GPU_PERF_TEST_1(SolvePnPRansac, cv::gpu::DeviceInfo) GPU_PERF_TEST_1(SolvePnPRansac, cv::gpu::DeviceInfo)
{ {
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat object(1, 10000, CV_32FC3); cv::Mat object(1, 10000, CV_32FC3);
cv::Mat image(1, 10000, CV_32FC2); cv::Mat image(1, 10000, CV_32FC2);
...@@ -70,7 +37,7 @@ GPU_PERF_TEST_1(SolvePnPRansac, cv::gpu::DeviceInfo) ...@@ -70,7 +37,7 @@ GPU_PERF_TEST_1(SolvePnPRansac, cv::gpu::DeviceInfo)
TEST_CYCLE() TEST_CYCLE()
{ {
cv::gpu::solvePnPRansac(object, image, cv::Mat::ones(3, 3, CV_32FC1), cv::Mat(1, 8, CV_32F, cv::Scalar::all(0)), rvec, tvec); cv::solvePnPRansac(object, image, cv::Mat::ones(3, 3, CV_32FC1), cv::Mat(1, 8, CV_32F, cv::Scalar::all(0)), rvec, tvec);
} }
} }
...@@ -81,21 +48,15 @@ INSTANTIATE_TEST_CASE_P(Calib3D, SolvePnPRansac, ALL_DEVICES); ...@@ -81,21 +48,15 @@ INSTANTIATE_TEST_CASE_P(Calib3D, SolvePnPRansac, ALL_DEVICES);
GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo) GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo)
{ {
cv::gpu::DeviceInfo devInfo = GetParam(); cv::Mat img_l = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
cv::Mat img_r = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img_l_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
cv::Mat img_r_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img_l_host.empty()); ASSERT_FALSE(img_l.empty());
ASSERT_FALSE(img_r_host.empty()); ASSERT_FALSE(img_r.empty());
cv::gpu::GpuMat img_l(img_l_host); cv::Mat dst;
cv::gpu::GpuMat img_r(img_r_host);
cv::gpu::GpuMat dst;
cv::gpu::StereoBM_GPU bm(0, 256); cv::StereoBM bm(0, 256);
declare.time(5.0); declare.time(5.0);
...@@ -107,96 +68,5 @@ GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo) ...@@ -107,96 +68,5 @@ GPU_PERF_TEST_1(StereoBM, cv::gpu::DeviceInfo)
INSTANTIATE_TEST_CASE_P(Calib3D, StereoBM, ALL_DEVICES); INSTANTIATE_TEST_CASE_P(Calib3D, StereoBM, ALL_DEVICES);
//////////////////////////////////////////////////////////////////////
// StereoBeliefPropagation
GPU_PERF_TEST_1(StereoBeliefPropagation, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img_l_host = readImage("gpu/stereobp/aloe-L.png");
cv::Mat img_r_host = readImage("gpu/stereobp/aloe-R.png");
ASSERT_FALSE(img_l_host.empty());
ASSERT_FALSE(img_r_host.empty());
cv::gpu::GpuMat img_l(img_l_host);
cv::gpu::GpuMat img_r(img_r_host);
cv::gpu::GpuMat dst;
cv::gpu::StereoBeliefPropagation bp(64);
declare.time(10.0);
TEST_CYCLE()
{
bp(img_l, img_r, dst);
}
}
INSTANTIATE_TEST_CASE_P(Calib3D, StereoBeliefPropagation, ALL_DEVICES);
//////////////////////////////////////////////////////////////////////
// StereoConstantSpaceBP
GPU_PERF_TEST_1(StereoConstantSpaceBP, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img_l_host = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
cv::Mat img_r_host = readImage("gpu/stereobm/aloe-R.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img_l_host.empty());
ASSERT_FALSE(img_r_host.empty());
cv::gpu::GpuMat img_l(img_l_host);
cv::gpu::GpuMat img_r(img_r_host);
cv::gpu::GpuMat dst;
cv::gpu::StereoConstantSpaceBP bp(128);
declare.time(10.0);
TEST_CYCLE()
{
bp(img_l, img_r, dst);
}
}
INSTANTIATE_TEST_CASE_P(Calib3D, StereoConstantSpaceBP, ALL_DEVICES);
//////////////////////////////////////////////////////////////////////
// DisparityBilateralFilter
GPU_PERF_TEST_1(DisparityBilateralFilter, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img_host = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
cv::Mat disp_host = readImage("gpu/stereobm/aloe-disp.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img_host.empty());
ASSERT_FALSE(disp_host.empty());
cv::gpu::GpuMat img(img_host);
cv::gpu::GpuMat disp(disp_host);
cv::gpu::GpuMat dst;
cv::gpu::DisparityBilateralFilter f(128);
TEST_CYCLE()
{
f(disp, img, dst);
}
}
INSTANTIATE_TEST_CASE_P(Calib3D, DisparityBilateralFilter, ALL_DEVICES);
#endif #endif
#include "perf_cpu_precomp.hpp"
#ifndef __OPENCV_PERF_PRECOMP_HPP__ #ifndef __OPENCV_PERF_CPU_PRECOMP_HPP__
#define __OPENCV_PERF_PRECOMP_HPP__ #define __OPENCV_PERF_CPU_PRECOMP_HPP__
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
#include "cvconfig.h" #include "cvconfig.h"
#include "opencv2/ts/ts.hpp" #include "opencv2/ts/ts.hpp"
#include "opencv2/ts/ts_perf.hpp" #include "opencv2/ts/ts_perf.hpp"
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp" #include "opencv2/highgui/highgui.hpp"
#include "opencv2/gpu/gpu.hpp" #include "opencv2/gpu/gpu.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/video/video.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "perf_utility.hpp" #include "perf_utility.hpp"
#if GTEST_CREATE_SHARED_LIBRARY #if GTEST_CREATE_SHARED_LIBRARY
......
#include "perf_precomp.hpp" #include "perf_cpu_precomp.hpp"
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
...@@ -7,27 +7,21 @@ ...@@ -7,27 +7,21 @@
GPU_PERF_TEST(BruteForceMatcher_match, cv::gpu::DeviceInfo, int) GPU_PERF_TEST(BruteForceMatcher_match, cv::gpu::DeviceInfo, int)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
int desc_size = GET_PARAM(1); int desc_size = GET_PARAM(1);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat query(3000, desc_size, CV_32FC1);
cv::Mat train(3000, desc_size, CV_32FC1);
cv::Mat query_host(3000, desc_size, CV_32FC1); declare.in(query, train, WARMUP_RNG);
cv::Mat train_host(3000, desc_size, CV_32FC1);
declare.in(query_host, train_host, WARMUP_RNG); cv::BFMatcher matcher(cv::NORM_L2);
std::vector<cv::DMatch> matches;
cv::gpu::GpuMat query(query_host); declare.time(10.0);
cv::gpu::GpuMat train(train_host);
cv::gpu::GpuMat trainIdx, distance;
cv::gpu::BFMatcher_GPU matcher(cv::NORM_L2);
declare.time(3.0);
TEST_CYCLE() TEST_CYCLE()
{ {
matcher.matchSingle(query, train, trainIdx, distance); matcher.match(query, train, matches);
} }
} }
...@@ -40,28 +34,22 @@ INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_match, testing::Combine( ...@@ -40,28 +34,22 @@ INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_match, testing::Combine(
GPU_PERF_TEST(BruteForceMatcher_knnMatch, cv::gpu::DeviceInfo, int, int) GPU_PERF_TEST(BruteForceMatcher_knnMatch, cv::gpu::DeviceInfo, int, int)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
int desc_size = GET_PARAM(1); int desc_size = GET_PARAM(1);
int k = GET_PARAM(2); int k = GET_PARAM(2);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat query(3000, desc_size, CV_32FC1);
cv::Mat train(3000, desc_size, CV_32FC1);
cv::Mat query_host(3000, desc_size, CV_32FC1);
cv::Mat train_host(3000, desc_size, CV_32FC1);
declare.in(query_host, train_host, WARMUP_RNG);
cv::gpu::GpuMat query(query_host); declare.in(query, train, WARMUP_RNG);
cv::gpu::GpuMat train(train_host);
cv::gpu::GpuMat trainIdx, distance, allDist;
cv::gpu::BFMatcher_GPU matcher(cv::NORM_L2); cv::BFMatcher matcher(cv::NORM_L2);
std::vector< std::vector<cv::DMatch> > matches;
declare.time(3.0); declare.time(10.0);
TEST_CYCLE() TEST_CYCLE()
{ {
matcher.knnMatchSingle(query, train, trainIdx, distance, allDist, k); matcher.knnMatch(query, train, matches, k);
} }
} }
...@@ -75,28 +63,22 @@ INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_knnMatch, testing::Combine ...@@ -75,28 +63,22 @@ INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_knnMatch, testing::Combine
GPU_PERF_TEST(BruteForceMatcher_radiusMatch, cv::gpu::DeviceInfo, int) GPU_PERF_TEST(BruteForceMatcher_radiusMatch, cv::gpu::DeviceInfo, int)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
int desc_size = GET_PARAM(1); int desc_size = GET_PARAM(1);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat query(3000, desc_size, CV_32FC1);
cv::Mat train(3000, desc_size, CV_32FC1);
cv::Mat query_host(3000, desc_size, CV_32FC1); fill(query, 0, 1);
cv::Mat train_host(3000, desc_size, CV_32FC1); fill(train, 0, 1);
fill(query_host, 0, 1); cv::BFMatcher matcher(cv::NORM_L2);
fill(train_host, 0, 1); std::vector< std::vector<cv::DMatch> > matches;
cv::gpu::GpuMat query(query_host); declare.time(10.0);
cv::gpu::GpuMat train(train_host);
cv::gpu::GpuMat trainIdx, nMatches, distance;
cv::gpu::BFMatcher_GPU matcher(cv::NORM_L2);
declare.time(3.0);
TEST_CYCLE() TEST_CYCLE()
{ {
matcher.radiusMatchSingle(query, train, trainIdx, distance, nMatches, 2.0); matcher.radiusMatch(query, train, matches, 2.0);
} }
} }
...@@ -109,24 +91,20 @@ INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_radiusMatch, testing::Comb ...@@ -109,24 +91,20 @@ INSTANTIATE_TEST_CASE_P(Features2D, BruteForceMatcher_radiusMatch, testing::Comb
GPU_PERF_TEST_1(SURF, cv::gpu::DeviceInfo) GPU_PERF_TEST_1(SURF, cv::gpu::DeviceInfo)
{ {
cv::gpu::DeviceInfo devInfo = GetParam(); cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img.empty());
ASSERT_FALSE(img_host.empty()); std::vector<cv::KeyPoint> keypoints;
cv::Mat descriptors;
cv::gpu::GpuMat img(img_host); cv::SURF surf;
cv::gpu::GpuMat keypoints, descriptors;
cv::gpu::SURF_GPU surf; declare.time(10.0);
declare.time(2.0);
TEST_CYCLE() TEST_CYCLE()
{ {
surf(img, cv::gpu::GpuMat(), keypoints, descriptors); surf(img, cv::noArray(), keypoints, descriptors);
} }
} }
...@@ -137,22 +115,15 @@ INSTANTIATE_TEST_CASE_P(Features2D, SURF, DEVICES(cv::gpu::GLOBAL_ATOMICS)); ...@@ -137,22 +115,15 @@ INSTANTIATE_TEST_CASE_P(Features2D, SURF, DEVICES(cv::gpu::GLOBAL_ATOMICS));
GPU_PERF_TEST_1(FAST, cv::gpu::DeviceInfo) GPU_PERF_TEST_1(FAST, cv::gpu::DeviceInfo)
{ {
cv::gpu::DeviceInfo devInfo = GetParam(); cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img_host.empty()); ASSERT_FALSE(img.empty());
cv::gpu::GpuMat img(img_host); std::vector<cv::KeyPoint> keypoints;
cv::gpu::GpuMat keypoints, descriptors;
cv::gpu::FAST_GPU fastGPU(20);
TEST_CYCLE() TEST_CYCLE()
{ {
fastGPU(img, cv::gpu::GpuMat(), keypoints); cv::FAST(img, keypoints, 20);
} }
} }
...@@ -163,22 +134,18 @@ INSTANTIATE_TEST_CASE_P(Features2D, FAST, DEVICES(cv::gpu::GLOBAL_ATOMICS)); ...@@ -163,22 +134,18 @@ INSTANTIATE_TEST_CASE_P(Features2D, FAST, DEVICES(cv::gpu::GLOBAL_ATOMICS));
GPU_PERF_TEST_1(ORB, cv::gpu::DeviceInfo) GPU_PERF_TEST_1(ORB, cv::gpu::DeviceInfo)
{ {
cv::gpu::DeviceInfo devInfo = GetParam(); cv::Mat img = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(img_host.empty()); ASSERT_FALSE(img.empty());
cv::gpu::GpuMat img(img_host); std::vector<cv::KeyPoint> keypoints;
cv::gpu::GpuMat keypoints, descriptors; cv::Mat descriptors;
cv::gpu::ORB_GPU orbGPU(4000); cv::ORB orb(4000);
TEST_CYCLE() TEST_CYCLE()
{ {
orbGPU(img, cv::gpu::GpuMat(), keypoints, descriptors); orb(img, cv::noArray(), keypoints, descriptors);
} }
} }
......
#include "perf_precomp.hpp" #include "perf_cpu_precomp.hpp"
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
...@@ -7,21 +7,17 @@ ...@@ -7,21 +7,17 @@
GPU_PERF_TEST(BoxFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int) GPU_PERF_TEST(BoxFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2); int type = GET_PARAM(2);
int ksize = GET_PARAM(3); int ksize = GET_PARAM(3);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src(size, type);
cv::Mat src_host(size, type); declare.in(src, WARMUP_RNG);
declare.in(src_host, WARMUP_RNG); cv::Mat dst(src.size(), src.type());
cv::gpu::GpuMat src(src_host); cv::Ptr<cv::FilterEngine> filter = cv::createBoxFilter(type, type, cv::Size(ksize, ksize));
cv::gpu::GpuMat dst;
cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createBoxFilter_GPU(type, type, cv::Size(ksize, ksize));
TEST_CYCLE() TEST_CYCLE()
{ {
...@@ -40,22 +36,18 @@ INSTANTIATE_TEST_CASE_P(Filter, BoxFilter, testing::Combine( ...@@ -40,22 +36,18 @@ INSTANTIATE_TEST_CASE_P(Filter, BoxFilter, testing::Combine(
GPU_PERF_TEST(MorphologyFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, MorphOp, int) GPU_PERF_TEST(MorphologyFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, MorphOp, int)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2); int type = GET_PARAM(2);
int op = GET_PARAM(3); int op = GET_PARAM(3);
int ksize = GET_PARAM(4); int ksize = GET_PARAM(4);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src(size, type);
cv::Mat src_host(size, type);
declare.in(src_host, WARMUP_RNG); declare.in(src, WARMUP_RNG);
cv::gpu::GpuMat src(src_host); cv::Mat dst(src.size(), src.type());
cv::gpu::GpuMat dst;
cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createMorphologyFilter_GPU(op, type, cv::Mat::ones(ksize, ksize, CV_8U)); cv::Ptr<cv::FilterEngine> filter = cv::createMorphologyFilter(op, type, cv::Mat::ones(ksize, ksize, CV_8U));
TEST_CYCLE() TEST_CYCLE()
{ {
...@@ -75,21 +67,17 @@ INSTANTIATE_TEST_CASE_P(Filter, MorphologyFilter, testing::Combine( ...@@ -75,21 +67,17 @@ INSTANTIATE_TEST_CASE_P(Filter, MorphologyFilter, testing::Combine(
GPU_PERF_TEST(LinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int) GPU_PERF_TEST(LinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2); int type = GET_PARAM(2);
int ksize = GET_PARAM(3); int ksize = GET_PARAM(3);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src(size, type);
cv::Mat src_host(size, type);
declare.in(src_host, WARMUP_RNG); declare.in(src, WARMUP_RNG);
cv::gpu::GpuMat src(src_host); cv::Mat dst(src.size(), src.type());
cv::gpu::GpuMat dst;
cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createLinearFilter_GPU(type, type, cv::Mat::ones(ksize, ksize, CV_8U)); cv::Ptr<cv::FilterEngine> filter = cv::createLinearFilter(type, type, cv::Mat::ones(ksize, ksize, CV_8U));
declare.time(1.0); declare.time(1.0);
...@@ -110,28 +98,24 @@ INSTANTIATE_TEST_CASE_P(Filter, LinearFilter, testing::Combine( ...@@ -110,28 +98,24 @@ INSTANTIATE_TEST_CASE_P(Filter, LinearFilter, testing::Combine(
GPU_PERF_TEST(SeparableLinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int) GPU_PERF_TEST(SeparableLinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2); int type = GET_PARAM(2);
int ksize = GET_PARAM(3); int ksize = GET_PARAM(3);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src(size, type);
cv::Mat src_host(size, type); declare.in(src, WARMUP_RNG);
declare.in(src_host, WARMUP_RNG); cv::Mat dst(src.size(), src.type());
cv::gpu::GpuMat src(src_host);
cv::gpu::GpuMat dst;
cv::Mat kernel = cv::getGaussianKernel(ksize, 0.5, CV_32F); cv::Mat kernel = cv::getGaussianKernel(ksize, 0.5, CV_32F);
cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createSeparableLinearFilter_GPU(type, type, kernel, kernel); cv::Ptr<cv::FilterEngine> filter = cv::createSeparableLinearFilter(type, type, kernel, kernel);
declare.time(1.0); declare.time(1.0);
TEST_CYCLE() TEST_CYCLE()
{ {
filter->apply(src, dst, cv::Rect(0, 0, src.cols, src.rows)); filter->apply(src, dst);
} }
} }
......
This diff is collapsed.
#include "perf_precomp.hpp" #include "perf_cpu_precomp.hpp"
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
......
#include "perf_precomp.hpp" #include "perf_cpu_precomp.hpp"
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
...@@ -7,23 +7,20 @@ ...@@ -7,23 +7,20 @@
GPU_PERF_TEST(Merge, cv::gpu::DeviceInfo, cv::Size, perf::MatType) GPU_PERF_TEST(Merge, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2); int type = GET_PARAM(2);
cv::gpu::setDevice(devInfo.deviceID());
const int num_channels = 4; const int num_channels = 4;
std::vector<cv::gpu::GpuMat> src(num_channels); std::vector<cv::Mat> src(num_channels);
for (int i = 0; i < num_channels; ++i) for (int i = 0; i < num_channels; ++i)
src[i] = cv::gpu::GpuMat(size, type, cv::Scalar::all(i)); src[i] = cv::Mat(size, type, cv::Scalar::all(i));
cv::gpu::GpuMat dst; cv::Mat dst;
TEST_CYCLE() TEST_CYCLE()
{ {
cv::gpu::merge(src, dst); cv::merge(src, dst);
} }
} }
...@@ -37,23 +34,20 @@ INSTANTIATE_TEST_CASE_P(MatOp, Merge, testing::Combine( ...@@ -37,23 +34,20 @@ INSTANTIATE_TEST_CASE_P(MatOp, Merge, testing::Combine(
GPU_PERF_TEST(Split, cv::gpu::DeviceInfo, cv::Size, perf::MatType) GPU_PERF_TEST(Split, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2); int type = GET_PARAM(2);
cv::gpu::setDevice(devInfo.deviceID());
const int num_channels = 4; const int num_channels = 4;
cv::gpu::GpuMat src(size, CV_MAKETYPE(type, num_channels), cv::Scalar(1, 2, 3, 4)); cv::Mat src(size, CV_MAKETYPE(type, num_channels), cv::Scalar(1, 2, 3, 4));
std::vector<cv::gpu::GpuMat> dst(num_channels); std::vector<cv::Mat> dst(num_channels);
for (int i = 0; i < num_channels; ++i) for (int i = 0; i < num_channels; ++i)
dst[i] = cv::gpu::GpuMat(size, type); dst[i] = cv::Mat(size, type);
TEST_CYCLE() TEST_CYCLE()
{ {
cv::gpu::split(src, dst); cv::split(src, dst);
} }
} }
...@@ -67,13 +61,10 @@ INSTANTIATE_TEST_CASE_P(MatOp, Split, testing::Combine( ...@@ -67,13 +61,10 @@ INSTANTIATE_TEST_CASE_P(MatOp, Split, testing::Combine(
GPU_PERF_TEST(SetTo, cv::gpu::DeviceInfo, cv::Size, perf::MatType) GPU_PERF_TEST(SetTo, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2); int type = GET_PARAM(2);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src(size, type);
cv::gpu::GpuMat src(size, type);
cv::Scalar val(1, 2, 3, 4); cv::Scalar val(1, 2, 3, 4);
TEST_CYCLE() TEST_CYCLE()
...@@ -92,21 +83,16 @@ INSTANTIATE_TEST_CASE_P(MatOp, SetTo, testing::Combine( ...@@ -92,21 +83,16 @@ INSTANTIATE_TEST_CASE_P(MatOp, SetTo, testing::Combine(
GPU_PERF_TEST(SetToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType) GPU_PERF_TEST(SetToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2); int type = GET_PARAM(2);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src(size, type);
cv::Mat mask(size, CV_8UC1);
cv::Mat src_host(size, type); declare.in(src, WARMUP_RNG);
cv::Mat mask_host(size, CV_8UC1); fill(mask, 0, 2);
declare.in(src_host, WARMUP_RNG);
fill(mask_host, 0, 2);
cv::gpu::GpuMat src(src_host);
cv::Scalar val(1, 2, 3, 4); cv::Scalar val(1, 2, 3, 4);
cv::gpu::GpuMat mask(mask_host);
TEST_CYCLE() TEST_CYCLE()
{ {
...@@ -124,21 +110,16 @@ INSTANTIATE_TEST_CASE_P(MatOp, SetToMasked, testing::Combine( ...@@ -124,21 +110,16 @@ INSTANTIATE_TEST_CASE_P(MatOp, SetToMasked, testing::Combine(
GPU_PERF_TEST(CopyToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType) GPU_PERF_TEST(CopyToMasked, cv::gpu::DeviceInfo, cv::Size, perf::MatType)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type = GET_PARAM(2); int type = GET_PARAM(2);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src(size, type);
cv::Mat mask(size, CV_8UC1);
cv::Mat src_host(size, type);
cv::Mat mask_host(size, CV_8UC1);
declare.in(src_host, WARMUP_RNG); declare.in(src, WARMUP_RNG);
fill(mask_host, 0, 2); fill(mask, 0, 2);
cv::gpu::GpuMat src(src_host); cv::Mat dst;
cv::gpu::GpuMat mask(mask_host);
cv::gpu::GpuMat dst;
TEST_CYCLE() TEST_CYCLE()
{ {
...@@ -156,19 +137,15 @@ INSTANTIATE_TEST_CASE_P(MatOp, CopyToMasked, testing::Combine( ...@@ -156,19 +137,15 @@ INSTANTIATE_TEST_CASE_P(MatOp, CopyToMasked, testing::Combine(
GPU_PERF_TEST(ConvertTo, cv::gpu::DeviceInfo, cv::Size, perf::MatType, perf::MatType) GPU_PERF_TEST(ConvertTo, cv::gpu::DeviceInfo, cv::Size, perf::MatType, perf::MatType)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
cv::Size size = GET_PARAM(1); cv::Size size = GET_PARAM(1);
int type1 = GET_PARAM(2); int type1 = GET_PARAM(2);
int type2 = GET_PARAM(3); int type2 = GET_PARAM(3);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat src(size, type1);
cv::Mat src_host(size, type1);
declare.in(src_host, WARMUP_RNG); declare.in(src, WARMUP_RNG);
cv::gpu::GpuMat src(src_host); cv::Mat dst;
cv::gpu::GpuMat dst;
TEST_CYCLE() TEST_CYCLE()
{ {
......
#include "perf_precomp.hpp" #include "perf_cpu_precomp.hpp"
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
GPU_PERF_TEST_1(HOG, cv::gpu::DeviceInfo) GPU_PERF_TEST_1(HOG, cv::gpu::DeviceInfo)
{ {
cv::gpu::DeviceInfo devInfo = GetParam(); cv::Mat img = readImage("gpu/hog/road.png", cv::IMREAD_GRAYSCALE);
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat img_host = readImage("gpu/hog/road.png", cv::IMREAD_GRAYSCALE);
cv::gpu::GpuMat img(img_host);
std::vector<cv::Rect> found_locations; std::vector<cv::Rect> found_locations;
cv::gpu::HOGDescriptor hog; cv::HOGDescriptor hog;
hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector()); hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector());
TEST_CYCLE() TEST_CYCLE()
......
#include "perf_precomp.hpp" #include "perf_cpu_precomp.hpp"
using namespace std; using namespace std;
using namespace cv; using namespace cv;
......
#include "perf_precomp.hpp" #include "perf_cpu_precomp.hpp"
#ifdef HAVE_CUDA #ifdef HAVE_CUDA
//////////////////////////////////////////////////////
// BroxOpticalFlow
GPU_PERF_TEST_1(BroxOpticalFlow, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat frame0_host = readImage("gpu/opticalflow/frame0.png", cv::IMREAD_GRAYSCALE);
cv::Mat frame1_host = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame0_host.empty());
ASSERT_FALSE(frame1_host.empty());
frame0_host.convertTo(frame0_host, CV_32FC1, 1.0 / 255.0);
frame1_host.convertTo(frame1_host, CV_32FC1, 1.0 / 255.0);
cv::gpu::GpuMat frame0(frame0_host);
cv::gpu::GpuMat frame1(frame1_host);
cv::gpu::GpuMat u;
cv::gpu::GpuMat v;
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);
declare.time(10);
TEST_CYCLE()
{
d_flow(frame0, frame1, u, v);
}
}
INSTANTIATE_TEST_CASE_P(Video, BroxOpticalFlow, ALL_DEVICES);
//////////////////////////////////////////////////////
// InterpolateFrames
GPU_PERF_TEST_1(InterpolateFrames, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat frame0_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
cv::Mat frame1_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame0_host.empty());
ASSERT_FALSE(frame1_host.empty());
frame0_host.convertTo(frame0_host, CV_32FC1, 1.0 / 255.0);
frame1_host.convertTo(frame1_host, CV_32FC1, 1.0 / 255.0);
cv::gpu::GpuMat frame0(frame0_host);
cv::gpu::GpuMat frame1(frame1_host);
cv::gpu::GpuMat fu, fv;
cv::gpu::GpuMat bu, bv;
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);
d_flow(frame0, frame1, fu, fv);
d_flow(frame1, frame0, bu, bv);
cv::gpu::GpuMat newFrame;
cv::gpu::GpuMat buf;
TEST_CYCLE()
{
cv::gpu::interpolateFrames(frame0, frame1, fu, fv, bu, bv, 0.5f, newFrame, buf);
}
}
INSTANTIATE_TEST_CASE_P(Video, InterpolateFrames, ALL_DEVICES);
//////////////////////////////////////////////////////
// CreateOpticalFlowNeedleMap
GPU_PERF_TEST_1(CreateOpticalFlowNeedleMap, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat frame0_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
cv::Mat frame1_host = readImage("gpu/perf/aloeR.jpg", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame0_host.empty());
ASSERT_FALSE(frame1_host.empty());
frame0_host.convertTo(frame0_host, CV_32FC1, 1.0 / 255.0);
frame1_host.convertTo(frame1_host, CV_32FC1, 1.0 / 255.0);
cv::gpu::GpuMat frame0(frame0_host);
cv::gpu::GpuMat frame1(frame1_host);
cv::gpu::GpuMat u, v;
cv::gpu::BroxOpticalFlow d_flow(0.197f /*alpha*/, 50.0f /*gamma*/, 0.8f /*scale_factor*/,
10 /*inner_iterations*/, 77 /*outer_iterations*/, 10 /*solver_iterations*/);
d_flow(frame0, frame1, u, v);
cv::gpu::GpuMat vertex, colors;
TEST_CYCLE()
{
cv::gpu::createOpticalFlowNeedleMap(u, v, vertex, colors);
}
}
INSTANTIATE_TEST_CASE_P(Video, CreateOpticalFlowNeedleMap, ALL_DEVICES);
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// GoodFeaturesToTrack // GoodFeaturesToTrack
GPU_PERF_TEST(GoodFeaturesToTrack, cv::gpu::DeviceInfo, double) GPU_PERF_TEST(GoodFeaturesToTrack, cv::gpu::DeviceInfo, double)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
double minDistance = GET_PARAM(1); double minDistance = GET_PARAM(1);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat image = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
cv::Mat image_host = readImage("gpu/perf/aloe.jpg", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(image_host.empty());
cv::gpu::GoodFeaturesToTrackDetector_GPU detector(8000, 0.01, minDistance); ASSERT_FALSE(image.empty());
cv::gpu::GpuMat image(image_host); cv::Mat corners;
cv::gpu::GpuMat pts;
TEST_CYCLE() TEST_CYCLE()
{ {
detector(image, pts); cv::goodFeaturesToTrack(image, corners, 8000, 0.01, minDistance);
} }
} }
...@@ -147,112 +28,66 @@ INSTANTIATE_TEST_CASE_P(Video, GoodFeaturesToTrack, testing::Combine(ALL_DEVICES ...@@ -147,112 +28,66 @@ INSTANTIATE_TEST_CASE_P(Video, GoodFeaturesToTrack, testing::Combine(ALL_DEVICES
GPU_PERF_TEST(PyrLKOpticalFlowSparse, cv::gpu::DeviceInfo, bool, int, int) GPU_PERF_TEST(PyrLKOpticalFlowSparse, cv::gpu::DeviceInfo, bool, int, int)
{ {
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
bool useGray = GET_PARAM(1); bool useGray = GET_PARAM(1);
int points = GET_PARAM(2); int points = GET_PARAM(2);
int win_size = GET_PARAM(3); int win_size = GET_PARAM(3);
cv::gpu::setDevice(devInfo.deviceID()); cv::Mat frame0 = readImage("gpu/opticalflow/frame0.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
cv::Mat frame1 = readImage("gpu/opticalflow/frame1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR);
cv::Mat frame0_host = readImage("gpu/opticalflow/frame0.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); ASSERT_FALSE(frame0.empty());
cv::Mat frame1_host = readImage("gpu/opticalflow/frame1.png", useGray ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR); ASSERT_FALSE(frame1.empty());
ASSERT_FALSE(frame0_host.empty());
ASSERT_FALSE(frame1_host.empty());
cv::Mat gray_frame; cv::Mat gray_frame;
if (useGray) if (useGray)
gray_frame = frame0_host; gray_frame = frame0;
else else
cv::cvtColor(frame0_host, gray_frame, cv::COLOR_BGR2GRAY); cv::cvtColor(frame0, gray_frame, cv::COLOR_BGR2GRAY);
cv::gpu::GpuMat pts;
cv::gpu::GoodFeaturesToTrackDetector_GPU detector(points, 0.01, 0.0);
detector(cv::gpu::GpuMat(gray_frame), pts);
cv::gpu::PyrLKOpticalFlow pyrLK; cv::Mat pts;
pyrLK.winSize = cv::Size(win_size, win_size); cv::goodFeaturesToTrack(gray_frame, pts, points, 0.01, 0.0);
cv::gpu::GpuMat frame0(frame0_host); cv::Mat nextPts;
cv::gpu::GpuMat frame1(frame1_host); cv::Mat status;
cv::gpu::GpuMat nextPts;
cv::gpu::GpuMat status;
TEST_CYCLE() TEST_CYCLE()
{ {
pyrLK.sparse(frame0, frame1, pts, nextPts, status); cv::calcOpticalFlowPyrLK(frame0, frame1, pts, nextPts, status, cv::noArray(), cv::Size(win_size, win_size));
} }
} }
INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowSparse, testing::Combine INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowSparse, testing::Combine(
(
ALL_DEVICES, ALL_DEVICES,
testing::Bool(), testing::Bool(),
testing::Values(1000, 2000, 4000, 8000), testing::Values(1000, 2000, 4000, 8000),
testing::Values(17, 21) testing::Values(17, 21)));
));
//////////////////////////////////////////////////////
// PyrLKOpticalFlowDense
GPU_PERF_TEST_1(PyrLKOpticalFlowDense, cv::gpu::DeviceInfo)
{
cv::gpu::DeviceInfo devInfo = GetParam();
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat frame0_host = readImage("gpu/opticalflow/frame0.png", cv::IMREAD_GRAYSCALE);
cv::Mat frame1_host = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame0_host.empty());
ASSERT_FALSE(frame1_host.empty());
cv::gpu::GpuMat frame0(frame0_host);
cv::gpu::GpuMat frame1(frame1_host);
cv::gpu::GpuMat u;
cv::gpu::GpuMat v;
cv::gpu::PyrLKOpticalFlow pyrLK;
declare.time(10);
TEST_CYCLE()
{
pyrLK.dense(frame0, frame1, u, v);
}
}
INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlowDense, ALL_DEVICES);
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// FarnebackOpticalFlowTest // FarnebackOpticalFlowTest
GPU_PERF_TEST_1(FarnebackOpticalFlowTest, cv::gpu::DeviceInfo) GPU_PERF_TEST_1(FarnebackOpticalFlowTest, cv::gpu::DeviceInfo)
{ {
cv::gpu::DeviceInfo devInfo = GetParam(); cv::Mat frame0 = readImage("gpu/opticalflow/frame0.png", cv::IMREAD_GRAYSCALE);
cv::Mat frame1 = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);
cv::gpu::setDevice(devInfo.deviceID());
cv::Mat frame0_host = readImage("gpu/opticalflow/frame0.png", cv::IMREAD_GRAYSCALE);
cv::Mat frame1_host = readImage("gpu/opticalflow/frame1.png", cv::IMREAD_GRAYSCALE);
ASSERT_FALSE(frame0_host.empty()); ASSERT_FALSE(frame0.empty());
ASSERT_FALSE(frame1_host.empty()); ASSERT_FALSE(frame1.empty());
cv::gpu::GpuMat frame0(frame0_host); cv::Mat flow;
cv::gpu::GpuMat frame1(frame1_host);
cv::gpu::GpuMat u;
cv::gpu::GpuMat v;
cv::gpu::FarnebackOpticalFlow calc;
declare.time(10); declare.time(10);
int numLevels = 5;
double pyrScale = 0.5;
int winSize = 13;
int numIters = 10;
int polyN = 5;
double polySigma = 1.1;
int flags = 0;
TEST_CYCLE() TEST_CYCLE()
{ {
calc(frame0, frame1, u, v); cv::calcOpticalFlowFarneback(frame0, frame1, flow, pyrScale, numLevels, winSize, numIters, polyN, polySigma, flags);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment