Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library 错误,完美解决

在使用cv2.xfeatures2d.SIFT_create()时遇到付费内容提示。问题源于使用了最新版的opencv_contrib_python(4.0版本)。通过降级到兼容的opencv-contrib-python 3.4版本(适用于Python 3.7.2),并设置OPENCV_ENABLE_NONFREE选项,成功解决该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用cv2 ,应用cv2.xfeatures2d.SIFT_create() 函数时,提示

cv2.error: OpenCV(4.0.0) /Users/travis/build/skvark/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 'create'

经过一番查找,发现

xfeatures2d是付费内容,而我“pip3 install opencv_contrib_python”安装的版本为最新版本,4.0

付费内容,更换一下低版本可用

pip3 install opencv-contrib-python==3.4.2.17

完美解决
前提是:python 3.7版本(Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43)),其他版本无兼容的opencv-contrib-python 3.4可用(踩坑python3.5版本)
在这里插入图片描述
上图纪念一下

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

齐天大疯子

为别人的付出付费,必将轮回自己

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值