OpenCV CvSVM.predict() decision function value

I am training images with Bag of Words. However, every time I change the condition value in if statement or the sign, e.g. from if(response<0) to if(response>0) or from if(response<-1) to if(response<-0.5) I get different results results.push_back(response). I could not figure out why this happens. I only change the condition, that's it. Please, help me with this problem. Thanks in advance.

int i, j;
        Mat ROI = img(Rect(i, j, w, h)); 
        if ({
        Mat bowDescriptor2;
        std::cout<<"SVM predicting..."<<std::endl;
        float response = svm.predict(bowDescriptor2,1); 
            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 where I made the mistake. The problem was that I could not use the same image as an input here rectangle(img, Point(i,j), Point(i+w,j+h), RED, 3, 8, 0). Therefore, I read the image and defined it img as well as img2 and then I replaced img with img2 in rectangle.

Need Your Help

Scala: Play Framework 2 ignores httpOnly flag in application.conf

javascript html scala playframework-2.1 cookie-httponly

I want to use i18n in my Play-Application (Play 2.1, Scala). The chosen language is stored in the PLAY_LANG-Cookie, but unfortunately this cookie is httpOnly. That means I can't read its value in my

how to allocate arrays and 2D arrays with max length by malloc in c while accessing to them?

c arrays pointers malloc multidimensional-array

I am coding a program which takes a text file as an input, makes the index of the words of it and prints the output(the index) in a file and in the screen.