Path: blob/master/modules/videoio/perf/perf_output.cpp
16337 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html3#include "perf_precomp.hpp"45#ifdef HAVE_VIDEO_OUTPUT67namespace opencv_test8{9using namespace perf;1011typedef tuple<std::string, bool> VideoWriter_Writing_t;12typedef perf::TestBaseWithParam<VideoWriter_Writing_t> VideoWriter_Writing;1314const string image_files[] = {15"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};2223PERF_TEST_P(VideoWriter_Writing, WriteFrame,24testing::Combine(25testing::ValuesIn(image_files),26testing::Bool()))27{28const string filename = getDataPath(get<0>(GetParam()));29const bool isColor = get<1>(GetParam());30Mat image = imread(filename, isColor ? IMREAD_COLOR : IMREAD_GRAYSCALE );31#if defined(HAVE_MSMF) && !defined(HAVE_VFW) && !defined(HAVE_FFMPEG) // VFW has greater priority32const string outfile = cv::tempfile(".wmv");33const int fourcc = VideoWriter::fourcc('W', 'M', 'V', '3');34#else35const string outfile = cv::tempfile(".avi");36const int fourcc = VideoWriter::fourcc('X', 'V', 'I', 'D');37#endif3839VideoWriter writer(outfile, fourcc, 25, cv::Size(image.cols, image.rows), isColor);40TEST_CYCLE_N(100) { writer << image; }41SANITY_CHECK_NOTHING();42remove(outfile.c_str());43}4445} // namespace4647#endif // HAVE_VIDEO_OUTPUT484950