From Open Foris Wiki

Jump to: navigation, search

Usage1: oft-mask.bash <input1> <input2> [-notrim]

Usage2: oft-mask.bash <input1> [-notrim]

oft-mask.bash uses 1 or 2 LEDAPS processed inputs to compute a mask .img.

  • Two inputs is the regular case, and the resulting mask is used e.g in the oft-gapfill program.
  • However, script oft-stack_mask2images.bash does the same, and also the 14-band image stack needed in gapfilling.
  • The inputs are given as directory names, containing the HDF files. The ouput name is given by the program mask_input1_input2.img.


oft-mask.bash LE71660632009094ASN00 LE71660632006054ASN00

Or with one image:

oft-mask.bash LE71660632009094ASN00
  • The script also trims the mask so that the image margins (= no image values) are excluded.
  • IF one does not want to trim, there is now option -notrim, examples:
oft-mask.bash LE71660632009094ASN00 LE71660632006054ASN00 -notrim
oft-mask.bash LE71660632009094ASN00 -notrim
  • The output values in the 2 image case are:
  • 1 = fill these pixels (unusable data in anchor, good data in filler)
  • 2 = collect training data for regression model (good data in both images)
  • 3 = do nothing, i.e., use the original values (2 cases: good in anchor, bad in filler OR non-good in both images)
  • 0 = do nothing (image margins)
  • In case of 1 image values 0-2 are produced.
  • The script utilizes the following programs:oft-calc, oft-trim, oft-shrink
  • Band4 of the LEDAPS corrected images is used in the trimming phase and the QA_layer (band 8) for extracting the cloud, shadow and gap info.

  • The trimming is implemented as follows:
1. Resample the image to a coarser resolution in order to improve the recognition of gaps:
gdal_translate -outsize 10% 10% input output
2. Trim the margins and create an area for the actual mask (check in a 3 x 3 window if there are only values less or equal to zero. If so, output = 0, else output = 1:
oft-trim -ot Byte -ws 3 output mask
3. Repeat for the output file from step 2:
oft-trim -ot Byte -ws 3 mask mask2
4. Shrink:
oft-shrink -ws 11 mask2 mask
5. Resample back to original resolution

The non-good image data are extracted from the bit-packed Ledaps QA band using the bit-level analysis property of oft-calc. Also the land-mask of the QA layer is now included (from 10.5.2012), so water pixels (according to the mask) are removed.

Back to Open Foris Toolkit Main Page

Back to Tools & Exercises

Personal tools