[GRASS-user] Is mosaicing 24 bit images possible in Grass 6.2?

Hamish hamish_b at yahoo.com
Thu Jul 3 09:39:55 EDT 2008


Nagesh wrote:
> I intend to mosaic two 24 bit images in LAT LON location.
> I imported a 24 bit coloured PNG image in Grass using
> r.in.gdal in an x-y location.
> GRASS treated it as a combination of three 8 bit images,
> one for red, one for green, and one for blue and imported
> them as three separate maps.
> 
> After going through the archives, I tried to use r.patch to
> combine all the three components.

I think you mean to use r.composite there, not r.patch.

> The output of which wasn't a 24bit image but was only
> one of the components. (Not coloured)

the first map was "patched" over top of the other two.
 
> d.rgb module does display a coloured 24 bit image after
> inputing the three components to it.

Correct.
 
> I geocoded them to get non-coloured 8 bit geocoded images
> in the target location.
> 
> I did the same for the second 24 bit image.
> Mosaicing works fine(i.image.mosaic), but i need to use 8
> bit images(24 bit images converted to 8 bit images prior to
> importing, using xv; resolution weak)
> or any one of the 8 bit components of a 24 bit image.
> 
> Is there a way to mosaic 24 bit images and to output it as
> a single 24 bit image?

# expand region to cover both image regions
g.region rast=map1.red,map2.red

# merge bands together
for COLOR in red green blue ; do
  r.patch in=map1.${COLOR},map2.${COLOR} out=map.${COLOR}
end

# display mosaicked image
d.rgb r=map.red g=map.green b=map.blue

You will lose information if you use r.composite, best to keep bands separate unless you absolutely must combine them. (e.g. for NVIZ color drape)


Hamish




      


More information about the grass-user mailing list