Tuesday, July 25, 2017

Using Orfeo ToolBox to combine grayscale TIFF images into RGB and CIR composites

For working with geo-referenced TIFF images, Orfeo ToolBox (OTB) provides a useful convenience function otbcli_concatenateImages to combine separate grayscale images into a composite file. Examples of separate bands of grayscale images are shown below.

For instance, the separate grayscale bands representing the red, green and blue channels can be combined into a single RGB composite image. To do this using OTB, the following steps can be done.

  1. Open up a OSGeo4W Command Prompt.
  2. At the prompt, type in the otbcli_concatenateImages command with options:

    C:\> otbcli_concatenateImages -il band_red.tif band_green.tif band_blue.tif -out rgb.tif uint16

    where
    band_red.tif, band_green.tif, and band_blue.tif are the input files in the correct order,
    rgb.tif is the output RGB composite file
    uint16 is the output file datatype. By default it is float32 but that is too much. 
  3. Run the command.

    Processing messages appear. The bands are merged into the output file rgb.tif.
  4. Optional. Display the resultant file in a suitable viewer.

Similarly, to combine the separate grayscale bands into a composite Colored Infra-Red CIR file, the following steps can be done.

  1. Open up a OSGeo4W Command Prompt.
  2. Type in the otbcli_concatenateImages command.

    C:\> otbcli_concatenateImages -il band_nir.tif band_red.tif band_green.tif -out cir.tif uint16
    Where
    band_nir.tif, band_red.tif, and band_green.tif are the ordered input bands
    cir.tif is the output file name
    uint16 is the output file data type
  3. Run the command.

    Processing messages appear. The bands are merged into the output file cir.tif.
  4. Optional. Display the resultant file in a suitable viewer.


No comments:

Post a Comment