[GRASS-user] composite raster maps

Hello there,

I just realize I've used r.composite for ages without wondering how I
could perform the reverse task. The thing is I ran r.composite on a 3
band geotiff orthoimage, dropped the initial .red, .green and .blue
rasters, and I would need them now in order to run r.out.vtk with the
rgbmaps argument. Dummy...

A quick glance at the composite raster color table makes me think it
might be quite easy to do. Is there a command for this opération or
should I try to write a script to do the job ?

Thank you,
Vincent

On Mon, Nov 25, 2013 at 7:22 AM, Vincent Bain <bain@toraval.fr> wrote:

Hello there,

I just realize I've used r.composite for ages without wondering how I
could perform the reverse task. The thing is I ran r.composite on a 3
band geotiff orthoimage, dropped the initial .red, .green and .blue
rasters, and I would need them now in order to run r.out.vtk with the
rgbmaps argument. Dummy...

You can use the # operator of r.mapcalc:

r.mapcalc "map.red = r#map"
r.mapcalc "map.green = g#map"
r.mapcalc "map.blue = b#map"

Markus M

A quick glance at the composite raster color table makes me think it
might be quite easy to do. Is there a command for this opération or
should I try to write a script to do the job ?

Thank you,
Vincent

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Thank you much Markus,
never noticed this mapcalc operator before, great !

Vincent

Le lundi 25 novembre 2013 à 12:10 +0100, Markus Metz a écrit :

On Mon, Nov 25, 2013 at 7:22 AM, Vincent Bain <bain@toraval.fr> wrote:
> Hello there,
>
> I just realize I've used r.composite for ages without wondering how I
> could perform the reverse task. The thing is I ran r.composite on a 3
> band geotiff orthoimage, dropped the initial .red, .green and .blue
> rasters, and I would need them now in order to run r.out.vtk with the
> rgbmaps argument. Dummy...

You can use the # operator of r.mapcalc:

r.mapcalc "map.red = r#map"
r.mapcalc "map.green = g#map"
r.mapcalc "map.blue = b#map"

Markus M

>
> A quick glance at the composite raster color table makes me think it
> might be quite easy to do. Is there a command for this opération or
> should I try to write a script to do the job ?
>
> Thank you,
> Vincent
>
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

Markus Metz wrote:

> I just realize I've used r.composite for ages without wondering how I
> could perform the reverse task. The thing is I ran r.composite on a 3
> band geotiff orthoimage, dropped the initial .red, .green and .blue
> rasters, and I would need them now in order to run r.out.vtk with the
> rgbmaps argument. Dummy...

You can use the # operator of r.mapcalc:

r.mapcalc "map.red = r#map"
r.mapcalc "map.green = g#map"
r.mapcalc "map.blue = b#map"

Note that GRASS 7 has the r.rgb script which does just this.

Also, note that an r.composite+r.rgb round-trip normally loses
accuracy. By default, the maps generated by r.composite only use 32
levels for each component (equivalent to a 15-bpp image).

You can avoid this with "r.composite ... levels=256", but the
resulting maps will have much larger colour tables (65536 rules rather
than 1024), which can make certain operations significantly slower.

--
Glynn Clements <glynn@gclements.plus.com>

OK for the caution Glynn,

for my particular concern I finally re-ran the process from the source
files.

Thank you,
V.

Le mardi 26 novembre 2013 à 19:07 +0000, Glynn Clements a écrit :

Markus Metz wrote:

> > I just realize I've used r.composite for ages without wondering how I
> > could perform the reverse task. The thing is I ran r.composite on a 3
> > band geotiff orthoimage, dropped the initial .red, .green and .blue
> > rasters, and I would need them now in order to run r.out.vtk with the
> > rgbmaps argument. Dummy...
>
> You can use the # operator of r.mapcalc:
>
> r.mapcalc "map.red = r#map"
> r.mapcalc "map.green = g#map"
> r.mapcalc "map.blue = b#map"

Note that GRASS 7 has the r.rgb script which does just this.

Also, note that an r.composite+r.rgb round-trip normally loses
accuracy. By default, the maps generated by r.composite only use 32
levels for each component (equivalent to a 15-bpp image).

You can avoid this with "r.composite ... levels=256", but the
resulting maps will have much larger colour tables (65536 rules rather
than 1024), which can make certain operations significantly slower.