[英]Accessing elements of OpenCV Mat CV_16UC1
i tried with the following line code: 我尝试使用以下行代码:
image.at<char>(row, column);
image.at<uchar>(row, column);
image.at<unsigned char>(row, column);
image.at<double>(row, column);
what is wrong? 怎么了?
after that, i need to convert this value to a float. 之后,我需要将此值转换为浮点数。 A casting is enough? 铸造就够了吗?
CV_16UC1 has unsigned short as an underlying type, so you probably need CV_16UC1将unsigned short作为基础类型,因此您可能需要
unsigned short val = image.at<unsigned short>(row, column);
And yes, you can simply static cast that to a float afterwards: 是的,之后您可以简单地将其静态转换为浮点数:
float fval = static_cast<float>(val);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.