[GRASS-user] error message coming with r.colors
Glynn Clements
glynn at gclements.plus.com
Tue Aug 5 20:14:58 EDT 2008
Nikos Alexandris wrote:
> > The -g and -e switches make grey.log and grey.eq redundant
>
> By the way, something I don't understand (copy-paste from the manual):
>
> The -e flag equalizes the original raster's color table. It can preclude
> the need for grey.eq rule, when used as -e color=grey. Note however,
> that this will not yield a color table identical to color=grey.eq,
> because grey.eq scales the fraction by 256 to get a grey level, while -e
> uses it to interpolate the original colour table.
It then goes on to say:
If the original colour table is a 0-255 grey scale, -e is
effectively scaling the fraction by 255. Different algorithms
are used. -e is designed to work with any color table, both
the floating point and the integer raster maps.
Essentially the only difference is in how a floating-point value
between 0 and 1 is converted to an integer between 0 and 255. In
practice, the difference will be invisible to the eye.
Here's a concrete example:
$ r.colors elevation.dem -e color=grey
Reading elevation.dem ...
Color table for <elevation.dem> set to grey
$ r.mapcalc 'tmp1 = r#elevation.dem'
$ r.colors elevation.dem color=grey.eq
Reading elevation.dem ...
Color table for <elevation.dem> set to grey.eq
$ r.mapcalc 'tmp2 = r#elevation.dem'
$ r.mapcalc 'diff = tmp1 - tmp2'
$ r.stats -c diff
-1 155417
0 147001
r.stats complete.
So, roughly half the cells are identical between the two, while half
differ by one intensity level.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list