我尝试了以下行代码:
image.at<char>(row, column);
image.at<uchar>(row, column);
image.at<unsigned char>(row, column);
image.at<double>(row, column);
怎么了?
在之后,我需要将这个值转换为浮点数。一次选角就够了?
CV_16UC1将unsigned short作为底层类型,因此您可能需要
unsigned short val = image.at<unsigned short>(row, column);
是的,你可以简单地将其静态转换为浮点数:
float fval = static_cast<float>(val);