OpenCV 3.0.0-beta缺少KNN吗? [英] OpenCV 3.0.0-beta missing KNN?

查看:83
本文介绍了OpenCV 3.0.0-beta缺少KNN吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚从opencv-2.4.11升级,KNearest似乎丢失了

In [27]: import cv2
In [28]: print(cv2.__version__)
3.0.0-beta

In [29]: cv2.KNearest()

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-29-d2ea29abad59> in <module>()
----> 1 cv2.KNearest()

AttributeError: 'module' object has no attribute 'KNearest'

In [30]: cv2.K
cv2.KAZE_DIFF_CHARBONNIER      cv2.KAZE_DIFF_WEICKERT         cv2.KMEANS_RANDOM_CENTERS      cv2.KeyPoint
cv2.KAZE_DIFF_PM_G1            cv2.KAZE_create                cv2.KMEANS_USE_INITIAL_LABELS  cv2.KeyPoint_convert
cv2.KAZE_DIFF_PM_G2            cv2.KMEANS_PP_CENTERS          cv2.KalmanFilter               cv2.KeyPoint_overlap

解决方案

许多模块已从OpenCV核心中删除,并标记为非空闲.这些模块具有单独的存储库,必须分别构建.

存储库位于 https://github.com/itseez/opencv_contrib/

此答案中的信息 https://stackoverflow.com/a/27419092/892914

>

Having just upgraded from opencv-2.4.11, KNearest seems to be missing

In [27]: import cv2
In [28]: print(cv2.__version__)
3.0.0-beta

In [29]: cv2.KNearest()

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-29-d2ea29abad59> in <module>()
----> 1 cv2.KNearest()

AttributeError: 'module' object has no attribute 'KNearest'

In [30]: cv2.K
cv2.KAZE_DIFF_CHARBONNIER      cv2.KAZE_DIFF_WEICKERT         cv2.KMEANS_RANDOM_CENTERS      cv2.KeyPoint
cv2.KAZE_DIFF_PM_G1            cv2.KAZE_create                cv2.KMEANS_USE_INITIAL_LABELS  cv2.KeyPoint_convert
cv2.KAZE_DIFF_PM_G2            cv2.KMEANS_PP_CENTERS          cv2.KalmanFilter               cv2.KeyPoint_overlap

解决方案

Many modules were removed from OpenCV core and marked as nonfree. These modules have separate repository and has to be built separately.

The repository is here https://github.com/itseez/opencv_contrib/

The info was found in this answer https://stackoverflow.com/a/27419092/892914

这篇关于OpenCV 3.0.0-beta缺少KNN吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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