6  A Complete tutorial for Remote Sensing Practice

6.1 Data Preparation

6.1.1 Data download

Download Sentinel data of any region of your interest and unzip it. For processing of the data I will use QGIS. The steps below explains how to do it. However you can also use other software.

6.1.2 Sentinel data structure

SNAP software allows you to directly display the zip file and to process it, however you will need to know the data(folder) structure of Sentinel-2 granules for processing in other software. The images are saved at depth as shown in the following figure.

Folder structure of Sentinel Image

The image data are in 3 different spatial resolutions as shown in the following table.

Sentinel Bands
Band Resolution Central.Wavelength Description
B1 60 m 443 nm Ultra blue (Coastal and Aerosol)
B2 10 m 490 nm Blue
B3 10 m 560 nm Green
B4 10 m 665 nm Red
B5 20 m 705 nm Visible and Near Infrared (VNIR)
B6 20 m 740 nm Visible and Near Infrared (VNIR)
B7 20 m 783 nm Visible and Near Infrared (VNIR)
B8 10 m 842 nm Visible and Near Infrared (VNIR)
B8a 20 m 865 nm Visible and Near Infrared (VNIR)
B9 60 m 940 nm Short Wave Infrared (SWIR)
B10 60 m 1375 nm Short Wave Infrared (SWIR)
B11 20 m 1610 nm Short Wave Infrared (SWIR)
B12 20 m 2190 nm Short Wave Infrared (SWIR)

You can also check the QGIS browser to check the folder structure.

Sentinel data structure viewed in QGIS browser

6.1.3 Band selection (Band subset)

We will use all the bands with resolution of 10m and 20m. Which means, we will be using: B2 to B8, B8A, B11 and B12. You should be carefull that downsampled data of higher resolution images are also available inside the folders R20 and R60. We will display 10m resolution data from R10 and 20m resolution data from R20.

6.1.4 Display image data in QGIS

Select Image data from corresponding folder and add to the QGIS map canvas. Your layers should look like this.

Image data layers

6.2 Data Processing

6.2.1 Create RoI (Region of interest)

6.2.1.1 Steps of creating RoI

  • Toolbar (Data Source Manager toolbar) -> Create scratch layer -> Geometry type polygon (Choose the UTM Projection same as your data, in my case UTM 45N)
  • The scratch layer will be in editing mode.
  • Menu (Edit) -> Add Rectangle -> Any of the four methods**
  • Create RoI of around 20km x 20km

RoI

6.2.2 Clip the rasters

  • (Menu) Raster -> Extraction -> Clip Raster by mask layer
  • Click Run as Batch Process
  • Autofill Input Layer
  • Set RoI as mask layer
  • Select output file names
  • Leave optional columns
  • Run
  • Check the following figures for reference

Batch process - Left part

Batch process - Right part
  • Remove original raster from display
  • Keep the clipped raster
  • Output layers are shown below
  • Clipped layers
  • Clipped layers

6.2.3 Resample clipped rasters (20m resolution) to 10m

  • (Processing tool) r.resample
  • Run as batch process

Resample - Run - Remove raster layers with 20m resolution. Keep layers with 10m resolution. - Now we have layers: B2, B3, B4, B5, B6, B7, B8, B11, B12, B8A

6.2.4 Combine the layers

Now we have all the layers in 10m resolution. We can combine the layers using raster tool called Merge.

  • (Menu) Raster -> Miscellaneous -> Merge
  • Select all the layers for input
  • Check Place each input file into a separate band
  • Select output file (Geotiff): e.g., sentiinel_merged.tif
  • Run
  • Compare the output with original layers and find which layer corresponds to which band of merged layer
  • In my case the band correspondance is as follows
Band correspondance
Original bands Merged bands
B2 B1
B3 B2
B4 B3
B5 B4
B6 B5
B7 B6
B8 B7
B8A B8
B11 B9
B12 B10

Further processing and practice will be done in SNAP Desktop software.

6.3 Using SNAP

6.3.1 Open and display product

  • Open Product (Choose the merged GeoTIFF file)
  • Display some of the bands and tile horizontally
  • Display RGB image by right-clicking the product
    • Any one band (gray scale)
    • R, G and B channels corresponding to original channel to produce natural color image.
    • NIR, R, G channels to produce false color image
    • In the navigation panel chose sychronize so that all the images are aligned properly.

See the image below.

1. Natural color image, 2. False color (NIR, R, G), 3. B2, 4. B4

6.4 Other band combinations

