From Open Foris Wiki

Jump to: navigation, search

Prepares images and masks for oft-gapfill

Usage: oft-prepare-images-for-gapfill.bash <-a anchor> <-f filler> <-m anchor mask> <-s second mask (filler)> [-n ndvi threshold]

  • -a Anchor = Better image, whose gaps are to be filled
  • -f Filler = Filler image
  • -m Anchor mask = 0/1 mask indicating bad areas on anchor image with 0
  • -s Second mask = 0/1 mask indicating bad areas on filler image with 0


  • -n ndvi threshold = If images differ a lot, NDVI can be used to select only vegetated areas for mask

Values like 0.4 or 0.5 are useful at some location on the world, check your situation self!


  • Takes the anchor and filler images as input
  • Also their 0/1 masks indicating clouds and gaps are needed
  • NDVI can be used to threshold areas with low vegetation off from the models
  • At this point, bands 3 and 4 are used for NDVI computation
  • Otherwise, nbr of bands is not fixed, but must be equal in the input images
  • All material needs to be in same projection


  • Get Example data set
  • For this exercise following tools are used: oft-prepare-images-for-gapfill.bash, gdal_translate
  • Open your working directory using
cd /home/...
  • As landsat_t1.tif and landsat_t2.tif differ in their number of bands we need to exclude band 7 from landsat_t1.tif by carrying out following procedure:
gdal_translate landsat_t1.tif landsat_t1_6bands.tif -b 1 -b 2 -b 3 -b 4 -b 5 -b 6
  • Let's run oft-prepare-images-for-gapfill.bash using following input:
 oft-prepare-images-for-gapfill.bash -a landsat_t1_6bands.tif -f landsat_t2.tif -m landsat_t1_mask.tif -s landsat_t2_mask.tif
  • Two output images mask are automatically processed: gapmask_landsat_t1_6bands_landsat_t2.tif and goodarea_mask_landsat_t1_6bands_landsat_t2.tif

gapmask_landsat_t1_6bands_landsat_t2.tif goodarea_mask_landsat_t1_6bands_landsat_t2.tif

Back to Open Foris Toolkit Main Page

Back to Tools & Exercises

Personal tools