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

Hamish hamish_b at yahoo.com
Wed Sep 30 12:12:45 EDT 2009


Georg wrote:
> Georg Kaspar wrote:
> > 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?

see also 'gdalinfo -stats' on raw data and 'r.info -r' on grass
maps.


where is rgb2his.c, I don't see it in grass 6.5

if that is a C module, ideally the 256 should be made a
module option which defaults to 256. 

see attached patch x6.5, I'm not quite sure if the approach is
right though so haven't applied it.

Also, for a long time I have wanted to replace the quick
sexidecimal method with propper cone geometry math, but not
found the time. It doesn't seem too hard, and computers are
much faster these days. :)


> to be more precise: how can i read-out the encoding of a
> raster file (or the maximum value) in c? I already took a
> look at the programmer's manual but didn't find what i'm
> looking for (i'm accustomed to javadoc...).

from d.legend:

    struct Range range;
    struct FPRange fprange;

...
    if (!fp) {
        if (G_read_range(map_name, mapset, &range) == -1)
            G_fatal_error(_("Range information for <%s> not available (run r.support)"),
                          map_name);

        G_get_range_min_max(&range, &min_ind, &max_ind);
        if (G_is_c_null_value(&min_ind))
            G_fatal_error(_("Input map contains no data"));

.
.
.

    else {                      /* is fp */
        if (G_read_fp_range(map_name, mapset, &fprange) == -1)
            G_fatal_error(_("Range information for <%s> not available"),
                          map_name);

        G_get_fp_range_min_max(&fprange, &dmin, &dmax);




but the max value should be the channel's max, not the observed
max, so I think the module option is better.

as for dull greys, the grey255 color map is there to force min=0
max=255. If you want grey66535 just copy the 255 file and edit
to suit.


Hamish


      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i_rgb_his_depth.diff
Type: text/x-patch
Size: 5147 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20090930/169d9edf/i_rgb_his_depth.bin


More information about the grass-dev mailing list