Map Calculation with GRASS Session - II Workshop on “Introduction to Remote Sensing”, July 7 – 11, 2014, Jawaharlal Nehru Engineering College
May 21, 2015
Map Calculation with GRASS
Session - II
Workshop on “Introduction to Remote Sensing”, July 7 – 11, 2014, Jawaharlal Nehru Engineering College
In this session● Calculation of vegetation indices● Level slicing of images
Spectral Signature of vegetation
http://ces.iisc.ernet.in/hpg/envis/Remote/introfile8_files/FIG_11.gif
High reflectance of vegetation at the Near infra-red (NIR) region
High reflectance of vegetation at the Near infra-red (NIR) region
Low reflectance of vegetation at the red (R) region
Low reflectance of vegetation at the red (R) region
Vegetation Indices
RVI=NIRR
(Jordan, 1969)
NDVI=NIR−RNIR+R
(Rouse et. al, 1973)
IPVI=NIRNIR+R
(Crippen, 1990)
DVI=NIR−R (Richardson & Everitt, 1992)
Ratio Vegetation IndexRatio Vegetation Index
Normalised Difference Vegetation Index
Infrared Percentage Vegetation Index
Difference Vegetation Index
In our dataset
S. No. Band Part of spectrum
Spatial Resolution
1 B1 Blue 30m
2. B2 Green 30m
3. B3 Red 30m
4. B4 Infra-red 30m
5. B5 SWIR-1 30m
6. B6 Thermal 60m
7. B7 SWIR - 2 30m
Select Aurangabad and Click PERMANENT.
Select Aurangabad and Click PERMANENT.
Start GRASSStart GRASS
Understanding MAPCALC
1. Go to the command console1. Go to the command console
2.Type r.mapcalc
Press Enter
2.Type r.mapcalc
Press Enter
3. Type the name of the new Raster Map RVI
3. Type the name of the new Raster Map RVI
4. Select double(x) from the mapcalc function list.
4. Select double(x) from the mapcalc function list.
5. Type the expression: double (B4S@PERMANENT) / double(B3S@PERMANENT)
5. Type the expression: double (B4S@PERMANENT) / double(B3S@PERMANENT)
6. Click Run6. Click Run
GRASS displays command finishedGRASS displays command finished
7. Click Close.7. Click Close.
8. Check on the RVI layer in Layer Manager
8. Check on the RVI layer in Layer Manager
9. RVI displayed in coloured mode. Need to change the colour table.
9. RVI displayed in coloured mode. Need to change the colour table.
10. Go to the command console. Type r.colors and press Enter
10. Go to the command console. Type r.colors and press Enter
11. Select RVI@PERMANENT 11. Select RVI@PERMANENT
12. Click on the Colors panel and select grey.
12. Click on the Colors panel and select grey.
13. Click Run.13. Click Run.
Computed map displayed in grey.Computed map displayed in grey.
Exercise● Use r.mapcalc to compute
– DVI
– NDVI
– IPVI
● Change the colour table using r.colors
Displays of DVI, NDVI, IPVI
DVIDVI NDVINDVI IPVIIPVI
Segmentation methods using map calculation
Binary and n-nary segmentation / level slicing
Strategy for binary segmentation● Determine a threshold (a number) for an image I● Apply the following function to the image I
newImage= f ( I )={I <τ 1I≥τ 2
How to obtain this threshold?How to obtain this threshold?
The if-then-else function in r.mapcalc
if (<condition>,
<value_if_condition_is_satisfied>,
<value_if_condition_is_not_satisfied>)
● e.g.– r.mapcalc 'newImage = if(b3@PERMANENT < 56, 1, 2)'
Finding the threshold
1. Add B4S@PERMANENT to the layer manager
1. Add B4S@PERMANENT to the layer manager
Water bodiesWater bodies
2. Click on this button (Query raster / vector maps)
2. Click on this button (Query raster / vector maps)
3. Click on various points on the water bodies in the map layer and find the maximum value
appearing here
3. Click on various points on the water bodies in the map layer and find the maximum value
appearing here
4. Go to the command console and type r.mapcalc
4. Go to the command console and type r.mapcalc
5. Enter the name of the new image
5. Enter the name of the new image
6. Type the expression
If (B4S@PERMANENT < 26, 1, 2)
6. Type the expression
If (B4S@PERMANENT < 26, 1, 2)
7. Click Run7. Click Run
Binary segmented image displayed in the map
window. Water body seen here
Binary segmented image displayed in the map
window. Water body seen here
Exercise: It is seen that the second water body is not displayed in the image. Select a better threshold and re-calculate the new image
Exercise: It is seen that the second water body is not displayed in the image. Select a better threshold and re-calculate the new image
Divide an image into three groups● For this, we need two thresholds● We apply the following function
newImage= f ( I )={I<τ1 1τ1≤ I<τ2 2I≥τ2 3
Find these thresholds again by using the Raster query method explained earlier.
Find these thresholds again by using the Raster query method explained earlier.
Using Raster Query tool, we select two thresholds: 31 and 54Using Raster Query tool, we select two thresholds: 31 and 54
1. Go to command window and type r.mapcalc
1. Go to command window and type r.mapcalc
3. Type the expression: if (B4S@PERMANENT < 31, 1, if (
B4S@PERMANENT <56,2,3)). 3. Click Run
3. Type the expression: if (B4S@PERMANENT < 31, 1, if (
B4S@PERMANENT <56,2,3)). 3. Click Run
2. Enter the name of the new raster map as
mewImage2
2. Enter the name of the new raster map as
mewImage2
Image displayed in Map WindowImage displayed in Map Window
Questions● We are able to segment the image in two and three
parts and extract features like ROADS and LAKES● Can we extract other features also?
– Like buildings etc
– Can we make 6 different groups and develop a map?
● Exercise– Identify 5 different thresholds to divide the image into 6
groups
● Knowledge: – The process that we learned here is called LEVEL
SLICING