/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2010-2013, Multicoreware, Inc., all rights reserved. // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // @Authors // Jin Ma, jin@multicorewareinc.com // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other oclMaterials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors as is and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ #include "precomp.hpp" using namespace cv; using namespace cv::ocl; static void cvtFrameFmt(std::vector& input, std::vector& output, int output_cn) { for(int i = 0; i< (int)(input.size()); i++) { if(output_cn == 1) cvtColor(input[i], output[i], COLOR_RGB2GRAY); else cvtColor(input[i], output[i], COLOR_RGB2RGBA); } } ///////////// MOG//////////////////////// PERFTEST(mog) { const string inputFile[] = {"768x576.avi", "1920x1080.avi"}; int cn[] = {1, 3}; float learningRate[] = {0.0f, 0.01f}; for(unsigned int idx = 0; idx < sizeof(inputFile)/sizeof(string); idx++) { VideoCapture cap(inputFile[idx]); ASSERT_TRUE(cap.isOpened()); Mat frame; int nframe = 5; Mat foreground_cpu; oclMat foreground_ocl; std::vector frame_buffer_init; std::vector frame_buffer(nframe); std::vector frame_buffer_ocl; std::vector foreground_buf_ocl; std::vector foreground_buf_cpu; BackgroundSubtractorMOG mog_cpu; cv::ocl::MOG d_mog; for(int i = 0; i < nframe; i++) { cap >> frame; ASSERT_FALSE(frame.empty()); frame_buffer_init.push_back(frame); } for(unsigned int i = 0; i < sizeof(learningRate)/sizeof(float); i++) { for(unsigned int j = 0; j < sizeof(cn)/sizeof(int); j++) { SUBTEST << frame.cols << 'x' << frame.rows << ".avi; "<<"channels: "< frame_buffer_init; std::vector frame_buffer(nframe); std::vector frame_buffer_ocl; std::vector foreground_buf_ocl; std::vector foreground_buf_cpu; cv::ocl::oclMat foreground_ocl; for(int i = 0; i < nframe; i++) { cap >> frame; ASSERT_FALSE(frame.empty()); frame_buffer_init.push_back(frame); } cv::ocl::MOG2 d_mog; for(unsigned int j = 0; j < sizeof(cn)/sizeof(int); j++) { SUBTEST << frame.cols << 'x' << frame.rows << ".avi; "<<"channels: "<> frame; ASSERT_FALSE(frame.empty()); int nframe = 5; std::vector frame_buffer_init; std::vector frame_buffer(nframe); std::vector frame_buffer_ocl; std::vector foreground_buf_ocl; std::vector foreground_buf_cpu; for(int i = 0; i < nframe; i++) { cap >> frame; ASSERT_FALSE(frame.empty()); frame_buffer_init.push_back(frame); } for(unsigned int j = 0; j < sizeof(cn)/sizeof(int); j++) { SUBTEST << frame.cols << 'x' << frame.rows << ".avi; "<<"channels: "<