opencv/modules/gapi/test/cpu/gapi_video_tests_cpu.cpp
OrestChura d50c21e571 gapi: Full calcOpticalFlowPyrLK implementation (2 overloads) and tests
- opencv_gapi module is linked with opencv_video module (optional dependency)
     - kernels added to a new cv::gapi::video namespace and a brand new files created to provide gapi_video environment
     - there are 2 different kernels as G-API should provide GMat AND GArray<GMat> implementation: cv::calcOptFlowPyrLK doesn't calculate pyramids if vector<Mat> is given so just the cast GMat -> GArray<GMat> wouldn't represent all the cv:: functionality
     - tests to check both kernels (based on cv::video tests for cv::calcOpticalFlowPyrLK())
     - tests for internal purposes added
     - vectors<T> comparison in tests implemented
     - new (and old too) common test structures refactored to avoid code copypasting
     - "modules/gapi/test/common/gapi_video_tests_common.hpp" created to share some code snippets between perf and acc tests and avoid code copypasting
2020-04-08 18:11:55 +03:00

63 lines
3.0 KiB
C++

// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2020 Intel Corporation
#include "../test_precomp.hpp"
#include "../common/gapi_video_tests.hpp"
#include <opencv2/gapi/cpu/video.hpp>
namespace
{
#define VIDEO_CPU [] () { return cv::compile_args(cv::gapi::video::cpu::kernels()); }
#ifdef HAVE_OPENCV_VIDEO
#define WITH_VIDEO(X) X
#else
#define WITH_VIDEO(X) DISABLED_##X
#endif // HAVE_OPENCV_VIDEO
#define INSTANTIATE_TEST_CASE_MACRO_P(prefix, test_case_name, generator, ...) \
INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, __VA_ARGS__)
} // anonymous namespace
namespace opencv_test
{
INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(OptFlowLKTestCPU), OptFlowLKTest,
Combine(Values(VIDEO_CPU),
Values("cv/optflow/rock_%01d.bmp",
"cv/optflow/frames/1080p_%02d.png"),
Values(1, 3, 4),
Values(std::make_tuple(9, 9), std::make_tuple(15, 15)),
Values(7, 11),
Values(cv::TermCriteria(cv::TermCriteria::COUNT |
cv::TermCriteria::EPS,
30, 0.01))));
INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(OptFlowLKTestForPyrCPU), OptFlowLKTestForPyr,
Combine(Values(VIDEO_CPU),
Values("cv/optflow/rock_%01d.bmp",
"cv/optflow/frames/1080p_%02d.png"),
Values(1, 3, 4),
Values(std::make_tuple(9, 9), std::make_tuple(15, 15)),
Values(7, 11),
Values(cv::TermCriteria(cv::TermCriteria::COUNT |
cv::TermCriteria::EPS,
30, 0.01)),
testing::Bool()));
INSTANTIATE_TEST_CASE_MACRO_P(WITH_VIDEO(OptFlowLKInternalTestCPU), OptFlowLKTestForPyr,
Combine(Values(VIDEO_CPU),
Values("cv/optflow/rock_%01d.bmp"),
Values(1),
Values(std::make_tuple(10, 10)),
Values(15),
Values(cv::TermCriteria(cv::TermCriteria::COUNT |
cv::TermCriteria::EPS,
21, 0.05)),
Values(true)));
} // opencv_test