简体   繁体   English

打印CV_32F opencv矩阵值

[英]Printing CV_32F opencv matrix values

I want to print the values of 1x3 vector of ones CV_32F elements: 我想打印一个CV_32F元素的1x3向量的值:

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)<<" ";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OpenCV:断言失败(src.checkVector(2,CV_32F) - OpenCV: Assertion failed (src.checkVector(2, CV_32F) OpenCV C ++:使用converTo从CV_32F转换为CV8U提供了意外的值 - OpenCV C++: Conversion from CV_32F to CV8U using converTo is giving unexpected values OpenCV类型CV_32F和CV_32FC1之间的区别 - Difference between OpenCV type CV_32F and CV_32FC1 断言失败(image.type()== CV_32F)。 GPU卷积。 OpenCV的 - Assertion failed (image.type() == CV_32F). GPU convolution. OpenCV 在QPixmap中显示cv :: Mat(类型CV_32F) - Display a cv::Mat (type CV_32F) in a QPixmap OpenCV错误:断言失败((img.depth()== CV_8U || img.depth()== CV_32F) - OpenCV error : Assertion failed ((img.depth() == CV_8U || img.depth() == CV_32F) Mat的convertTo函数在OpenCV中将灰度图像的类型转换为CV_32F时会引发断言错误 - Mat's convertTo function complains assert error while converting the type of grayscale image to CV_32F in OpenCV OpenCV C++ 读取图像和补丁 NaN 错误:断言失败 (_a.depth() == CV_32F) 在 patchNaNs - OpenCV C++ read image and patch NaN Error: Assertion failed (_a.depth() == CV_32F) in patchNaNs OpenCV错误:断言失败(samples.cols == var_count &amp;&amp; samples.type()== CV_32F) - OpenCV Error: Assertion failed (samples.cols == var_count && samples.type() == CV_32F) in predict c ++将cv :: Mat从CV_8U转换为CV_32F - c++ convert cv::Mat from CV_8U to CV_32F
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM