Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Opencv row assignmement different values

I have this code in OpenCV:

cv::Mat1f codes(x,y);
...
for(int i=0; i<codes.rows ; i++){ //you don't care about n
  cv::Mat code(1,codes.cols, codes.type());
  encode_(..., code); //fill code with values
  codes.row(i) = code;
  std::cout<<"code= "<<code<<std::endl;
  std::cout<<"codes.row= "<<codes.row<<std::endl;
}

However the printed values are differents:

code= [-0.0018070865, -0.0088188984, -0.001866244, 0.0071420735, -0.00046708167, -0.0011722896, ...
codes.row= [0.091074832, 0.10463701, 0.060412209, 0.075102232, 0.036429934, 0.018214967, ...

Why this happens?