c – 在OpenCV 3.0中计算密集SIFT功能

前端之家收集整理的这篇文章主要介绍了c – 在OpenCV 3.0中计算密集SIFT功能前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
从3.0版开始,DenseFeatureDetector不再可用.有人可以告诉我如何在OpenCV 3.0中计算密集SIFT功能吗?我在文档中找不到它.

非常感谢你提前!

解决方法

以下是我在OpenCV 3 C中使用密集SIFT的方法
  1. SiftDescriptorExtractor sift;
  2.  
  3. vector<KeyPoint> keypoints; // keypoint storage
  4. Mat descriptors; // descriptor storage
  5.  
  6. // manual keypoint grid
  7.  
  8. int step = 10; // 10 pixels spacing between kp's
  9.  
  10. for (int y=step; y<img.rows-step; y+=step){
  11. for (int x=step; x<img.cols-step; x+=step){
  12.  
  13. // x,y,radius
  14. keypoints.push_back(KeyPoint(float(x),float(y),float(step)));
  15. }
  16. }
  17.  
  18. // compute descriptors
  19.  
  20. sift.compute(img,keypoints,descriptors);

复制自:
http://answers.opencv.org/question/73165/compute-dense-sift-features-in-opencv-30/?answer=73178#post-id-73178

似乎运作良好

猜你在找的C&C++相关文章