错误C2039:'normType':不是'cv :: DMatch'的成员

时间:2015-05-20 13:05:11

标签: opencv visual-c++ match sift

我尝试使用c ++,opencv 2.4.5进行SIFT算法。我的项目必须做到这一点:通过筛选在视频中跟踪4本书的数字。我找到了这段代码http://fahmifahim.com/2012/12/11/opencv-sift-implementation-in-opencv-2-4/

首先我尝试简单匹配两个数字。之后,我将实施其他项目流程。 我在上行链路上更改了代码。我的代码:

cv::Mat feat1, feat2; 
cv::Mat tmp = cv::imread( "c:\\image1.png", 1 );
cv::Mat in = cv::imread( "c:\\image1.png", 1 );


cv::SiftDescriptorExtractor detector(0.05,5);
cv::SiftDescriptorExtractor extractor( 3);

std::vector<cv::KeyPoint>  keypoints1, keypoints2 ;
detector.detect(tmp, keypoints1);
detector.detect( in, keypoints2 );

cv::drawKeypoints(tmp, keypoints1, feat1, cv::Scalar(255, 255, 255), cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
cv::drawKeypoints(in , keypoints2, feat2, cv::Scalar(255, 255, 255), cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
cv::imwrite( "feat1.bmp", feat1 );
cv::imwrite( "feat2.bmp", feat2 );
int key1 = keypoints1.size();
int key2 = keypoints2.size();
printf("Keypoint1=%d \nKeypoint2=%d", key1, key2);

cv::Mat descriptor1,descriptor2;
extractor.compute( tmp, keypoints1, descriptor1 );
extractor.compute( in, keypoints2, descriptor2 );
std::vector<cv::DMatch> matches;
cv::BruteForceMatcher < cv::DMatch> matcher;
matcher.match(descriptor1,descriptor2, matches);

// matching result
cv::Mat result;
cv::drawMatches(tmp, keypoints1, in, keypoints2, matches, result);


// output file
cv::imwrite( "result.bmp", result );

// display the result
cvNamedWindow("SIFT", CV_WINDOW_AUTOSIZE );
imshow("SIFT", result);
cvWaitKey(0);

ı得到错误喜欢这个:错误C2039:'normType':不是'cv :: DMatch'的成员

有什么不对?

0 个答案:

没有答案