N frames summation
Is it possible to add N frames together in Real-time by using Opencv?
Is it possible to add N frames together in Real-time by using Opencv?
Yes. You can do this by accumulating 10 Mat in a vector<mat> and then sum that result. Here is a piece of code that might be helpful.
VideoCapture cap; //videocapture object
vector<Mat> matSeq; //where you'll accumulate frames
int numFamesToKeep = 10; //number of frames to keep
Mat frame;
cap.start(0);
while(1)
{
cap.getFrame(frame);
matSeq.push_back(frame.clone()); //accumulate frame
if (matSeq.size() == numFramesToKeep + 1) //keep only 10 frames by deleting 11th
{
vector<Mat>::iterator it;
it = matSeq.begin();
matSeq.erase(it);
}
}
Now that you have 10 sequential frames accumulated, summing them is pretty trivial, you can even use the + operator.
This piece of code works on real time. matSeq will always store the latest 10 frames captured by the webcam.
Asked: 2013-12-16 11:10:45 -0600
Seen: 209 times
Last updated: Dec 17 '13
count only the black pixels inside the contour. [closed]
OpenCV Matrix memory release after imread command
SolvePnP returns wrong rotation
Draw the lines detected by cv::HoughLines
Stretch all of the image rows in order to make them of constant length
How to use opencv to find circles
How to use PCA SIFT in opencv ?
Adjust the rotation of car plate
Is there a 2.0 series version of the HDR tutorial? Currently broken.