1 | initial version |
Your accumulator is empty because your frame size is empty. You should do something like this:
VideoCapture cap(0); // open the default camera
if (!cap.isOpened()) // check if we succeeded
return -1;
// Variables
Mat frame;
Mat accumulator;
Mat scaled; // Initialize the accumulator matrix
cap >> frame; // Now frame is not empty
accumulator = Mat::zeros(frame.size(), CV_32FC3);
while (1) {
// Capture frame
cap >> frame;
// Get 50% of the new frame and add it to 50% of the accumulator
accumulateWeighted(frame, accumulator, 0.5); //now no error here (i hope so)