I\'m writing both descriptors (SurfDescriptorExtractor output) and keypoints (SurfFeatureDetector output) to an XML file. Before writing keypoints (std::vector) conversion to Ma
Just found this by looking at OpenCV source (under /modules/java/generator/src/cpp/converters.cpp, around line 185):
void Mat_to_vector_KeyPoint(Mat& mat, vector& v_kp)
{
v_kp.clear();
CHECK_MAT(mat.type()==CV_32FC(7) && mat.cols==1);
for(int i=0; i v = mat.at< Vec >(i,0);
KeyPoint kp(v[0], v[1], v[2], v[3], v[4], (int)v[5], (int)v[6]);
v_kp.push_back(kp);
}
return;
}
And I'm using it as:
vector mat_to_keypoints(Mat* mat) {
vector c_keypoints;
for ( int i = 0; i < mat->rows; i++) {
Vec v = mat.at< Vec >(i,0);
KeyPoint kp(v[0], v[1], v[2], v[3], v[4], (int)v[5], (int)v[6]);
c_keypoints.push_back(kp);
};
return c_keypoints;
};