简体   繁体   English

python OpenCV(3.4.2)错误:(-215:断言失败)

[英]python OpenCV(3.4.2) error: (-215:Assertion failed)

I'm trying to use the SIFT descriptors for image matching. 我正在尝试使用SIFT描述符进行图像匹配。 I am planning to match one image with another. 我打算将一个图像与另一个图像进行匹配。

This is the code with which I am trying to make the match 这是我尝试匹配的代码

sift = cv2.xfeatures2d.SIFT_create()

kp_1, desc_1 = sift.detectAndCompute(original, None)
kp_2, desc_2 = sift.detectAndCompute(image_to_compare, None)
index_params = dict(algorithm=0, trees=5)
search_params = dict()
flann = cv2.FlannBasedMatcher(index_params, search_params)
matches = flann.knnMatch(desc_1, desc_2, k=2)

but I get the following error: 但我收到以下错误:

<ipython-input-6-1f81512d446c> in AlgSift(imagen, imagentocompare, umbral)
   21     search_params = dict()
   22     flann = cv2.FlannBasedMatcher(index_params, search_params)
---> 23     matches = flann.knnMatch(desc_1, desc_2, k=2)
   24 
   25 


   error: OpenCV(3.4.2) /io/opencv/modules/flann/src/miniflann.cpp:487: error: 
   (-215:Assertion failed) (size_t)knn <= index_->size() in function 
   'runKnnSearch_'

An error such as Assertion failed occurred in my case because the position of the image to be loaded was not correct. 我的情况下发生了诸如断言失败的错误,因为要加载的图像位置不正确。 Please check your storage location and code once. 请检查一次您的存储位置和代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OpenCV(3.4.2): error: (-215:Assertion failed) with Template Matching Method - OpenCV(3.4.2): error: (-215:Assertion failed) with Template Matching Method 如何在 pycharm 中修复此错误? cv2.error: OpenCV(3.4.2) 错误: (-215:Assertion failed) - How to fix this error in pycharm? cv2.error: OpenCV(3.4.2) error: (-215:Assertion failed) Python 和 OpenCV:-215:尝试调用 calibrateCamera 时出现断言失败错误 - Python and OpenCV: -215:Assertion failed error when trying to call calibrateCamera OpenCV 调整大小错误(-215:断言失败) - OpenCV resize error(-215:Assertion Failed) 错误: (-215:Assertion failed) 使用 openCV 时 - error: (-215:Assertion failed) while using openCV 错误:OpenCV(4.2.0)C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:4045:错误:(-215:断言失败) - error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:4045: error: (-215:Assertion failed) Python OpenCV 错误:(-215:断言失败)_step &gt;= minstep in function &#39;cv::Mat::Mat&#39; - Python OpenCV Error: (-215:Assertion failed) _step >= minstep in function 'cv::Mat::Mat' 错误:(-215:Assertion failed) npoints > 0 while working with contours using OpenCV - Error: (-215:Assertion failed) npoints > 0 while working with contours using OpenCV EAST 文本检测 -215:Assertion failed (OpenCV Python) - EAST text detection -215:Assertion failed (OpenCV Python) 如何修复 Opencv arcLength function 错误:(-215:断言失败) - How to fix Opencv arcLength function error: (-215:Assertion failed)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM