void mat2KpVec(const Mat_d& matPts , KpVec& vecPts) { int numPts = matPts.rows; vecPts.reserve(numPts); for (int i = 0; i < numPts; i++) { double x = matPts.data[2 * i]; double y = matPts.data[2 * i + 1]; cv::KeyPoint pt(x, y, 1); vecPts.push_back(pt); } }
void KpVec2Mat(const KpVec& vecPts , Mat_d& matPts) { int numPts = vecPts.size(); matPts.resize(numPts, 2); for (int i = 0; i < numPts; i++) { matPts.data[2 * i] = vecPts[i].pt.x; matPts.data[2 * i + 1] = vecPts[i].pt.y; } }
void DepthPIRF::FAST(IplImage& img,KpVec& FeatureVec) { FastFeatureDetector detector(50); detector.detect( Mat(&img), FeatureVec ); for(int i=0;i<FeatureVec.size();i++) FeatureVec[i].class_id=i; }