Oft-compare overlap.bash

From Open Foris Wiki

Jump to: navigation, search

This script compares overlapping areas of 2 images and produces between-band correlations

Usage: oft-compare-overlap.bash <image1.img> <image2.img> <mask1.img> <mask2.img> <grid_spacing> [EPSG:img1]

  • Give the spacing in metres (1000 = 1 km)
  • Give the last parameter in format EPSG:32637 (replace number with your own, this is for UTM 37 N)

Description:

  • Meant for evaluation of the brdf correction of 2 images, but other imagery can be compared as well
  • The second image is projected to the same projection as the first, if the projections differ
  • In that case, user gives the projection of first image ad EPGS code. And both images need to have a projection defined (although it differs)
  • Similar number of bands must exist
  • Masks must be given for both images to exclude cloud/shadow areas
  • They must be of same size and in same projection as their corresponding images
  • Only areas where mask has value 2 are used in comparison (you may give a mask full of 2 if needed)
  • User gives the spacing of the sampling points as well

Example:

cd /home/...
  • Convert landsat_t1.tif into 6 bands as both need to have same nr of bands. Output: landsat_t1_6bands.tif
 gdal_translate landsat_t1.tif landsat_t1_6bands.tif -b 1 -b 2 -b 3 -b 4 -b 5 -b 6
  • Create mask for landsat_t1_6bands.tif; automatic output: landsat_t1_6bands_mask.tif
oft-trim-mask.bash landsat_t1_6bands.tif
  • NOTE: the mask value to be used is 2, so conversion of mask from value 1 to 2: input: landsat_t1_6bands_mask.tif -> output: mask1.tif
oft-calc landsat_t1_6bands_mask.tif mask1.tif
1
#1 1 = 0 2 ?
  • Create mask for landsat_t2; automatic output: landsat_t2_mask.tif
oft-trim-mask.bash landsat_t2.tif 
  • Convert mask value to 2: landsat_t2_mask.tif -> output: mask2.tif
oft-calc landsat_t2_mask.tif mask2.tif
1
#1 1 = 0 2 ?
  • Run oft-compare-overlap.bash
oft-compare-overlap.bash landsat_t1_6bands.tif landsat_t2.tif  mask1.tif mask2.tif  1000
  • Output: img12mask12_sed.txt printed on screen:
head img12mask12_sed.txt
 329.00 732285.00 -2447885.00 100.00 3166.00 2.00 2.00 100.00 3166.00 2.00 2.00 100.00 3166.00 53.00 25.00 27.00 48.00 71.00 131.00 53.00 25.00 27.00 48.00 71.00 131.00 100.00 3166.00 66.00 60.00 66.00 88.00 98.00 69.00 66.00 60.00 66.00 88.00 98.00 69.00 
 330.00 732285.00 -2446885.00 100.00 3133.00 2.00 2.00 100.00 3133.00 2.00 2.00 100.00 3133.00 54.00 25.00 27.00 48.00 71.00 128.00 54.00 25.00 27.00 48.00 71.00 128.00 100.00 3133.00 61.00 53.00 51.00 100.00 77.00 49.00 61.00 53.00 51.00 100.00 77.00 49.00 
 331.00 732285.00 -2445885.00 100.00 3100.00 2.00 2.00 100.00 3100.00 2.00 2.00 100.00 3100.00 56.00 25.00 29.00 53.00 73.00 128.00 56.00 25.00 29.00 53.00 73.00 128.00 100.00 3100.00 67.00 61.00 66.00 95.00 89.00 65.00 67.00 61.00 66.00 95.00 89.00 65.00 
 332.00 732285.00 -2444885.00 100.00 3066.00 2.00 2.00 100.00 3066.00 2.00 2.00 100.00 3066.00 46.00 19.00 17.00 40.00 41.00 124.00 46.00 19.00 17.00 40.00 41.00 124.00 100.00 3066.00 55.00 44.00 36.00 80.00 53.00 25.00 55.00 44.00 36.00 80.00 53.00 25.00 
 333.00 732285.00 -2443885.00 100.00 3033.00 2.00 2.00 100.00 3033.00 2.00 2.00 100.00 3033.00 46.00 20.00 18.00 39.00 45.00 124.00 46.00 20.00 18.00 39.00 45.00 124.00 100.00 3033.00 56.00 43.00 35.00 81.00 56.00 26.00 56.00 43.00 35.00 81.00 56.00 26.00 
 334.00 732285.00 -2442885.00 100.00 3000.00 2.00 2.00 100.00 3000.00 2.00 2.00 100.00 3000.00 48.00 20.00 18.00 36.00 42.00 125.00 48.00 20.00 18.00 36.00 42.00 125.00 100.00 3000.00 55.00 43.00 35.00 77.00 54.00 27.00 55.00 43.00 35.00 77.00 54.00 27.00
  • Explanations of output columns:


Output of oft-compare-overlap.bash visualised in QGIS

Back to Open Foris Toolkit Main Page

Back to Tools & Exercises



Personal tools