2 * openvc_trail_effect - experiments about video trail effects
4 * Copyright (C) 2015 Antonio Ospite <ao2@ao2.it>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include <opencv2/opencv.hpp>
33 data = cv::Mat::zeros(size, CV_8UC3);
34 mask = cv::Mat::zeros(size, CV_8UC1);
37 Frame(const cv::Mat& frame_data)
39 frame_data.copyTo(data);
42 Frame(const cv::Mat& frame_data, const cv::Mat& frame_mask)
44 frame_data.copyTo(data);
45 frame_mask.copyTo(mask);
52 void copyTo(cv::Mat& destination)
54 cv::Mat converted_data;
56 data.convertTo(converted_data, destination.type());
57 converted_data.copyTo(destination, mask);
62 data.setTo(cv::Scalar(0));
63 mask.setTo(cv::Scalar(0));
70 data.copyTo(masked_frame, mask);
74 cv::Mat getData() { return data; }
75 cv::Mat getMask() { return mask; }