AttributeError: the 'module' object does not have the attribute 'SVM_LINEAR'

I installed open cv 3.0 and then installed libsvm.Then I added this to my pycharm packages. But still, when you type this code

svm_params = dict( kernel_type = cv2.SVM_LINEAR,
                svm_type = cv2.SVM_C_SVC,
                C=2.67, gamma=5.383 )

he shows this error

svm_params = dict( kernel_type = cv2.SVM_LINEAR,
AttributeError: 'module' object has no attribute 'SVM_LINEAR'

I tried to import libsvm, but that did not help. Is opencv 3.0 ok if i go back to 2.4?

+4
source share
1 answer

You access SVM_LINEARusing cv2, but SVM_LINEARis an attribute ml.

You have to access SVM_LINEARhowcv2.ml.SVM_LINEAR

+6
source

All Articles