Ask Your Question

Revision history [back]

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.

click to hide/show revision 2
retagged

updated 2014-03-12 03:42:58 -0600

berak gravatar image

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.