/

December 6, 2019

How to create your own false color image

header multispectral

Start combining different information altogether to improve your detector. Create your own false color image.

Updated: May 2020

We often get asked about using images that are not simply RGB in our Platform. For example, we have users who want to:

  • Take advantage of their Near-Infrared (NIR) band for some of their agriculture applications
  • Use the Digital Surface Model (DSM) or Digital Height Model (DHM) in an urban setting
  • Use other bands than RGB from a multispectral sensor

All of this is actually possible on our Platform. Although the Platform is limited to processing 3 bands, those bands don’t have to be RGB bands. The key to process those additional bands is to create a false color image. A false color image is an image with 3 bands, but where those bands are not the typical Red, Green and Blue.Very often, you will see false color images which replaces the red channel by the NIR band, the green channel by the Red band and the blue channel by the Green. This has been the typical false color images in remote sensing for decades, extremely useful for applications related to vegetation.

However, we are not limited to this type of false color. Instead, you could for example do a false color image where:

  • The first band is the red band (as usual)
  • The second band is the green band (as usual)
  • The third band is a DHM band (replacing the usual blue band)

If you then upload this image on the Picterra Platform, our algorithms will learn from those 3 bands and will therefore learn from the DHM data!

In this article, we’ll discuss how to create such false color images in QGIS. We will be using QGIS version 3.4, but new versions should work as well.

header multispectral

Creating a false color image in QGIS

As an example scenario for this article, we’ll use :

  • A DHM (digital height model) image, that is initially of float type
  • A RGB image
Input RGB image
Input DHM image

We want to build our false color image with the red and green bands of the RGB image combined with the DHM.

Save a rendered version of the DHM

The first step is to save a rendered version of the DHM tif. DHM data is often stored as floating point values in 32-bits, but in the end we want a tif with byte (or uint8) bands.

When you load a floating point image in QGIS, you can see that from the Raster properties:

To convert the raster to byte type, you can right click on your raster and select ‘Export -> Save As’. Then, select ‘Rendered image’ output mode. Enter a file name and save your new image.

If you open the resulting file, it should look visually exactly the same in QGIS, but the difference is that if you look at the raster properties, it should now be a 4 bands byte image and the values of each pixel are between 0 and 255. When saved as Rendered image, QGIS creates 4 bands (RGBA) from the greyscale image. However, all the RGB bands are the same, so we’ll pick one to use later.

Install the 'Virtual Raster Builder' plugin

You need to install a QGIS plugin called ‘Virtual Raster Builder’ :

Once the plugin has been installed, you can access it through an icon in your QGIS menu bar:

Build the virtual raster

Start the ‘Virtual Raster Builder’. Drag and drop both the original RGB image and the DHM rendered image (that you saved above) in the ‘Source Files’ panel of the ‘Virtual Raster Builder’.

Now, drag and drop bands 1 (Red) and 2 (Green) from the RGB image and band 3 from the DHM image in the ‘Virtual raster’ panel on the left.

Finally, switch to the ‘Output’ tab and:

  • The down arrow next to ‘Copy the pixel resolution from another source’ and select the image with the highest resolution (RGB in our case). You should see the ‘Pixel size’ input update
  • The down arrow next to ‘Copy the spatial extent from another source…’ and select one of the image. This will define the spatial extent of the output raster and should update the ‘Input Raster‘ panel on the bottom left of the window.
  • Specify and output filename in ‘Output’

Click on ‘Save’. This should open the virtual raster in QGIS and you should see your false-color image. As you can see, since we replaced the third band, which is displayed as blue, by the DHM, the higher objects have a blueish color.

Turn the Virtual Raster into an actual TIFF

The last QGIS step is to save the Virtual Raster into an actual TIFF file. To do this, right click on the virtual raster and then select ‘Export -> Save As’. Select ‘Rendered image’ as done for the DHM previously. Enter a filename and you’ll have your custom false color R/G/DHM composite!

Upload the TIFF to the Picterra platform

You can now upload the TIFF to the Picterra platform and train a custom detector on it. The custom detector that you trained will then learn from the Red and Green bands of the RGB raster plus the DHM:

Conclusion

We have seen how to create a Red/Green/DHM false color image and how to process it in the Picterra Platform. You can now do your own combination and your imagination and your data is the limit !

For example, you could:

  • Do a false color image where each band is the NDVI at a different date. So you can classify your crops based on 3 dates.
  • Put three different indices in order to classify more accurately different states of vegetation or wetness of soils.
  • Pack more than 3 bands into the false color image. This is a bit more technical, but if you compress your bands to half a byte (4 bits), you can then pack 6 bands into a false-color image!

If you’d like us to explore those directions in a future article, please reach out!

Want to learn more?

sign up to our newsletter