1 | initial version |
If you really have to, and I mean REALLY have to, use the existing weird code then this might be one way
std::list<float*>::iterator it = NFrames;
Mat Ex = Mat::zeros( width, height, CV_32F );
for(int i = 0; i < Nframes.size(); i++)
{
Mat tmp(height, width, CV_32F, *it);
Ex += tmp;
it++;
}
This is making the assumption your images are actually float data type and single channel. And the memory has been allocated in advance.
If you really have to, and I mean REALLY have to, use the existing weird code then this might be one way
std::list<float*>::iterator it = NFrames;
NFrames.begin();
Mat Ex = Mat::zeros( width, height, CV_32F );
for(int i = 0; i < Nframes.size(); i++)
{
Mat tmp(height, width, CV_32F, *it);
Ex += tmp;
it++;
}
This is making the assumption your images are actually float data type and single channel. And the memory has been allocated in advance.
3 | No.3 Revision |
If you really have to, and I mean REALLY have to, use the existing weird code then this might be one way
std::list<float*>::iterator it = NFrames.begin();
Mat Ex = Mat::zeros( height, width, height, CV_32F );
for(int i = 0; i < Nframes.size(); i++)
{
Mat tmp(height, width, CV_32F, *it);
Ex += tmp;
it++;
}
This is making the assumption your images are actually float data type and single channel. And the memory has been allocated in advance.