2
我想要做一些像eigenfaces但有不同的圖像(不是面孔)。我有一個圖像矢量,images
。從這些圖像中,我想製作一個Mat
對象,其中每個行包含一個作爲行向量寫出的圖像,其中包含data
。這是我試圖做的:使用開放式CV迭代器段落錯誤
// This is basically a matrix that needs to have a bunch of images as rows.
Mat data(numImages, IMAGE_SIZE * IMAGE_SIZE, CV_8UC1);
// I also replaced CV_8U by images[0].type() and CV_8U. no change
MatIterator_<unsigned short> iter = data.begin<unsigned short>(),
iter_end = data.end<unsigned short>(),
iter2;
for (i = 0; i < numImages; ++i)
{
MatIterator_<unsigned short> begin = images[i].begin<unsigned short>();
MatIterator_<unsigned short> end = images[i].end<unsigned short>();
for (iter2 = begin; iter2 != end; iter2++)
{
*iter = *iter2; // Segfault is here.
if (iter != iter_end) // safety check
iter++;
else
perror("Screwed!\n"); // This does not execute!
}
}
幫助!
謝謝!
是的,這似乎是它。現在我感到跛腳:P謝謝! – 2011-05-04 05:14:23