perf_output.cpp 1.54 KB
Newer Older
wester committed
1 2
#include "perf_precomp.hpp"

a  
Kai Westerkamp committed
3
#if BUILD_WITH_VIDEO_OUTPUT_SUPPORT
wester committed
4 5 6 7 8 9 10 11 12 13 14

using namespace std;
using namespace cv;
using namespace perf;
using std::tr1::make_tuple;
using std::tr1::get;

typedef std::tr1::tuple<std::string, bool> VideoWriter_Writing_t;
typedef perf::TestBaseWithParam<VideoWriter_Writing_t> VideoWriter_Writing;

PERF_TEST_P(VideoWriter_Writing, WriteFrame,
a  
Kai Westerkamp committed
15 16 17 18 19 20 21
            testing::Combine( testing::Values( "python/images/QCIF_00.bmp",
                                               "python/images/QCIF_01.bmp",
                                               "python/images/QCIF_02.bmp",
                                               "python/images/QCIF_03.bmp",
                                               "python/images/QCIF_04.bmp",
                                               "python/images/QCIF_05.bmp" ),
            testing::Bool()))
wester committed
22
{
a  
Kai Westerkamp committed
23 24
  string filename = getDataPath(get<0>(GetParam()));
  bool isColor = get<1>(GetParam());
wester committed
25 26
  Mat image = imread(filename, 1);
#if defined(HAVE_MSMF) && !defined(HAVE_VFW) && !defined(HAVE_FFMPEG) // VFW has greater priority
a  
Kai Westerkamp committed
27 28
  VideoWriter writer(cv::tempfile(".wmv"), VideoWriter::fourcc('W', 'M', 'V', '3'),
                            25, cv::Size(image.cols, image.rows), isColor);
wester committed
29
#else
a  
Kai Westerkamp committed
30 31
  VideoWriter writer(cv::tempfile(".avi"), VideoWriter::fourcc('X', 'V', 'I', 'D'),
                            25, cv::Size(image.cols, image.rows), isColor);
wester committed
32 33
#endif

a  
Kai Westerkamp committed
34 35 36 37
  TEST_CYCLE() { image = imread(filename, 1); writer << image; }

  bool dummy = writer.isOpened();
  SANITY_CHECK(dummy);
wester committed
38 39
}

a  
Kai Westerkamp committed
40
#endif // BUILD_WITH_VIDEO_OUTPUT_SUPPORT