0

How to obtain the weights for SVM in OpenCV 2.4.6 for Python 2.7.5?

I need this to calculate the primal form of my cv2.SVM() to feed it to a cv2.HOGDescriptor().setSVMDetector.

Found this and this SOF useful, but it seems like SVM.decision_func is protected and I cannot access this variable to obtain the weights.

Are there any other ways to do this in Python+OpenCV?

Community
  • 1
  • 1

1 Answers1

0

You can use Save method to save SVM to hard drive.

If you need only weights then I think you need to modify code or look closer at format in which opencv svm saved.

here some info OpenCv SVM output file format

Community
  • 1
  • 1
mrgloom
  • 20,061
  • 36
  • 171
  • 301
  • I think the problem is with `const CvSVMDecisionFunc* df = decision_func;` in the SOF that you shared. `decision_func` is protected and cannot be accessed using Python+OpenCV AFAIK. –  Aug 09 '13 at 07:12