OpenCV-Python dense SIFT

旧街凉风 提交于 2019-11-30 11:37:29

You can use Dense Sift in opencv 2.4.6 <. Creates a feature detector by its name.

cv2.FeatureDetector_create(detectorType)

Then "Dense" string in place of detectorType

eg:-

dense=cv2.FeatureDetector_create("Dense")
kp=dense.detect(imgGray)
kp,des=sift.compute(imgGray,kp)

I'm not sure what your goal is here, but be warned, the SIFT descriptor calculation is extremely slow and was never designed to be used in a dense fashion. That being said, OpenCV makes it fairly trivial to do so.

Basically instead of using sift.detect(), you just fill in the keypoint array yourself by making a grid a keypoints however dense you want them. Then a descriptor will be calculated for each keypoint when you pass the keypoints to sift.compute().

Depending on the size of your image and the speed of your machine, this might take a very long time. If copmutational time is a factor, I suggest you look at some of the binary descriptors OpenCV has to offer.

Inspite of the OpenCV way being the standard, it was too slow for me. So for that, I used pyvlfeat, which is basically python bindings to VL-FEAT. The functions carry similar syntax as the Matlab functions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!