Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/videoio/perf/perf_output.cpp
16337 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html
4
#include "perf_precomp.hpp"
5
6
#ifdef HAVE_VIDEO_OUTPUT
7
8
namespace opencv_test
9
{
10
using namespace perf;
11
12
typedef tuple<std::string, bool> VideoWriter_Writing_t;
13
typedef perf::TestBaseWithParam<VideoWriter_Writing_t> VideoWriter_Writing;
14
15
const string image_files[] = {
16
"python/images/QCIF_00.bmp",
17
"python/images/QCIF_01.bmp",
18
"python/images/QCIF_02.bmp",
19
"python/images/QCIF_03.bmp",
20
"python/images/QCIF_04.bmp",
21
"python/images/QCIF_05.bmp"
22
};
23
24
PERF_TEST_P(VideoWriter_Writing, WriteFrame,
25
testing::Combine(
26
testing::ValuesIn(image_files),
27
testing::Bool()))
28
{
29
const string filename = getDataPath(get<0>(GetParam()));
30
const bool isColor = get<1>(GetParam());
31
Mat image = imread(filename, isColor ? IMREAD_COLOR : IMREAD_GRAYSCALE );
32
#if defined(HAVE_MSMF) && !defined(HAVE_VFW) && !defined(HAVE_FFMPEG) // VFW has greater priority
33
const string outfile = cv::tempfile(".wmv");
34
const int fourcc = VideoWriter::fourcc('W', 'M', 'V', '3');
35
#else
36
const string outfile = cv::tempfile(".avi");
37
const int fourcc = VideoWriter::fourcc('X', 'V', 'I', 'D');
38
#endif
39
40
VideoWriter writer(outfile, fourcc, 25, cv::Size(image.cols, image.rows), isColor);
41
TEST_CYCLE_N(100) { writer << image; }
42
SANITY_CHECK_NOTHING();
43
remove(outfile.c_str());
44
}
45
46
} // namespace
47
48
#endif // HAVE_VIDEO_OUTPUT
49
50