Path: blob/master/modules/video/perf/perf_bgfg_utils.hpp
16356 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.html.34namespace opencv_test {56//#define DEBUG_BGFG78using namespace testing;9using namespace cvtest;10using namespace perf;1112namespace {1314using namespace cv;1516static void cvtFrameFmt(std::vector<Mat>& input, std::vector<Mat>& output)17{18for(int i = 0; i< (int)(input.size()); i++)19{20cvtColor(input[i], output[i], COLOR_RGB2GRAY);21}22}2324static void prepareData(VideoCapture& cap, int cn, std::vector<Mat>& frame_buffer, int skipFrames = 0)25{26std::vector<Mat> frame_buffer_init;27int nFrame = (int)frame_buffer.size();28for (int i = 0; i < skipFrames; i++)29{30cv::Mat frame;31cap >> frame;32}33for (int i = 0; i < nFrame; i++)34{35cv::Mat frame;36cap >> frame;37ASSERT_FALSE(frame.empty());38frame_buffer_init.push_back(frame);39}4041if (cn == 1)42cvtFrameFmt(frame_buffer_init, frame_buffer);43else44frame_buffer.swap(frame_buffer_init);45}4647}}484950