Opencv 3.2 C++。我正在創建一個方法,可以接受任何一組關鍵點描述符並使用用戶指定的任何匹配算法。當我嘗試構建我的代碼時,出現以下錯誤。OpenCV C++ Flann IndexParams和SearchParams錯誤
- CV :: FLANN :: IndexParams ::〜IndexParams(),從參考:
- :
- CV :: FLANN :: SearchParams :: SearchParams(整數,浮點,布爾),從參考CV :: FLANN :: KDTreeIndexParams :: KDTreeIndexParams(INT),從引用:
- 鐺:錯誤:連接命令失敗,退出代碼1(使用-v看到調用)
更新 - 當我運行在OpenCV網站上發現的標準Flann教程在崇高的時候執行,沒有犯錯ORS。這導致我相信這個問題是與Xcode,但我仍然不是100%確定。
我正在使用xcode,我仍然在計算出接口,並沒有特定的聲明導致錯誤。我的代碼如下:`
std::tuple<std::vector<DMatch>,Mat> matchFeatures(std::vector<KeyPoint> kp1, Mat desc1, std::vector<KeyPoint>
kp2, Mat desc2, String keypointsMatcher){
std::vector<DMatch> matches;
vector<vector<DMatch>> knnMatches;
double max_dist = 0, min_dist = 100;
Mat homography;
if(keypointsMatcher == "bruteForce"){
BFMatcher matcher;
matcher.match(desc1, desc2, matches);
}
else if(keypointsMatcher == "flann"){
if(desc1.type()!=CV_32F) {
desc1.convertTo(desc1, CV_32F);
}
if(desc2.type()!=CV_32F) {
desc2.convertTo(desc1, CV_32F);
}
FlannBasedMatcher matcher;
matcher.match(desc1, desc2, matches);
}
//-Run Knn Flann based matcher. Will create a vector of vectors (vector<vector<DMatch>>)
else if (keypointsMatcher == "knn"){
if(desc1.type()!=CV_32F) {
desc1.convertTo(desc1, CV_32F);
}
if(desc2.type()!=CV_32F) {
desc2.convertTo(desc1, CV_32F);
}
FlannBasedMatcher matcher;
matcher.knnMatch(desc1, desc2, knnMatches, 2);
}
//-- Quick calculation of max and min distances between keypoints
for(int i = 0; i < desc1.rows; i++){
double dist = matches[i].distance;
if(dist < min_dist) min_dist = dist;
if(dist > max_dist) max_dist = dist;
}
return{matches,homography};
}`
任何幫助表示讚賞!