0

I want to print the values of 1x3 vector of ones CV_32F elements:

cv::Mat O = cv::Mat::ones(1, 3, CV_32F);
for(int i=0;i<O.cols;i++)
    std::cout<<O.at<float>(1,i)<<" ";
std::cout<<std::endl;
std::cout<<O<<std::endl;

However the code above prints:

1.4013e-43 1.12104e-43 0 //WHAT?
[1, 1, 1]  //correct

Why this happens? I've read this question but didn't help.

Community
  • 1
  • 1
justHelloWorld
  • 6,478
  • 8
  • 58
  • 138

1 Answers1

1

Close, the loop needs to start at 0!

std::cout<<O.at<float>(0,i)<<" ";
mock_blatt
  • 955
  • 5
  • 11