简体   繁体   中英

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

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

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