• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "perf_precomp.hpp"
2 
3 #if BUILD_WITH_VIDEO_OUTPUT_SUPPORT
4 
5 using namespace std;
6 using namespace cv;
7 using namespace perf;
8 using std::tr1::make_tuple;
9 using std::tr1::get;
10 
11 typedef std::tr1::tuple<std::string, bool> VideoWriter_Writing_t;
12 typedef perf::TestBaseWithParam<VideoWriter_Writing_t> VideoWriter_Writing;
13 
14 PERF_TEST_P(VideoWriter_Writing, WriteFrame,
15             testing::Combine( testing::Values( "python/images/QCIF_00.bmp",
16                                                "python/images/QCIF_01.bmp",
17                                                "python/images/QCIF_02.bmp",
18                                                "python/images/QCIF_03.bmp",
19                                                "python/images/QCIF_04.bmp",
20                                                "python/images/QCIF_05.bmp" ),
21             testing::Bool()))
22 {
23   string filename = getDataPath(get<0>(GetParam()));
24   bool isColor = get<1>(GetParam());
25   Mat image = imread(filename, 1);
26 #if defined(HAVE_MSMF) && !defined(HAVE_VFW) && !defined(HAVE_FFMPEG) // VFW has greater priority
27   VideoWriter writer(cv::tempfile(".wmv"), VideoWriter::fourcc('W', 'M', 'V', '3'),
28                             25, cv::Size(image.cols, image.rows), isColor);
29 #else
30   VideoWriter writer(cv::tempfile(".avi"), VideoWriter::fourcc('X', 'V', 'I', 'D'),
31                             25, cv::Size(image.cols, image.rows), isColor);
32 #endif
33 
TEST_CYCLE()34   TEST_CYCLE() { image = imread(filename, 1); writer << image; }
35 
36   bool dummy = writer.isOpened();
37   SANITY_CHECK(dummy);
38 }
39 
40 #endif // BUILD_WITH_VIDEO_OUTPUT_SUPPORT
41