# Revision history [back]

### Using Mat.at<>() is giving me numbers much larger than 255.

Hi guys I am trying to get the value of a single channel (greyscale matrix). WHen I output it i get a bunch of values like this :

[0, 0, 0, 87, 147, 145, 140, 142, 144, 145, 138, 76, 2, 0, 0]


Here is how i declare the matrix:

Mat downSize = Mat(20,15,CV_32F,Scalar(0));


The matrix get filled up with any non-zero values and still displays properly like I have shown above. Now I am trying to get the value of any pixel so I use Mat.at, but its giving me huge numbers and really small numbers and anything in between. Isnt CV_32F a float? I was using float, but when that didnt work I used every other type (unsigned short, signed short ... double) and I still get thes outrageous values. Does anyone know what my problem is?

### Using Mat.at<>() is giving me numbers much larger than 255.

Hi guys I am trying to get the value of a single channel (greyscale matrix). WHen I output it i get a bunch of values like this :

[0, 0, 0, 87, 147, 145, 140, 142, 144, 145, 138,  [26, 189, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 55, 0;
70, 255, 18, 0, 0, 0, 0, 0, 0, 0, 0, 53, 212, 170, 0;
79, 249, 6, 0, 0, 0, 0, 0, 0, 37, 176, 227, 101, 1, 0;
99, 237, 0, 0, 0, 0, 0, 1, 106, 236, 121, 8, 0, 0, 0;
125, 213, 0, 0, 0, 0, 28, 181, 206, 42, 0, 0, 0, 0, 0;
150, 194, 0, 0, 10, 122, 235, 134, 7, 0, 0, 0, 0, 0, 0;
150, 193, 0, 49, 217, 173, 38, 0, 0, 0, 0, 0, 0, 0, 0;
169, 170, 92, 241, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
191, 252, 204, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
202, 255, 169, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
202, 158, 176, 215, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
203, 124, 0, 93, 242, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0;
202, 141, 0, 0, 52, 225, 150, 3, 0, 0, 0, 0, 0, 0, 0;
202, 141, 0, 0, 0, 24, 213, 177, 22, 0, 0, 0, 0, 0, 0;
202, 141, 0, 0, 0, 0, 10, 153, 222, 32, 0, 0, 0, 0, 0;
181, 156, 0, 0, 0, 0, 0, 1, 135, 231, 77, 0, 0, 0, 0;
176, 167, 0, 0, 0, 0, 0, 0, 0, 76, 2, 0, 0]
225, 161, 7, 0, 0;
159, 167, 0, 0, 0, 0, 0, 0, 0, 0, 19, 195, 185, 5, 0;
196, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 208, 180, 28;
12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 141, 121]


Here is how i declare the matrix:

Mat downSize = Mat(20,15,CV_32F,Scalar(0));


The matrix get filled up with any non-zero values and still displays properly like I have shown above. Now I am trying to get the value of any pixel so I use Mat.at, but its giving me huge numbers and really small numbers and anything in between. Isnt CV_32F a float? I was using float, but when that didnt work I used every other type (unsigned short, signed short ... double) and I still get thes outrageous values. Does anyone know what my problem is?

Edit: The image values get set by:

resize(image,downSize,downSize.size(),0,0,INTER_AREA);


image is a larger greyscale image. The above grid of values is what gets outputted after this resize. with:

cout << downSize << endl;


By the way I am getting extremely small values too.

Or values like -2.14381e+09.