I am implementing an image processing filter within OTB (a C++ library).
I got a strange behaviour with some very basic testing. When I read my image as "char", the following code always outputs the pixel value (in the 0-200 range) even if it is larger than 150. However, it works fine when I use "short int". Is there a special behaviour with "char" (like a letter comparison instead of its numerical value) or could there be any other reason ?
Of course, my image pixels are stored in Bytes, so I prefer to handle "char" instead of "int" because the image is quite large (> 10 Gb).
if (pixelvalue > 150)
{
out = 255;
}
else
{
out = pixelvalue;
}
unsigned char
runs to (at least) 255, but char
may be signed and limited to 127.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With