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);
trail->draw(canvas);
cv::imshow("Frame", canvas);
- if (cv::waitKey(30) >= 0)
+ if (cv::waitKeyEx(30) >= 0)
break;
if (outputVideo.isOpened())