Hi I can't understand how does work this line of following code:
Mat sampleMat = (Mat_<float>(1,2) << i,j);
what is "Mat_" ? Why (1,2)?
Vec3b green(0,255,0), blue (255,0,0);
for (int i = 0; i < image.rows; ++i)
for (int j = 0; j < image.cols; ++j)
{
Mat sampleMat = (Mat_<float>(1,2) << i,j);
float response = SVM.predict(sampleMat);
if (response == 1)
image.at<Vec3b>(j, i) = green;
else
if (response == -1)
image.at<Vec3b>(j, i) = blue;
}
Also why in if-else conditions it uses (j,i) not (i,j) ?
The complete explanation is exist here : http://docs.opencv.org/doc/tutorials/ml/introduction_to_svm/introduction_to_svm.html