2013-01-16 182 views
4

OpenCV 2.4具有检测器和描述符。我为很多图像创建了关键点,问题在于探测器获得了关键点,但描述符有时会将它们全部删除。OpenCV描述符删除关键点

  • 如何禁用描述符以删除点?
  • 有没有办法增强关键点,使它们不被删除?

知道我尝试了很多描述符(SIFT,SURF,简单地说,等...)

回答

0

你可以张贴一些代码? CPU实现可以在名为matcher_simple.cpp的samples/cpp文件夹中找到。你能运行吗?我也在OpenCV上运行GPU版本的SURF,使用没有问题:

SURF_GPU surf(1000, 4, 2, false, 0.5); 

// detecting keypoints & computing descriptors 
GpuMat keypoints1GPU, keypoints2GPU; 
GpuMat descriptors1GPU, descriptors2GPU; 
surf(img1, GpuMat(), keypoints1GPU, descriptors1GPU); 
surf(img2, GpuMat(), keypoints2GPU, descriptors2GPU); 

cout << "FOUND " << keypoints1GPU.cols << " keypoints on first image" << endl; 
cout << "FOUND " << keypoints2GPU.cols << " keypoints on second image" << endl; 

// matching descriptors 
BruteForceMatcher_GPU< L2<float> > matcher; 
GpuMat trainIdx, distance; 
matcher.matchSingle(descriptors1GPU, descriptors2GPU, trainIdx, distance); 

// downloading results 
vector<KeyPoint> keypoints1, keypoints2; 
vector<float> descriptors1, descriptors2; 
vector<DMatch> matches; 
surf.downloadKeypoints(keypoints1GPU, keypoints1); 
surf.downloadKeypoints(keypoints2GPU, keypoints2); 
surf.downloadDescriptors(descriptors1GPU, descriptors1); 
surf.downloadDescriptors(descriptors2GPU, descriptors2); 
BruteForceMatcher_GPU< L2<float> >::matchDownload(trainIdx, distance, matches); 

// drawing the results 
Mat img_matches, image1, image2; 
img1.download(image1); 
img2.download(image2); 
drawMatches(image1, keypoints1, image2, keypoints2, matches, img_matches);