I couldnt find proper references about how to pass the SVM parameters to the opencv cvSvm class. I got the parameter list, but not any tutorial on how to convert the parameters to the CV data structures.
Can I have some help please?
Construct a CvSVMParams object.
Its members are:
svm_type: SVM algorithm to usekernel_type: SVM kernel formdegree: Degree for polynomial kernelgamma: Scale for polynomial, RBF or sigmoid kernelcoef0: Offset for polynomial or sigmoid kernelC: C ratio for selecting support vectorsnu: nu value for nu-SVR algorithmp: p value for eps-SVRclass_weights: Class weights for C-SVMterm_crit: Termination criteria in CvTermCriteria
Change appropriate fields and pass it to CvSVM constructor. An SVM will be trained with your parameters.
CvSVMParams params ;
params.svm_type = CvSVM::C_SVC ;
params.kernel_type = CvSVM::RBF ;
params.gamma = 0.5 ;
CvSVM svm(&samples, &labels, 0, 0, params) ;
See documentation of CvSVM for more information: http://opencv.willowgarage.com/documentation/cpp/support_vector_machines.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With