c++ - OpenCV SVM HOG detector svm.predict() exception -
i using visual studio 2013 opencv 2.4.11 trained svm with xml file of positiv , negative samples. here code want compare image. build ok, when run debug it's break on svm.predict().
unhandled exception @ 0x00007fff43148a5c in consoleapplication2.exe: microsoft c++ exception: cv::exception @ memory location 0x000000af2d16eca0.
and there in local variables near svm
information not available, no symbols loaded opencv_ml2411d.dll
any idea or clue what's wrong?
void compare() { //variables char fullfilename[100]; char firstfilename[100] = "e:\dropbox/dip/images/train/"; int filenum = 5; //262; //load trained svm xml data cvsvm svm; svm.load("e:/dropbox/dip/images/train/trainedsvm.xml"); //count variable int nnn = 0, ppp = 0; (int = 1; i< filenum; ++i) { sprintf_s(fullfilename, "%s%d.jpg", firstfilename, + 1); //printf("%s\n", fullfilename); //read image file mat img, img_gray; img = imread(fullfilename); //resizing resize(img, img, size(64, 48)); //size(32*2,16*2)); //size(80,72) ); //gray cvtcolor(img, img_gray, cv_rgb2gray); //extract hogfeature hogdescriptor d(size(32, 16), size(8, 8), size(4, 4), size(4, 4), 9); vector< float> descriptorsvalues; vector< point> locations; d.compute(img_gray, descriptorsvalues, size(0, 0), size(0, 0), locations); //vector mat mat fm = mat(descriptorsvalues); //classification whether data positive or negative here come problem int result = svm.predict(fm); //svm.predict(fm); printf("%s - > %d\n", fullfilename, result); //count data if (result == 1) ppp++; else nnn++; //show image imshow("origin", img); waitkey(5); } printf(" positive/negative = (%d/%d) \n", ppp, nnn); }
Comments
Post a Comment