두 개의 SIFT
설명자를 내가 생각할 수있는 가장 간단한 코드로 일치 시키려고 시도했지만 OpenCV 3
은 예외를 계속 던지고 있습니다.두 개의 SIFT 설명자를 OpenCV와 일치시킬 수 없음
cv::Mat img1 = imread(...); // Shortened for the example
cv::Mat img2 = imread(...); // Shortened for the example
std::vector<KeyPoint> keypoints1, keypoints2;
Ptr<SIFT> ptrSift = SIFT::create(200, 3, 0.07, 15);
Mat descriptors1, descriptors2;
ptrSift->detectAndCompute(img1, Mat(), keypoints1, descriptors1, false);
ptrSift->detectAndCompute(img2, Mat(), keypoints2, descriptors2, false);
위의 코드는 나에게 내가 drawKeypoints
기능을 시각화 할 수 있습니다 좋은 결과를 가져온다 :
이
내 코드입니다.가 그럼 난 기술자에 맞게 다음 코드를 사용
BFMatcher matcher;
std::vector<DMatch> matches;
matcher.match(descriptors1, descriptors2, matches);
을하지만 던지는 유지 :
C:\builds\master_PackSlave-win32-vc12-shared\opencv\modules\features2d\src\matchers.cpp:722: error: (-215) _queryDescriptors.type() == trainDescType in function cv::BFMatcher::knnMatchImpl
OpenCV Error: Assertion failed (type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U)) in cv::batchDistance, file C:\buil ds\master_PackSlave-win32-vc12-shared\opencv\modules\core\src\stat.cpp, line 3608 Exception: C:\builds\master_PackSlave-win32-vc12-shared\opencv\modules\core\src\stat.cpp:3608: error: (-215) type == src2.type() && src1.cols == src2. cols && (type == CV_32F || type == CV_8U) in function cv::batchDistance
감사
http://robwhess.github.io/opensift/. 매우 빠르고 사용하기 쉽습니다. – qqibrow
match() 호출 전에 descriptors1 또는 descriptors2가 비어 있는지 확인해야합니다. –
의견을 보내 주셔서 감사합니다.하지만 비어 있지 않습니다. – Itay