In reality, KNearest
has been moved to module cv2.ml
in opencv3, and you have to call cv2.ml.KNearest_create()
for using knn.
In [1]: import cv2
In [2]: cv2.__version__
Out[2]: '3.0.0'
In [3]: cv2.ml.KNea
cv2.ml.KNearest_BRUTE_FORCE cv2.ml.KNearest_create cv2.ml.KNearest_KDTREE
In [3]: cv2.ml.KNearest_create
For more details, please run help(cv2.ml.KNearest_create())
.
Enjoy :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…