所以我想尝试使用:
sift = cv2.xfeatures2d.SIFT_create()
Run Code Online (Sandbox Code Playgroud)
它出现了这个错误:
cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1207: error: (-213:The function/feature is not implemented)
This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake
option and rebuild the library in function 'cv::xfeatures2d::SIFT::create'
Run Code Online (Sandbox Code Playgroud)
我正在使用Python 3.5.0,opencv(3.4.3)我只是闲着.这是在我尝试安装TensorFlow之后发生的,我试过环顾四周并安装了opencv-contrib-python但是我仍然遇到同样的错误.提前谢谢你,如果我没有提供足够的信息,我会道歉
我使用的是Ubuntu 12.04.我最近从https://github.com/Itseez/opencv/archive/3.0.0-alpha.zip安装了OpenCV 3.0 .我想做功能匹配,我使用了以下代码:
import numpy as np
import cv2
from matplotlib import pyplot as plt
MIN_MATCH_COUNT = 10
img1 = cv2.imread('box.png',0) # queryImage
img2 = cv2.imread('box_in_scene.png',0) # trainImage
# Initiate SIFT detector
sift = cv2.SIFT()
# find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,None)
kp2, des2 = sift.detectAndCompute(img2,None)
FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
search_params = dict(checks = 50)
flann = cv2.FlannBasedMatcher(index_params, search_params)
matches = flann.knnMatch(des1,des2,k=2)
# store all …Run Code Online (Sandbox Code Playgroud) 我正在使用 OpenCV v4.20 和 PyCharm IDE。我想使用SIFT算法。但我收到这个错误。我在互联网上寻找此错误的解决方案,但没有一个对我有帮助。你知道这个错误的解决方法吗?(使用 pip 我可以安装至少 3.4.2.16 版本的 OpenCV)
这是我的错误:
回溯(最近一次调用):文件“C:/Users/HP/PycharmProjects/features/featuredetect.py”,第 7 行,在 sift = cv.xfeatures2d_SIFT.create()
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1210: error: (-213: The function/feature is not implementation) 这个算法是已获得专利并被排除在此配置中;设置 OPENCV_ENABLE_NONFREE CMake 选项并在函数 'cv::xfeatures2d::SIFT::create' 中重建库
这是我的代码:
import cv2 as cv
image = cv.imread("the_book_thief.jpg")
gray_image = cv.cvtColor(image,cv.COLOR_BGR2GRAY)
sift = cv.xfeatures2d_SIFT.create()
keyPoints = sift.detect(image,None)
output = cv.drawKeypoints(image,keyPoints,None)
cv.imshow("FEATURES DETECTED",output)
cv.imshow("NORMAL",image)
cv.waitKey(0)
cv.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud) 我试图通过Ubuntu的shell运行最简单的opencv SIFT代码,没有运气
我收到一个错误:
AttributeError:'module'对象没有属性'SURF'
代码:
import cv2
cv2.SIFT()
Run Code Online (Sandbox Code Playgroud)
我的配置:
'scaleAdd','segmentMotion','sepFilter2D','setIdentity','setMouseCallback','setTrackbarPos','setUseOptimized','setWindowProperty','solve','solveCubic','solvePnP','solvePnPRansac','solvePoly ','sort','sortIdx','split','sqrt','startWindowThread','stereoCalibrate','stereoRectify','stereoRectifyUncalibrated','subtract','sumElems'
opencv ×4
sift ×3
python ×2
attributes ×1
image ×1
matching ×1
python-2.7 ×1
python-3.5 ×1
ubuntu ×1