greyscale images

Michael Shapiro shapiro at zorro.cecer.army.mil
Thu Sep 24 23:57:03 EDT 1992


I have modified the way GRASS displays grey scale image (in the
upcoming 4.1) so that in colormode float, the colortable
is rescaled on the fly to fit the available colors slots.

Of course you could effect this by
	r.mapcalc 'x = #image'
	r.resacle iput=x output=y from=0,255 to=0,235
	r.colors y c=grey
and display y. The #image extracts the color for each category 
and makes x contain the category that was the color for the image.
Then you rescale x to y reducing the values from 0-255 to 0-235
and then add a linear grey scale to y..

As for "reset_color: can't set color 212" messages, they
shouldn't happens and can be considered bugs. What driver
are you using (XDRIVER?).

|
|Well, I approached this forum earlier on in my attempt to resolve my
|greyscale problem. I did try the solution suggested to me, but it
|didn't have much of an effect. I was still left with a maximum bandwidth
|of about 8 greyscales which was most insufficient.
|   Now however, it seems I have achieved somewhat of a temporary fix.
|Using any standard image enhancing program (I used xv), I modified
|the rgb proportions to be other than 1:1:1. Thus, although for intensive
|purposes it appeared to be grayscale, it was actually made up of green
|and blue combinations (while removing red). 
|   The result of this was that I had a raster file I could bring into
|grass with superb resolution. The only problem is the garbage colors
|between 220-255. For some reason it is unable to reset those and I 
|receive the error:
|reset_color: can't set color 212
|reset_color: can't set color 213
|etc...
|Now, I tried to use r.colors (rules) to map the rest of the upper colors
|(200-255) to white, since they don't play much of a part in the map's
|resolution. The only problem is that as soon as I add or change the
|color scheme (mapset/colr/*.cell) at all, the entire image becomes
|distorted and loses it's resolution.
|   Now, although I realize that few are manipulating greyscale images
|as such, I was hoping that you might have one or two solutions that
|could deal with such a problem? How can I append the mapping for
|the upper colors, and still maintain this cheat/fix I seem to have
|stumbled on? 
|   thanks in advance
|Steve Franklin
|p.s. If there are any more details you would like to know surrounding
|my set up, do not hesitate to mail me at franklin at ug.cs.dal.ca.
|
|
|


-----------------------------------------------------------------
Michael Shapiro                        U.S. Army CERL                  
email:   shapiro at zorro.cecer.army.mil  Environmental Division          
phone:   (217) 373-7277                P.O. Box 9005                   
fax:     (217) 373-7222                Champaign, Ill. 61826-9005
-----------------------------------------------------------------




More information about the grass-user mailing list