I am putting all the descriptors for multiple images from an ORB detector into one Mat to feed to cv::flann::index->build. Here is the code I am trying.
while (true)
{
buffer = indexBuilder.value("descriptors").toString().toStdString();
Mat mat;
Mat matonerow;
FileStorage fs(buffer,FileStorage::READ | FileStorage::MEMORY | FileStorage::FORMAT_YAML);
fs["descriptors"] >> mat;
fs.release();
matonerow = mat.reshape(1,1);
qDebug() << "matonerow cols" << matonerow.cols << "rows" << matonerow.rows;
indexTemp.push_back(matonerow);
progress->setValue(iterations);
iterations++;
if (!indexBuilder.next())
break;
}
the problem is that some of the descriptors are smaller, so the call to push_back fails with
OpenCV Error: Sizes of input arguments do not match () in push_back, file /tmp/opencv320160111-57911-i2x9h0/opencv-3.1.0/modules/core/src/matrix.cpp, line 834
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv320160111-57911-i2x9h0/opencv-3.1.0/modules/core/src/matrix.cpp:834: error: (-209) in function push_back
so how do I copy the one row mat to the tempindex mat? NOTE: I am using mat because I intend to convert it to UMat before passing it to build the index so I can take advantage of opencl through TAPI.