6.4.1 Short-Wave Infrared (B12, B8A, B4) -> (B10, B8, B3)

Short-Wave Infrared

6.4.2 Agriculture (B11, B8, B2) -> (B9, B7, B1)

Agriculture (B11, B8, B2) -> (B9, B7, B1)

6.4.3 Geology (B12, B11, B2) -> (B10, B9, B1)

Geology

6.5 Raster processing

Create some of the raster processed products as described below.

6.5.1 Create NDVI and Moisture Index

  • NDVI (B8, B4)->(B7, B3) as NIR and R bands

NDVI calculation
  • NDVI output (after some color manipulation)

NDVI output
  • Moisture index (Optical -> Thematic Land Processing -> Water Radiometric Indices -> NDWI)

  • Output of moisture index (B8A-B11)/(B8A+B11) -> (B8-B9)/(B8+B9)

NDWI calculation

6.5.2 Create Filtered bands

Try to create some filtered bands.

6.5.2.1 Low pass filter

  • Create low pass filter of any band and show the original band side by side to so the difference. You can choose 3x3 or 5x5 window.
  • Create high pass filter and show the original band side by side to show the difference.
  • For proper comparison, keep the color range the same as shown in the next figure.
  • Change color range

Change color range

Output image is shown below

1. Original image, 2. Low pass filter

6.6 High pass filter and Laplacian filter

Similarly create a high pass filter and laplacian filter and compare with original In this case you don’t need to change the color range as the high pass filtered image has large range of values Output of both filters are shown below

1. Original image, 2. High pass filter

1. Original image, 2. Laplacian filter

Note: Save the product as SNAP-dim (default) after creating filters

6.7 Principal Component Analysis (Dimensionality reduction)

6.7.1 Theoretical background

Principal Components Analysis (PCA)PCA is a mathematical technique that transforms a quantity of correlated variables into a number of uncorrelated linear variables called principal components (PCs). The PCA is usually implemented on a square symmetric matrix. It can be based on the covariance matrix (scaled sums of squares and cross products) or correlation matrix. (See the lecture slides and other references)

PCA and other references

6.7.2 Calculate PCA using bands 2, 3, 4, 8,11 and 12 -> (B1, B2, B3, B7, B9 and B10)

  • Raster -> Image Analysis -> Principal component analysis
  • Select the output folder
  • Check the bands in processing parameters

PCA dialog box in SNAP

6.7.3 Display first three bands of PCA as RGB

PCA dialog box in SNAP

6.8 Image Classification (Theory)

Next section will explain the theoretical background of supervised and unsupervised classification.

6.8.1 Unsupervised classification or Clustering

(Source: Semi Automatic Plug-in Manual)

(For practical exercise check the next section)

The classification of image is carried out without input of training data. The software automatically classifies the image based on the pixel values of different bands. There are many different algorithms which treats the combination of pixels from different bands in different ways. There are following methods (algorithms used in unsupervised classification).

Clustering is the grouping of pixels based on spectral similarity (e.g. Euclidean Distance (page 144) or Spectral Angle (page 144)) calculated for a multispectral image (Richards and Jia, 2006). Clustering can be used for unsupervised classification or for the automatic selection of spectral signatures. It is worth noticing that, while Supervised Classification (page 135) produces a classification with the classes identified during the training process, the classes produced by clustering (i.e. clusters) have no definition and consequently the user must assign a land cover label to each class.

The main advantage of clustering resides in automation. Of course, clusters do not necessarily represent a particular land cover type and additional processing could be required for producing an accurate classification. There are several types of clustering, mainly based on iterative methods; the following are the algorithms provided in SCP.

SCP provides the algorithms listed in the next section.

6.8.2 K-means classification

The K-means method is based on the calculation of the average spectral signature of clusters (Wikipedia, 2017; JARS, 1993). At first, the user defines the number of clusters expected in the image, which correspond to as many spectral signatures (i.e. seeds). Starting spectral signatures can be selected in various ways (e.g. randomly, provided by the user, calculated automatically from image values). During the first iteration clusters are produced calculating the pixel spectral distance with initial spectral signatures. The algorithms Euclidean Distance (page 144) or Spectral Angle (page 144) can be used for distance calculation. Pixels are assigned according to the most similar spectral signature, therefore producing clusters. Then, the average spectral signature is calculated for each cluster of pixels, resulting in the spectral signatures that will be used in the following iteration. This process continues iteratively producing clusters and mean spectral signatures, until one of the following condition is verified:

