[GRASS-dev] i.rgb.his/i.his.rgb and 16bit images

Georg Kaspar georg at muenster.de
Wed Sep 30 10:16:00 EDT 2009


Hi,
after some problems converting 16bit quickbird images from rgb to ihs 
and vice versa (see user list), i took a look at the source code and 
discovered that pixel values are normalised by dividing by 255.
Naturally this leads to wrong values when using data with more than 8bit.

rgb2his.c

37 for (sample = 0; sample < columns; sample++) {
38 scaler = (double)rowbuffer[0][sample];
39 scaler /= 255.0;
40 scaleg = (double)rowbuffer[1][sample];
41 scaleg /= 255.0;
42 scaleb = (double)rowbuffer[2][sample];
43 scaleb /= 255.0;

this could be corrected by replacing the constant 255 with a variable 
according to the encoding of the image.
i'm not quite shure how to do this (only did some scripting so far) - 
can somebody help?
bests,
Georg



More information about the grass-dev mailing list