opencv_trail_effect.cpp: fix showing the background
[experiments/opencv_trail_effect.git] / opencv_trail_effect.cpp
index 5a4e928..5fec5dc 100644 (file)
@@ -176,7 +176,7 @@ int main(int argc, char *argv[])
        if (*segmentation_method == "background") {
                segmentation = new MOG2Segmentation(inputVideo, background_learn_frames);
                if (show_background) {
        if (*segmentation_method == "background") {
                segmentation = new MOG2Segmentation(inputVideo, background_learn_frames);
                if (show_background) {
-                       cv::Mat background;
+                       cv::Mat background(frame_size, inputVideo.get(CV_CAP_PROP_FORMAT));
 
                        ((MOG2Segmentation *)segmentation)->getBackgroundImage(background);
                        trail->setBackground(background);
 
                        ((MOG2Segmentation *)segmentation)->getBackgroundImage(background);
                        trail->setBackground(background);