1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2020-01-28 13:16:03 +03:00
40 changed files with 3133 additions and 740 deletions
+48
View File
@@ -180,6 +180,54 @@ const videoio_container_params_t videoio_container_params[] =
INSTANTIATE_TEST_CASE_P(/**/, videoio_container, testing::ValuesIn(videoio_container_params));
typedef tuple<string, string, int> videoio_skip_params_t;
typedef testing::TestWithParam< videoio_skip_params_t > videoio_skip;
TEST_P(videoio_skip, DISABLED_read) // optional test, may fail in some configurations
{
#if CV_VERSION_MAJOR >= 4
if (!videoio_registry::hasBackend(CAP_FFMPEG))
throw SkipTestException("Backend was not found");
#endif
const string path = get<0>(GetParam());
const string env = get<1>(GetParam());
const int expectedFrameNumber = get<2>(GetParam());
#ifdef _WIN32
_putenv_s("OPENCV_FFMPEG_CAPTURE_OPTIONS", env.c_str());
#else
setenv("OPENCV_FFMPEG_CAPTURE_OPTIONS", env.c_str(), 1);
#endif
VideoCapture container(findDataFile(path), CAP_FFMPEG);
#ifdef _WIN32
_putenv_s("OPENCV_FFMPEG_CAPTURE_OPTIONS", "");
#else
setenv("OPENCV_FFMPEG_CAPTURE_OPTIONS", "", 1);
#endif
ASSERT_TRUE(container.isOpened());
Mat reference;
int nframes = 0, n_err = 0;
while (container.isOpened())
{
if (container.read(reference))
nframes++;
else if (++n_err > 3)
break;
}
EXPECT_EQ(expectedFrameNumber, nframes);
}
const videoio_skip_params_t videoio_skip_params[] =
{
videoio_skip_params_t("video/big_buck_bunny.mp4", "", 125),
videoio_skip_params_t("video/big_buck_bunny.mp4", "avdiscard;nonkey", 11)
};
INSTANTIATE_TEST_CASE_P(/**/, videoio_skip, testing::ValuesIn(videoio_skip_params));
//==========================================================================
static void generateFrame(Mat &frame, unsigned int i, const Point &center, const Scalar &color)