Ask Your Question

Revision history [back]

click to hide/show revision 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.

click to hide/show revision 3
No.3 Revision

updated 2014-01-15 07:17:57 -0600

berak gravatar image

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.