我想了解如何獲取OpenCV中給定的KeyPoint
的描述符。到目前爲止,我的代碼如下所示:KeyPoint描述符OpenCV
#include <iostream>
#include "opencv2/opencv.hpp"
typedef cv::Mat Image;
int main(int argc, const char * argv[])
{
Image imgA = cv::imread("images/buddhamulticam_total100.png",
CV_LOAD_IMAGE_GRAYSCALE);
Image imgB = cv::imread("images/buddhamulticam_total101.png",
CV_LOAD_IMAGE_GRAYSCALE);
cv::Ptr<cv::FeatureDetector> detector =
cv::FeatureDetector::create("ORB");
cv::Ptr<cv::DescriptorExtractor> descriptor =
cv::DescriptorExtractor::create("ORB");
std::vector<cv::KeyPoint> keyPointsA, keyPointsB;
keyPointsA.push_back(cv::KeyPoint(0,0,5));
keyPointsB.push_back(cv::KeyPoint(10,10,5));
cv::Mat descriptorA, descriptorB;
descriptor->compute(imgA, keyPointsA, descriptorA);
descriptor->compute(imgB, keyPointsB, descriptorB);
std::cout << "DescriptorA (" << descriptorA.rows << "," <<
descriptorA.cols << ")" << std::endl;
std::cout << "DescriptorB (" << descriptorB.rows << ","
<< descriptorB.cols << ")" << std::endl;
return 0;
}
問題是我沒有在描述符中獲取數據。我錯過了什麼? 您能否更詳細地解釋傳遞給KeyPoint
對象的參數是什麼?我對計算機視覺+ OpenCV很陌生,因此可能對OpenCV的文檔有更好的解釋。
讓我明白,點(0,0)和(10,10)? – GilLevi
是的,這就是opencv的文檔所說的。 – BRabbit27
然後看到我的回答:) – GilLevi