Image change detection

Change detection allows you to automatically highlight the differences between two images in the same area if they are properly orthorectified. In this recipe, we'll do a simple difference change detection on two images, which are several years apart, to see the differences in urban development and the natural environment.

Getting ready

You can download the two images for this recipe from https://github.com/GeospatialPython/qgis/blob/gh-pages/change-detection.zip?raw=true and put them in a directory named change-detection in the rasters directory of your qgis_data directory. Note that the file is 55 megabytes, so it may take several minutes to download.

How to do it...

We'll use the QGIS raster calculator to subtract the images ...

Get QGIS Python Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.