The spectral distance between the spectral signatures produced in this iteration with the corresponding ones produced in the previous iteration is lower than a certain threshold; The maximum number of iterations is reached. After the last iteration, a raster of clusters is produced using the spectral signatures derived from the last iteration.

6.8.3 ISODATA

The ISODATA (Iterative Self-Organizing Data Analysis Technique) method is similar to K-means but with the additional steps of merging clusters having similar spectral signatures and splitting clusters having too high variability (i.e. standard deviation) of spectral signatures (Ball & Hall, 1965). Following, the SCP implementation of ISODATA is described At first, the user defines the number of clusters expected in the image, which correspond to as many spectral signatures (i.e. seeds). Starting spectral signatures can be selected in various ways (e.g. randomly, provided by the user, calculated automatically from image values). Initial parameters provided by user are:

\(C\) = number of desired clusters
\(N_{min}\) = minimum number of pixels for a cluster
\(\sigma_t\) = maximum standard deviation threshold for splitting
\(D_t\) = distance threshold for merging

6.8.4 Unsupervised Classification using SNAP

SNAP provides two different methods of unsupervised classification as follows. You can look for the details of algorithm using web search engine.

  • KM Cluster Analysis
  • K-means Cluster analysis

6.9 Supervised classification

The user provides the information about some parts of the area which is used by the software to classify the images into given classes. For example we can select few areas as water body, paddy field, forest etc using visual analysis or some other high resolution image. These areas are known as training area. The software analyses the characteristics of electromagnetic radiation for each classes of cluster. Based on this analysis, whole the image is classified into classes as input by the user. There are different algorithms to classify an image into different classes based on the training areas. Details are omitted in this analysis.

SNAP provides following algorithms for supervised classification.

  • Random Forest classification
  • K-Nearest-Neighbour (KNN) classification
  • Kdtree-KNN classification
  • Maximum likelyhood classification
  • Minimum distance classification
  • Spectral angle mapper processor

6.10 Image Classification (Practical)

6.10.1 Unsupervised classification

Unsupervised classification is simple in SNAP software.

  • Select the bands to be used in classification
  • Select the method
  • Select other input parameters (Number of iteration, number of classes etc.)
  • Run the algorithm

6.10.1.1 Selection of the bands

For this tutorial, I am going to use the following bands:

  1. PCA-Component-1
  2. PCA-Component-2
  3. PCA-Component-3
  4. NDVI
  5. NDWI

Steps:

  1. Select sentinel-merged product

  2. (Menu) Raster->Band Maths

  3. Select the expression as shown in the following image.

    Importing values from different product
  4. Similarly import ndwi from another product

  5. Import components-1 to 3 from PCA. (Menu) Raster->Classification->Unsupervised classification->K-means cluster analysis

    K-means clustering
  6. Select the location of output file. Change the processing parameters as below. K-means processing parameters

    K-means processing parameters
  7. Display the class indices and RGB images side-by-side.

    1. Original RGB, 2. Class Indices
  8. The output is not good. Because forest and water body are output in the same cluster(class). So I will try to use bands B1, B2, B3, B7, B9 and B10 and repeat the process. This time the number of classes are 6.

  9. Display the class indices and RGB images side-by-side again.

    1. Original RGB, 2. Class Indices
  10. Compare the original RGB with class-indices and change the color of classes accordingly.

K-means Class colors

K-means output based on the original bands

6.11 Supervised classification

6.11.1 Number of classes

We will use following classes

Note: You can use roads as additional class to check whether roads can be separated from built-up area.

  1. Water
  2. Built-up area
  3. Bare land, uncultivated land
  4. River sand
  5. Cultivated farm land
  6. Forest

6.11.2 Create training area

Steps for creating training area for water will be explained below. Make sure that merged image is selected in the list of products.

  • (Menu) Vector -> New Vector Data Container
  • In the dialogbox input: Name=Water, Description=Water body
  • Now click on Rectangle Drawing tool or Circle Drawing tool and draw circles and rectangles over water bodies.

Draw training area
  • Again click (Menu) Vector -> New Vector Data Container and input name as built_up
  • While built-up is selected draw rectangles/circles

Draw training area
  • Repeat the process for all the classes. Final training dataset looks like the figure below.

All training areas completed
  • Now click (Menu) Raster->Classification->Supervised classification ->Random Forest Classifier. (You can use other classifiers)
  • Select the product (merged sentinel bands)

Product selection
  • Select the bands and other parameters.

Band selection
  • Select the output file and run.
  • Display the output and modify class colors. The final image looks as below.

Final classified image
  • Classified image overlay in Google Earth

Final classified image