Change detection
Contents |
Pre-requisites of spatio-temporal image analysis
Correct the pixel intensities as much as possible for uninteresting differences:
- Sensor calibration
- Exact spatial co-registration of images (especially pixel-by-pixel comparision)
- Cloud and cloud shadow masking
- Haze reduction
- Atmospheric correction
- Topographic illumination correction (mountains)
- Clear definitions and classification scheme
Visualization of bi-temporal Sentinel-2 images (pre-event and post-event)
- Add subsets of Sentinel-2 multispectral scenes of August 2017 (subset_SA2_2017-08-15_MUL.tif) before the storm events, and May 2018 (subset_SA2_2018-05-07_MUL.tif) after storm events into the QGIS TOC.
- Create color composites RGB=9-7-3 Changing Raster Layer Style of a multiband file.
- Load the map (EMSR266_14BADGRUND_01DELINEATION_MAP_v1_300dpi.tif) showing the storm situation near Bad Grund in the Harz mountains after the winter storm Friederike. Change the Layer Style setting to RGB=1-2-3.
The map was produced by the European Copernicus EMS Rapid Mapping activity with the aim to provide an overview of the forest damages based on visual interpretation of very high resolution Pleiades satellite images (pre- and post-event).
- Load the shapefile EMSR266_14BADGRUND_DEL_v1_observed_event_a_EPSG32632.shp which contains delineated areas with loss of tree cover on top of the EMS map Bad Grund.
Globe plugin
- Currently the Globe plugin is not availabe for QGIS 3 and works only for QGIS 2. If it is already installed it just needs to be activated.
Plugins --> Manage and Install Plugins --> Installed. Click the checkbox or doubleclick the name Globe to activate the plugin.
- If the Globe plugin is not installed it may be be installed via the QSGeo4W setup as shown below.
- Plugins --> Globe --> Launch Globe. The Globe windows opens side by side to the map canvas.
- In the Globe viewer click on Globe settings . Switch off the atmosphere rendering by unchecking the box Sky. OK.
- Adjust the size of the Globe viewer to the same size as the map canvas.
- In the map canvas zoom in to a region of interest. Adjust the local histogram stretch for all layers in the TOC clicking (Raster Tools).
- In the Globe Viewer click on Layerand check the layers that you would like to see on top of the Globe Viewer.
- Click first on Reload layer and then Synchronize extent . The extents of the canvas (left: 2017) and the Globe viewer (right: 2018) are synchronized as shown below.
MapSwipe Tool plugin
This plugin is a map tool for swipe active layer, for example, you can see the difference with other layers below. The active layer, or group, will appear above all others.
- Select Plugins --> MapSwipe Tool or click . If the Plugin doesn't exist you'll first have to install it. Check Plugins --> Manage and Install plugins.. --> Settings Show also experimental plugins.
- Mark a layer below the top layer in the TOC and hold left click to blend to and compare two layers.
- You can also use Google Satellite as active layer!
Temporal/Spectral Profile plugin
This plugin is for interactive plotting of temporal or spectral information stored in multi-band rasters. After installation and activation the plugin can be accessed either from main menu Plugins --> Profile Tool --> Temporal/Spectral Profile) or from an icon on the taskbar.
Plot different dates of multispectral images
- Load 2 multispectral Sentinel-2 files from different dates into the QGIS legend (TOC).
- Mark the layer name of first date in the TOC.
- Click to open the Temporal/Spectral Profile Tool.
- Mark the layer name of second date in the TOC and click Add Layer
- Click on a location in the canvas.
Plot times series of stacked NDVI images
- Load a temporal stack of NDVI images of different dates into the TOC.
- Mark the layer name in the TOC
- Click to open the Temporal/Spectral Profile Tool.
- Select as X-axis steps Settings --> From string.
- Type in the text field the years or dates of the NDVI images (e.g. 1992;2006;2010)
- Click on a location in the canvas.
Change detection techniques
Bitemporal
Post-classification Comparison
This is an indirect change detection method: First two co-registered satellite images are independently classified to yield thematic maps. Then, discrete class labels of two thematic raster layers are compared to determine changes using cross-tabulation in which all transitions are presented. Use the Semi Automatic Classification plugin: SCP --> Postprocessing --> Cross classification
Raster algebra: Difference
- In the search engine of the Processing Toolbox Toolbox (or mapla.bat in the standalone OTB), type Radiometric and select Radiometric Indices under Feature Extraction of the Orfeo Toolbox.
- Select the Sentinel-2 subset_SA2_2017-08-15.tif file as input layer.
- Assign the spectral bands to the right band number as shown below.
- Choose ndvi from the Available Radiometric Indices drop-down list to calculate the Normalized Difference Vegetation Index (NDVI).
- Enter name and path for an output file.
- Click on Run.
- Calculate also the NDVI of the Sentinel-2 image subset_SA2_2018-05-07_MUL.tif.
- Calculate the difference between the NDVI 2018 and NDVI 2017 using the Raster Calculator.
- Click Raster --> Raster calculator.
- A difference NDVI is calculated by the expression as shown below.
- Define path and file name of the output layer. OK.
- Mark the difference NDVI image right click Properties --> i Information . In the "properties" window scroll down and report mean STATISTICS_MEAN and standard deviation STATISTICS_STDDEV.
- Find threshold values for forest change areas: Calculate threshold 1 = mean - 2 * stddev and
threshold 2 = mean + 2* stddev.
- Layer Properties --> Histogram to plot the difference histogram.
- Layer Properties --> Symbology. Change Render type to Singleband Pseudocolor
- Load min/max values: Activate the radio button Min / max.
- Choose Accuracy: Actual(Slower) and click Apply.
- Choose Interpolation: Discrete.
- Select a color table. Color: Spectral. Check Invert.
- Mode: Equal interval. Number of Classes: 3.
- Type for Value <= :
first line: -0.23 (threshold 1)
second line +0.33 (threshold 2)
- Layer Properties --> Transparency. Click to add a new line in the pixel transparency list. Type values From: -0.33 and To: 0.23. OK. The specified range of the difference raster is now transparent and can be overlaid on top of Google Satellite and the Landsat composites.
Raster algebra: Ratio
Calculate the ratio of NDVI images 2017 and 2018 with the Raster --> Raster Calculator.
- Choose ndvi_2018@1 from the Raster bands by double clicking on the raster name.
- Choose the division operator from the Operators by clicking on /.
- Choose ndvi_2017@1.tif from the Raster bands by double clicking on the raster name.
- Save the Output layer as ndvi_ratio and press OK.
Raster algebra: Change vector analysis
- Type into the Windows search field saga and click SAGA GIS.
- Load files: In the Manager windows choose the Data tab. Drag and drop the files ndvi_2017.tif and ndvi_2018.tif from Windows file explorer into the Data tab.
- Click Tools --> Grid --> Analysis --> Change Vector Analysis.
- Specify Grid system.
- Input features are supplied as ndvi_2017.tif for Inital State and ndvi_2018.tif for Final State. In case two or more grids are used as features the same layer order has to be defined in both lists. Distance is measured as Euclidean distance in features space. When analyzing two features direction is calculated as angle (radians) by default. Otherwise direction is coded as the quadrant it points to in terms of feature space.
- Check Output of change vector.
- Click Execute.
- Click Geoprocessing --> File --> Grid --> Export --> Export Geotiff.
- Specify Grid system.
- As Grid choose Change vector 1.
- Choose name and path for the output file.
- Click OK.
- Open the file in QGIS and choose a color table in Layer properties --> Symbology --> Band rendering --> Singleband pseudocolor
Change classification
The resulting layers of raster algebra are classified according to specific change types. In case we are only interested in changes of one land cover type (e.g. coniferous forest) we may create a binary mask.
- Load the file FTY_2012_020m_eu_conifers_mask.tif into QGIS. It was extracted from the class 2 = coniferous forest of the pan-european Copernicus Land Cover product Forest Type 2012.
- Multiply the binary mask with the raster of the change vector analysis using Raster --> Raster calculator.
- In the search engine of the Processing Toolbox, type connected and select ConnectedComponentSegmentation under Segmentation of the Orfeo Toolbox.
- Under the Parameter tab, select the raster file change_vector1 _masked.tif as the input layer.
- Type the mask expression b1 < 0.25.
- Type the connected component expression distance < 0.1.
- Click on Run to execute the algorithm.
Bi-temporal color composite
- Stack two or three ndvi raster files from three different dates with Toolbox --> GDAL/OGR --> [GDAL] Miscellaneous --> Merge. See also Create stack.
- Layer Properties --> Style. Assign two ndvi images to RGB colors.
- Red, cyan: high value in one date and low in the others. Change from one date to the other.
- Gray levels: indicate features are unchanged.
Multi-temporal
Multi-temporal color composite
- Stack three ndvi raster files from three different dates with Toolbox --> GDAL/OGR --> [GDAL] Miscellaneous --> Merge. See also Create stack.
- Layer Properties --> Style. Assign the three ndvi images to RGB colors.
- Red, green, blue: high value in one date and low in the others. Change from one date to the other and invariant afterwards
- Gray levels: indicate features are stable in all dates.
- Yellow (R+G), cyan (G+B), or magenta (R+B): high values in two dates and low in the other. Change from two dates to the third one.
Use the Spatial/Temporal plugin to plot time series and understand the colors in the multitemporal color composite.
Principal component analysis
- Stack three Landsat multispectral images from three different dates with Toolbox --> GDAL/OGR --> [GDAL] Miscellaneous --> Merge. See also Create stack.
- Perform a Principal component analysis on the stacked 12 bands of the multitemporal Landsat images. Enter 5 as number of components and visualize them as color comoposite. Currently only works using the OsGeo4W Shell!
Joint classification
The multi-temporal color composite and the principal components of the multitemporal stack can be used as input in to per pixel supervised classification. This approach requires the collection of training data of change and no-change areas.
Time series viewer
Install the QGIS Plugin Earth Observation (EO) Time Series Viewer. This plugin is still experimental and might crash depending on the type of your graphic card.
- Start QGIS 3 and open Plugins --> Manage and Install Plugins. Search for EO and install
the EO Time Series Viewer. The EO Time Series Viewer requires the following packages:
pyqtgraph pyopengl
- Install dependencies:
- Windows
open the OSGeo4W Shell and type in the console:
call py3_env.bat python3 -m pip install pyqtgraph python3 -m pip install pyopengl
In case pip is not available in the OSGeo4W Shell, enter
setup
in the shell, which will start the OSGeo4W installer. Then navigate through
Advanced Installation --> Installation from Internet --> default OSGeo4W root directory --> local temp directory --> direct connection --> Select downloadsite --> http://download.osgeo.ogr
Now use the textbox to filter, select and finally install the following package: python-pip
- Mac
On Mac you should be able to use the same commands in the terminal, as long as pip is available, i.e.
python3 -m pip install pyqtgraph python3 -m pip install pyopengl