In short, I would like to know if it is possible to directly access the pixel value from CV_32F Mat, through the Mat member "uchar * data".
I can do it without problems if Mat is CV_8U, for example:
The problem is that I am trying to perform the same operation with the following matrix,
// a matrix 5 columns, 6 rows, values in [0.0, 1.0], all elements initialised at 1.2 cv::Mat B; B.create(5,6, CV_32FC1); B = cv::Scalar(1.2); //this clearly does not work, no syntax error but erroneous value reported! uchar *p = B.data; float value = (float) p[4*B.step + 5]; //this works, but it is not what I want to do! float value = B.at<float>(4,5);
Thanks a lot Valerio
opencv
valerio_sperati
source share