简体   繁体   中英

Printing CV_32F opencv matrix values

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.

关闭,循环需要从0开始!

std::cout<<O.at<float>(0,i)<<" ";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM