C++ on Opencv 3 -


i not c++ starting learn. learn looking @ other people's code.

i looking @ svm tutorial on opencv here

i not understand part on

(mat_(1,2) << j,i);

  1. what mean mat_ (1,2)? _ represent?

  2. why j , fed matrix? shouldn't , j, = rows , j = columns?

     // show decision regions given svm  vec3b green(0,255,0), blue (255,0,0);  (int = 0; < image.rows; ++i)      (int j = 0; j < image.cols; ++j)      {          mat samplemat = (mat_<float>(1,2) << j,i);          float response = svm->predict(samplemat);          if (response == 1)              image.at<vec3b>(i,j)  = green;          else if (response == -1)              image.at<vec3b>(i,j)  = blue;      } 

  1. (mat_<float>(1,2) << j,i): creates 1-by-2 matrix , fills values of i , j.
  2. the function cv::mat::operator() requires specify row (i) , column (j) data goes function predict() uses other order. tutorial:

[...] image traversed interpreting pixels points of cartesian plane. [...]


Comments