Storing feature information (keypoints, descriptors)
Hi,
I have run into a problem while trying to store image features in a file. I am using GPU version of SURF algorithm. I have calculated keypoints and descriptors and they are both stored in a gpu::GpuMat structure. More precisely, I have a vector like this:
struct featureInfo
{
gpu::GpuMat keypoints;
gpu::GpuMat descriptors;
std::string frameName;
} frameData;
std::vector<featureInfo> data;
It contains keypoints/descriptors and other info for hundreds of frames. What would be the easiest (or fastest) way to store it to a file?
I guess gpu::GpuMat files need to be downloaded to CPU before being stored? And, if that is the case, is there a way to upload descriptors back to GPU without having to calculate them again?
Thanks!
You will have to download them from the GPU to CPU before you save them. As for uploading them, you deserialize your key point and descriptor from your file and, key points into Keypoint vector and your descriptors into a Mat.
const char * filePath = files.at(frameNumber).c_str(); cv::FileStorage fs2(filePath, cv::FileStorage::READ);