error when read float pixel from a Mat

asked 2016-11-23 20:22:01 -0500

greenworld gravatar image

updated 2016-11-24 01:22:13 -0500

Siegfried gravatar image

Hi everyone, I just want to read a value from each pixel of the oIMG mat, but it is failed. Can you help to explain where is my errors in below code:

Mat oIMG[3];
for (int i = 0; i < 3; ++i)
{
    oIMG[i] = Mat(vSize, hSize, CV_32FC(1), Scalar::all(255));
}
int hh = oIMG[0].at<float>(0, 0);
edit retag flag offensive close merge delete

Comments

any help please?

greenworld gravatar imagegreenworld ( 2016-11-24 01:14:54 -0500 )edit

One error is in the last line. You cast a float value to an int.

Siegfried gravatar imageSiegfried ( 2016-11-24 01:46:40 -0500 )edit
2

What does it mean "it is failed"?

LBerger gravatar imageLBerger ( 2016-11-24 03:07:16 -0500 )edit