Working with Multispectral Bands in QGIS

An updated tutorial is available here. This post is a quick tutorial about how to handle multispectral images in QGIS.
In this tutorial we are going to split the dataset that you can download from here (data available from the U.S. Geological Survey), using the functions provided by the SEXTANTE plugin and Orfeo Toolbox. For information about how to install and configure this plugin see here. In addition, we are going to create a multispectral image from single bands
At the end of this post you can find the video of this tutorial.

  1. Split the multispectral image to single bands
    • Open QGIS and load the raster dataset;
    • Open the Sextante Toolbox (from the menu Analysis click  Sextante toolbox) and double click Orfeo Toolbox > Image Manipulation > Split Image;
    • Under Input Image select sample_landsat; leave 128 under Available RAM (you could increase this value according to your computer specs); click the button ... and select Save to file ...;
    • Select where to save the bands (for instance create the folder bands) and type the file name (this will be the base name of the numbered bands) with .tif extension, for instance band.tif; click OK.

When the process is completed, there will be 6 files named band_0.tif, band_1.tif, band_2.tif, band_3.tif, band_4.tif, band_5.tif inside the bands directory.
The Semi-Automatic Classification Plugin automatically splits a multiband raster to single bands, when performing a classification, or even a classification preview.
This process requires time; therefore, if the image is quite large, it is recommended to split the image to single bands and create a band set before the classification. This way the plugin will classify raster bands directly, saving considerable time.
The following image shows the band set defined in the Semi-Automatic Classification Plugin.

However, it is possible to do the inverse process creating a single image file with multiple bands, which is the image concatenation. The classification of a single image file can be rapid enough if the image size is quite small, depending on your computer specs.

  1. Create a multispectral image from single bands
    • Load the single bands in QGIS; order the band names in ascending order in the Layers panel, from top to bottom (this will define the right band order in the image file);
    • Open the Sextante Toolbox and double click Orfeo Toolbox > Image Manipulation > Image Concatenation;
    • Under Input image list click the button ...; select all the single bands and click OK (you can see that band names are in the same order we have defined in the Layers panel); it should appear 6 elements selected;
    • Leave 128 under Available RAMclick the button ... and select Save to file ...;
    • Select where to save the multiband image (for instance create a folder multiband) and type the file name with .tif extension, for instance multiband.tif; click OK.

After a few seconds the multiband.tif file will be created, which has 6 bands and is identical to the original sample dataset.
The following is the video of this tutorial.

Newer posts Older posts