Example: Assign Channels

This topic shows how to use the Style pane for images to assign channels to display outputs such as R, G, B or A.  This topic shows examples of channel combinations and the visual results.

 

Different image formats utilize different arrangements of channels within the actual image data.  Some have the red channel first, while other arrangements have the blue channel first.  No matter what channel ordering is used within the data, Manifold's Style pane allows us to specify how those channels should be assigned to red, green and blue display outputs.

 

The Assign Channels button makes such typical reassignments of channels a one-click operation.  Using the Assign Channels button does not  change the order of data channels within the actual image.   It simply reassigns how the data should be interpreted for display purposes.   If we want to change the actual order of data in the image, we should use the technique illustrated in the Example: Rearrange Channels using an Expression  topic.   In this topic, we will use the Assign Channels button to change the interpretation of data within the image, without actually changing the data itself.

 

This example continues using the same example data as the Example: Using the Assign Channels Button topic.   Although the example image is a painting, these same techniques are utilized to assign channels in spatial data applications, for example, when building a false color image from multispectral satellite sensing data.

 

See also the Style: Channels and Outputs Tutorial topic.

 

il_style_image_source01_01.png

 

We open the sample ginevra image, a portrait of Ginevra de' Benci by Leonardo.   We then choose the Style pane and then we click on the right side of the big style properties button.

 

For RGB images by default the Style pane shows the default assignment of channels 2, 1 and 1 to the usual RGB outputs. The A, or alpha transparency channel has a fixed value of 0 since the original image is an RGB image without a fourth, A, channel.

 

il_style_image_source01_02.png

 

Channel 0 feeds the Blue or B output, Channel 1 goes to the Green or G output and Channel 2 drives to the Red or R output.   We will change that.    We begin by double-cicking the Channel 2 cell, to choose a different channel for the R output.

 

il_style_image_source01_03.png

 

In the pull down menu that pops open we choose Channel 1 to use that channel for the R output.

 

il_style_image_source01_04.png

 

The channels list updates to show that the R display output will be driven by the values found in Channel 1.   We press Update Style to commit the changes.

 

il_style_image_source01_05.png

 

The drawing immediately updates.  It looks less red and more gray because the content for the red display output is being driven by values in the channel that is also driving the green display output.    When similar values are used to drive the display outputs, more gray tones are the result.

 

Let us now use Channel 0 for the R display output.

 

il_style_image_source01_06.png

 

To do that, we double-click into the channel cell for the R row and in the pull down menu we choose Channel 0.  The pane updates the channels list to show that the R display output will take its values from Channel 0.    We press Update Style.

 

il_style_image_source01_07.png

 

The drawing updates so that regions where the channel originally intended to drive the Blue display output, Channel 0, were bright now appear in magenta tones that are a blend of blue and red,  in regions where the Red display output, using Channel 0, is also bright.

 

 

il_style_image_source01_08.png

 

We double-click into the channel cell for G output.

 

il_style_image_source01_09.png

 

In the pull down menu we choose Channel 0 and then press Update Style.  Now all three display outputs, R, G and B, are driven by the same channel.

 

il_style_image_source01_10.png

The result is a grayscale image that is a grayscale rendition of the values in channel 0.   When all pixels in an RGB image are the same value the result is a gray color.

Variations

We will now consider variations in how outputs are fed by channels or by values.

 

il_style_image_source01_11.png

 

In the above illustration we have assigned Channel 0 to R, Channel 2 to G and Channel 1 to B.   The Channel 0 set of intensities that originally were intended to drive the Blue output are now controlling Red, the intensities originally intended for Red, Channel 2, are now driving Green, and the original channel for Green, Channel 1, is now driving Blue.  Press Update Style.

 

il_style_image_source01_12.png

The result is an otherworldly image, with color tones somewhat reminiscent of false color satellite imagery built from infrared spectra.

 

il_style_image_source01_13.png

 

We can restore the original channel assignments by choosing Channel 2 for R, Channel 1 for G, and Channel 0 for B.  We press Update Style.

 

il_style_image_source01_14.png

 

The image is now back to using the intended channels to drive each display output.    That illustrates how shuffling channel assignments does not change the original data, which continues to be stored unmodified in tiles in the table from which the image is created.

Fixed Values for Outputs

So far we have chosen a channel to drive a given R, G, or B output.   We can also specify a fixed value to use for all pixels in a given display output.

 

il_style_image_source01_15.png

 

We double-click on the channel cell for the first, R, row.  

 

il_style_image_source01_16.png

 

In the pull down menu we choose Value.

 

il_style_image_source01_17.png

 

We specify a value of 125 and press Update Style.  This applies the same value, that is the display intensity, of 125 in all pixels for the Red display output.

 

il_style_image_source01_18.png

 

A Value of 125 is approximately half-way from no red, 0, to full intensity, 255, for the Red output.   The net effect is like replacing the red display output with a sheet of red plastic that is half-transparent.

 

