After processing your images with OTB, you probably want to see the result. As it is quite straightforward
in some situation, if can be a bit trickier in other. For example, some filters will give you a list of polygons
as an output. Other can return an image with each region labelled by a unique index. In this section we are
going to provide few examples to help you produce beautiful output ready to be included in your
publications/presentations.

The source code for this example can be found in the fileExamples/BasicFilters/ScalingFilterExample.cxx.

On one hand, satellite images are commonly coded on more than 8 bits to provide the dynamic range
required from shadows to clouds. On the other hand, image formats in use for printing and display are
usually limited to 8 bits. We need to convert the value to enable a proper display. This is usually
done using linear scaling. Of course, you have to be aware that some information is lost in the
process.

The source code for this example can be found in the fileExamples/BasicFilters/PrintableImageFilterExample.cxx.

Most of the time, satellite images have more than three spectral bands. As we are only able to see three
colors (red, green and blue), we have to find a way to represent these images using only three bands. This is
called creating a color composition.

Of course, any color composition will not be able to render all the information available in the
original image. As a consequence, sometimes, creating more than one color composition will be
necessary.

If you want to obtain an image with natural colors, you have to match the wavelength captured by
the satellite with those captured by your eye: thus matching the red band with the red color,
etc.

Some satellites (SPOT 5 is an example) do not acquire all the human spectral bands: the blue can be missing
and replaced by some other wavelength of interest for a specific application. In these situations, another
mapping has to be created. That’s why, the vegetation often appears in red in satellite images (see on left of
figure 23.2).

The band order in the image products can be also quite tricky. It could be in the wavelength order, as it is the
case for Quickbird (1: Blue, 2: Green, 3: Red, 4: NIR), in this case, you have to be careful to reverse the
order if you want a natural display. It could also be reverse to facilitate direct viewing, as for SPOT5 (1:
NIR, 2: Red, 3: Green, 4: SWIR) but in this situations you have to be careful when you process the
image.

To easily convert the image to a printable format, i.e. 3 bands unsigned char value, you can use the
otb::PrintableImageFilter .

The source code for this example can be found in the fileExamples/BasicFilters/IndexedToRGBExample.cxx.

Some algorithms produce an indexed image as output. In such images, each pixel is given a value according
to the region number it belongs to. This value starting at 0 or 1 is usually an integer value. Often, such
images are produced by segmentation or classification algorithms.

If such regions are easy to manipulate – it is easier and faster to compare two integers than a RGB value – it
is different when it comes to displaying the results.

Here we present a convient way to convert such indexed image to a color image. In such conversion, it is
important to ensure that neighborhood region, which are likely to have consecutive number have easily
dicernable colors. This is done randomly using a hash function by the itk::ScalarToRGBPixelFunctor
.

The source code for this example can be found in the fileExamples/BasicFilters/DEMToRainbowExample.cxx.

In some situation, it is desirable to represent a gray level image in color for easier interpretation. This
is particularly the case if pixel values in the image are used to represent some data such as
elevation, deformation map, interferogram. In this case, it is important to ensure that similar
values will get similar colors. You can notice how this requirement differ from the previous
case.

After generating the dem image as in the DEMToImageGenerator example, you can declare the hill
shading mechanism. The hill shading is implemented as a functor doing some operations in its
neighborhood. A convenient filter called otb::HillShadingFilter is defined around this
mechanism.