阅读背景:

OpenCV c++:使用converTo将CV_32F转换为CV8U会产生意想不到的值

来源:互联网 
cv::Mat x(2,2,CV_32F);
x.at<float>(0,0)=0.7;
x.at<float>(0,1) = 0.8;
x.at<float>(1,0) = 0.72;
x.at<float>(1,1) = 0.68;
x.convertTo( x, CV_8U, 255, 0  );
std::cout << x.at<int>(0,0)  << std::endl;
std::cout << x.at<int>(0,1)  << std::endl;
std::cout << x.at<float>(1,0)  << std::endl; // I deliberately put <float> just to see what happens
std::cout << x.at<int>(1,1)  << std::endl;
cv::Mat x(2,2,CV_32F);
x.at<float>(0,0)=0.7;
x.



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: