Ask Your Question
0

example "digits.py" KO on windows 10 (build) python27

asked 2018-01-21 09:54:24 -0500

Bonjour ,

C:\Python27>python Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import cv2

print cv2.__version__

$Rev: 4557 $

some examples are ok but with digits.py , SVM or KNearest syntax issues

> ../data/digits.png ...
> preprocessing... training KNearest...
> Traceback (most recent call last):  
> File "digits.py", line 173, in
> <module>
>     model = KNearest(k=4)   File "digits.py", line 81, in __init__
>     self.model = cv.ml.KNearest_create()
> AttributeError: 'module' object has no attribute 'ml'

with cv.KNearest() it's ok but after ...other error it seems version issues but how to resolve ? thanks for help

Regards

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-01-21 10:15:42 -0500

berak gravatar image

"with cv.KNearest() it's ok" -- this means, you are using outdated opencv2.4.x, and cannot run opencv3.x tutorial code.

you might want to try, if the samples from the 2.4 branch work for you.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-01-21 09:54:24 -0500

Seen: 53 times

Last updated: Jan 21 '18