#include "cv.h"
#include "highgui.h"
#include "cxcore.h"
#include
#include
using namespace std;int main()
{
float label[6]={1,1,1,2,2,2};
float traind[6][2]={{170,60},{175,65},{180,70},{155,45},{160,45},{157,50}};
float testd[2]={175,65};
CvMat matl,matd,mtestd;
cvInitMatHeader(&matl,6,1,CV_32FC1,label);
cvInitMatHeader(&matd,6,2,CV_32FC1,traind);
cvInitMatHeader(&mtestd,1,2,CV_32FC1,testd);
CvSVM svm=CvSVM();
svm.train(&matd,&matl,NULL,NULL);
float f = svm.predict(&mtestd);
printf("f: %d\n", int(f));
return 0;
}