c++ - OpenCV CvSVM.predict() decision function value -


i training images bag of words. however, every time change condition value in if statement or sign, e.g. if(response<0) if(response>0) or if(response<-1) if(response<-0.5) different results results.push_back(response). not figure out why happens. change condition, that's it. please, me problem. in advance.

int i, j; for(i=1;i<=img.cols-width;i=i+20){     for(j=1;j<=img.rows-height;j=j+20){         vector<keypoint>keypoints;         mat roi = img(rect(i, j, w, h));          detector.detect(roi,keypoints);         if (keypoints.data()){         mat bowdescriptor2;         bowde.compute(img,keypoints,bowdescriptor2);         evaldata.push_back(bowdescriptor2);         std::cout<<"svm predicting..."<<std::endl;         float response = svm.predict(bowdescriptor2,1);          results.push_back(response);         std::cout<<response<<std::endl;          if(response<0)         {              static cvscalar red = {0, 0, 255};             rectangle(img, point(i,j), point(i+w,j+h), red, 3, 8, 0);             cvnamedwindow( "result", 1 );             imshow( "result", img );         }         }      }  } 

i found out made mistake. problem not use same image input here rectangle(img, point(i,j), point(i+w,j+h), red, 3, 8, 0). therefore, read image , defined img img2 , replaced img img2 in rectangle.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -