OpenCV3 Assertion failed on accumulateWeighted
I try to make average background but something wrong because it way to crash app
`
include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
VideoCapture video(0);
cv::Mat Frame,Gray, Avg;
Avg = Mat::zeros(Frame.size(),CV_8UC1);
while(true)
{
video >> Frame;
cv::cvtColor(Frame,Gray,CV_BGR2GRAY);
int c = Avg.channels();
cv::accumulateWeighted(Gray,Avg,0.5);
cv::convertScaleAbs(Avg,Avg);
cv::namedWindow("Video");
cv::namedWindow("Avg");
cv::imshow("Avg",Avg);
cv::imshow("Video",Gray);
std::cout << c << std::endl;
std::cout << GetMatType(Gray) << std::endl;
cv::waitKey(30);
}
cv::waitKey(0);
return 0;
} `
This is the crash logs :::
OpenCV Error: Assertion failed (_src.sameSize(_dst) && dcn == scn) in accumulateWeighted, file /home/lafi/Documents/opencv-master/modules/imgproc/src/accum.cpp, line 1201
terminate called after throwing an instance of 'cv::Exception'
what(): /home/lafi/Documents/opencv-master/modules/imgproc/src/accum.cpp:1201: error: (-215) _src.sameSize(_dst) && dcn == scn in function accumulateWeighted
Avg = Mat::zeros(Frame.size(),CV_8UC1);
<-- Frame.size = (0,0) herehow i can correct it since i have to initialize the accumulator ??