Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to store negative float values in Mat object?

Why am I not able to do this?

Mat img = Mat(4,4, CV_32FC3);
img.at<Vec3b>(0,0)[0] = -1;
img.at<Vec3b>(0,1)[0] = -0.5;

When I display the Mat object, it shows 255 in place of -1. I want to have all of my pixel values in the range of -1 to 1. How can I achieve that?