适用opencv3.4.1版本的sift算法、
时间: 2024-01-13 15:02:49 浏览: 105
在 OpenCV 3.4.1 版本中,SIFT 算法也是默认包含在主体 OpenCV 库中的,因此您可以直接在代码中创建 SIFT 对象,如下所示:
```
import cv2
img = cv2.imread('your_image.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# 创建 SIFT 对象
sift = cv2.xfeatures2d.SIFT_create()
# 在图像中检测特征点
keypoints = sift.detect(gray, None)
# 在图像中绘制特征点
img_sift = cv2.drawKeypoints(gray, keypoints, None)
cv2.imshow('SIFT', img_sift)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
注意,在 OpenCV 3.4.1 版本中,SIFT 算法也位于 `cv2.xfeatures2d` 模块中,因此您需要使用 `cv2.xfeatures2d.SIFT_create()` 方法来创建 SIFT 对象。
阅读全文
相关推荐















