From 5673e7e4353bbeeea8392ae5d046b0a08e6eadb1 Mon Sep 17 00:00:00 2001
From: Vladislav Vinogradov <vlad.vinogradov47@gmail.com>
Date: Sat, 19 Oct 2013 12:40:10 +0400
Subject: [PATCH] fix bug in gpu bgsegm sample

create `d_fgimg` matrix before cleaning.
---
 samples/gpu/bgfg_segm.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/samples/gpu/bgfg_segm.cpp b/samples/gpu/bgfg_segm.cpp
index 6963e75ff..47edbe75e 100644
--- a/samples/gpu/bgfg_segm.cpp
+++ b/samples/gpu/bgfg_segm.cpp
@@ -146,6 +146,7 @@ int main(int argc, const char** argv)
         double fps = cv::getTickFrequency() / (cv::getTickCount() - start);
         std::cout << "FPS : " << fps << std::endl;
 
+        d_fgimg.create(d_frame.size(), d_frame.type());
         d_fgimg.setTo(Scalar::all(0));
         d_frame.copyTo(d_fgimg, d_fgmask);