This commit is contained in:
Elena Gvozdeva
2014-01-29 14:10:36 +04:00
parent 17c6b4d306
commit 96b6f338e1
2 changed files with 60 additions and 27 deletions

View File

@@ -23,6 +23,7 @@ namespace ocl {
//////////////////////////// Mog2//////////////////////////
typedef tuple<string, int> VideoMOG2ParamType;
typedef TestBaseWithParam<VideoMOG2ParamType> MOG2_Apply;
typedef TestBaseWithParam<VideoMOG2ParamType> MOG2_GetBackgroundImage;
static void cvtFrameFmt(vector<Mat>& input, vector<Mat>& output)
@@ -51,7 +52,37 @@ static void prepareData(VideoCapture& cap, int cn, vector<Mat>& frame_buffer)
frame_buffer = frame_buffer_init;
}
OCL_PERF_TEST_P(MOG2_GetBackgroundImage, Mog2, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), Values(1,3)))
OCL_PERF_TEST_P(MOG2_Apply, Mog2, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), Values(1,3)))
{
VideoMOG2ParamType params = GetParam();
const string inputFile = getDataPath(get<0>(params));
const int cn = get<1>(params);
int nFrame = 5;
vector<Mat> frame_buffer(nFrame);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
prepareData(cap, cn, frame_buffer);
UMat u_foreground;
OCL_TEST_CYCLE()
{
Ptr<cv::BackgroundSubtractorMOG2> mog2 = createBackgroundSubtractorMOG2();
mog2->setDetectShadows(false);
u_foreground.release();
for (int i = 0; i < nFrame; i++)
{
mog2->apply(frame_buffer[i], u_foreground);
}
}
SANITY_CHECK(u_foreground);
}
OCL_PERF_TEST_P(MOG2_GetBackgroundImage, Mog2, Combine(Values("gpu/video/768x576.avi", "gpu/video/1920x1080.avi"), Values(3)))
{
VideoMOG2ParamType params = GetParam();