White pixel value different from 255
Hello,
I am working on image processing in C + + and opencv, I treat images in grayscale, ie the pixel values it must be between 0 (black) to 255 (white).
Mat img; img = imread (file, -1); for ( int i = 0; i < img. rows ; i ++) { for ( int j = 0; j < img. cols ; j ++) {
val_pixel=img.at < double >(i,j);
printf( "%d ",val_pixel); } printf( "\n"); }
when displaying the pixel value from two loop, I get values to 0 and it is normal for propablement black areas, but for whites I find the value -2147483648. I don't understand why this value is not 255.
Is there an explanation for this has value. Thank you for your support.
img.at < double >(i,j); // the 'double' is wrong.
the type inside the brackets has to match the Mat's type (uchar if grayscale, or Vec3b if color)