在OpenCV 3.0中计算密集SIFT特性 [英] Compute Dense SIFT features in OpenCV 3.0

查看:804
本文介绍了在OpenCV 3.0中计算密集SIFT特性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自3.0版本起,DenseFeatureDetector不再可用。任何人都请告诉我如何计算OpenCV 3.0中的密集SIFT功能?我在文档中找不到它。

Since version 3.0, DenseFeatureDetector is no longer available. Could anybody please show me how to compute Dense SIFT features in OpenCV 3.0? I couldn't find it in the documentation.

非常感谢您提前!

推荐答案

cv2.KeyPoints sift.compute 的列表。这个例子是在Python中,但它显示的原则。我通过扫描图像的像素位置创建一个 cv2.KeyPoint 的列表:

You can pass a list of cv2.KeyPoints to sift.compute. This example is in Python, but it shows the principle. I create a list of cv2.KeyPoints by scanning through the pixel locations of the image:

import skimage.data as skid
import cv2
import pylab as plt

img = skid.lena()
gray= cv2.cvtColor(img ,cv2.COLOR_BGR2GRAY)

sift = cv2.xfeatures2d.SIFT_create()

step_size = 5
kp = [cv2.KeyPoint(x, y, step_size) for y in range(0, gray.shape[0], step_size) 
                                    for x in range(0, gray.shape[1], step_size)]

img=cv2.drawKeypoints(gray,kp, img)

plt.figure(figsize=(20,10))
plt.imshow(img)
plt.show()

dense_feat = sift.compute(gray, kp)

这篇关于在OpenCV 3.0中计算密集SIFT特性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