3
我正在使用SURF/FLANN檢測器,我正在尋找將圖像,點,描述符保存到文件中,以便我可以比較此圖像並將其指向第二個圖像當我嘗試寫不過我發現了以下錯誤點:OpenCV將圖像,關鍵點和描述符保存到文件
In file included from detectFlannPoints.cpp:4:0:
/usr/local/include/opencv2/features2d/features2d.hpp:112:17: note: void cv::write(cv::FileStorage&, const string&, const std::vector<cv::KeyPoint>&)
/usr/local/include/opencv2/features2d/features2d.hpp:112:17: note: candidate expects 3 arguments, 4 provided
這是我用寫代碼:
FileStorage fs("Keypoints.yml", FileStorage::WRITE);
write(fs, "templateImageOne", keypoints_1, tempDescriptors_1);
fs.release();
我不知道在哪裏可以指定額外的參數(tempDescriptors_1
),因爲它可以正常工作,並刪除此參數。
代碼立刻上面寫代碼:
//Detect the keypoints using SURF Detector
int minHessian = 400;
SurfFeatureDetector detector(minHessian);
std::vector<KeyPoint> keypoints_1;
detector.detect(img_1, keypoints_1);
//-- Step 2: Calculate descriptors (feature vectors)
SurfDescriptorExtractor extractor;
Mat tempDescriptors_1;
extractor.compute(img_1, keypoints_1, tempDescriptors_1);
//-- Draw keypoints
Mat img_keypoints_1;
drawKeypoints(img_1, keypoints_1, img_keypoints_1, Scalar::all(-1), DrawMatchesFlags::DEFAULT);
工作表示感謝。 – Colin747