Re: Can NCL be used to generate RGB composites?

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Mon Feb 22 2010 - 19:17:35 MST

Hi Simon,

Sorry for the delay answering this message. This is actually a very
pertinent topic and is one of the underlying motives for our addition
of new output workstations based on the cairo 2d graphics library.
More about this in a moment.

There is currently no way to directly display 3 channel RGB images in
NCL. NCL uses an indexed color model with a maximum of 256 colors.
You could display a 3-channel image as a raster or cell-filled contour
plot using the following steps:

1) Use some color quantization scheme to generate a suitable 256 color
table for the colors represented by your RGB data channels, or (for
crude output) simply pick one of NCL's pre-defined color tables (see http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml)
2) Map the RGB data channels into the color table you have defined

I am including a script that does this for an image very slowly and
crudely using a couple of standard NCL color tables merged together.
In this case the RGB components are the 3 elements of the rightmost
dimension, but the basic principle would be the same for 3 separate
color channel arrays. I am including a small PNG version of the
output. For comparison the original jpeg is also included. It is easy
to see that a colormap generated specifically for the image could make
the plot look much better. If geolocational coordinates were
appropriate for this image, then it could be overlaid on a map just
like any contour plot. Note you can create the input RGB file for this
script (too large for posting) if you have the ImageMagick 'convert'
utility. Just run 'convert staffa-boat.jpg staffa-boat.rgb'.

Once the Cairo workstations are in place, we will be implementing a
new (but backwards-compatible) direct color system that will eliminate
the need for color tables for RGB image graphics. We expect to
implement an ImagePlot object that will allow for fast high-quality
rendering and geolocation of a number of standard image formats
(including especially PNG and TIFF). These features will appear later
this year we expect. Hope this helps.
-dave

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Feb 22 19:17:51 2010

This archive was generated by hypermail 2.1.8 : Tue Feb 23 2010 - 08:26:41 MST