il_style_image_source01_19.png

 

A more classic effect is to use a Value of 0 for the Red display output, in effect using only Blue and Green outputs to power the display.   Press Update Style.

 

il_style_image_source01_20.png

 

The result is the classic blend of Blue and Green channels, or cyan.

 

We can set a Value of 0 for all display outputs we would like to turn off, so that only one display output is used at a time.

 

il_style_image_source01_21.png

 

In the above arrangement we have assigned a Value of 0 to the R and G outputs and we have left the original Channel 0 driving the B output.   Press Update Style.

 

il_style_image_source01_22.png

This produces an image using only the Blue output.

 

il_style_image_source01_23.png

 

We assign a Value of 0 to R and B and we assign the original Channel 1 to G.  Press Update Style.

 

il_style_image_source01_24.png

This produces an image using only Green channel output.

 

il_style_image_source01_25.png

 

We assign a Value of 0 to G and B and we assign the original Channel 2 to R.  Press Update Style.

 

il_style_image_source01_26.png

This produces an image using only Red channel output.

 

To round out our presentation of how channels combine to create imagery, we will show how Green and Red produce yellow and then how Red and Blue produce magenta.

 

il_style_image_source01_27.png

 

We assign a Value of 0 to B and we assign the original Channel 2 to R and the original Channel 1 to G.  Press Update Style.

 

il_style_image_source01_28.png

 

This produces an image using only Red and Green outputs, resulting in yellow.

 

il_style_image_source01_29.png

 

Finally, we assign a Value of 0 to G and we assign the original Channel 2 to R and the original Channel 0 to B.  Press Update Style.

 

il_style_image_source01_30.png

 

This produces an image using only Red and Blue outputs, resulting in magenta.

 

il_style_image_source01_01.png

 

Considering the image that uses all channels to drive all three display outputs we can see how various combinations result in the classic presentation of Red, Green and Blue outputs with magenta, yellow and cyan combinations.

 

il_style_image_source01_31.png

 

Notes

"RGB" or "BGR"? - The universal slang for RGB images is, of course, "RGB images."  That slang refers to the use of Red, Green and Blue display outputs and does not arise from the literal order of data in the triplets of numbers that specify red data, green data and blue data.  Most users working with RGB images in graphics arts editing do not know and do not care what order channels come in, but when we are extracting data or mixing channels for multichannel remote-sensed images we must care about such technical details.  

 

Almost always the order of data in a triplet of image data numbers for a pixel is that blue comes first, green second and red third.  From a data perspective, the channel ordering is almost always BGR but such images nonetheless are referred to as "RGB" images.  

Downloads

Download the full size ginevra image from the Product Downloads page.

See Also

Images

 

Images and Channels

 

Palette Images

 

Style

 

Style: Images

 

Style: Channels and Outputs Tutorial

 

Style: Autocontrast

 

Style: Palettes

 

Example: How Images use Tiles from Tables - An example showing how an image is made up from data stored in a table in tiles.

 

Example: Create Two Images From One Table - More than one image can show data from the same table, including from the same tile field.

 

Example: An Image using Computed Fields in a Table - How an image can be created from tiles where the data for the tiles is taken from a field that is computed on the fly.

 

Example: Change the Contrast of an Image - In this example we use the Style pane to change the contrast of an image.

 

Example: Using the Assign Channels Button - The Assign Channels button in the Style pane for images allows us to assign channels to the standard three Red, Green, and Blue display outputs using frequently-desired arrangements.   The button provides a short cut way to assign all channels at once instead of doing each channel individually.

 

Example: Display an NAIP Four Band Image as Color Infrared (CIR) - How to use the Style pane for images to re-assign channels in a four band NAIP image to produce a Color Infrared (CIR) image display.

 

Example: Set Image Transparency using Alpha - The A row in the Style pane allows us to specify what transparency we want to apply to the image, either by applying the same value for A for all pixels or by using one of the other channels to also control the A value.

 

Example: Autocontrast and Hill Shading Images using Style - This example shows how the Style pane can hill shade an image using the values of pixels as heights and generating shadows as if the Sun were located at the specified azimuth and altitude.   This capability is used most frequently with raster images to give an impression of three dimensionality in cases where the values of pixels represent terrain elevations.

 

Example: Style Applied to an Image Server Image - Because the Style pane simply changes the way an image is displayed and not the data, it can operate on read-only data served by various web servers such as WMS REST servers.    In this example we look at every detail of creating a data source using an image server and then manipulating the appearance of the display with Style.  We will connect to a WMS server that provides LiDAR data in various forms, including as terrain elevation.

 

SQL Example: Create NDVI Displays - How to create a query that creates an NDVI display from a four-band NAIP image, with tips and tricks on how to copy and paste existing information to get the result we want.

 

Example: Rearrange Channels using an Expression - We use a simple expression in the Transform pane to rearrange the order of channels within the data.