d.rgb d.his

Jim Westervelt westerve at marla.urban.uiuc.edu
Tue Apr 14 17:57:17 EDT 1992


Jinn-Guey Lay questions:

#I was trying to display an elevation map in color with a shadow 
#releif map in grey tone. I have tried 'd.his' using elevation
#as hue and shadow relief as intensity. It looks OK only if I stay
#far enough; the display is somehow noisy with many pixels of
#different colors scattering arround.

 This is probably the best that GRASS (and your display monitor) can do.
 I suspect that the scattering of different colors would be corrected if
 you put the monitor into "fixed" mode.  (d.colormode fixed)  If the
 scattering you talk about is on the subtle side - colors just slightly off,
 then your colormode is "fixed" and the d.his program is dithering the
 available colors to get the best representation it can out of a 6x6x6
 color table (RxGxB).   Basically you (and GRASS) are asking too much of
 8 bit planes of graphics - you are experiencing the lure of 24 bit plane
 devices.

#I've checked the manual and it seems to me that 'd.rgb' will not
#display the values from the individual R, G, B files; rather,
#it will take averages of them, therefore the RGB values displayed 
#by 'd.rgb'are different from the original RGB values defined
#in the color table of elevation. 

 Correct.  d.rgb was created to display three "grey-scale" sets of data.
 It forces a grey-scale by averaging the RGB values.

#So, how can I display a map using its RGB values?  
#Does any netter have similar experience on these problem?
#Any advice on 'd.rgb', 'd.his', and map overlay will 
#be appreciated.

 You have done what you can with your 8-plane graphics device and GRASS.
 We have experimented with approaches to capturing d.his output into
 24-bit map files and then reducing this result to 8 bits by finding
 the most common colors.  There are several known approaches to this
 process which have been played with through other packages.  We've never
 had a strong enough need (nor has anyone contracted) for this capability.

 Users are encouraged to stick with "colormode fixed" which is the default
 anyhow because it allows the simultaneous rendering of many maps.
 Processing a 24-bit map into an 8-bit map with a color table that is
 ONLY useful through "colormode float" can also be problematic with 
 simultaneous displays.

 If you are a programmer, you might want to consider the following approach:
 1) Modify d.rgb to generate 24-bit output maps
 2) Write a new program that converts the 24-bit map to an 8-bit map.  A
    translation and color table is generated by the following flow:
    1) Split the 256x256x256 (RGB) color space into 8 quadrants.
    2) Divide all the pixels into the different quadrants by assigning each
       pixel to the geometrically closest quadrant.
    3) Count the total in each quadrant.
    4) If there are < 256 quadrants, create a color map and translate the
       24 bit map into an 8 bit map.  Quit
    5) Split the quadrant with the most colors into 8 smaller quadrants.
    6) Go to 2
 3) Such code has been written for other systems and may be available

 Alternately, buy a 24-bit device and upgrade all of GRASS to utilize the
 full 24 bits :-)



More information about the grass-user mailing list