Masking is the process in which certain image parts are marked for exclusion from further analysis. Clouds and their shadows should often not be considered in further processing, certainly so in vegetation studies, and there may be forms of analysis in which trees, bushes and their shadows should also be excluded: think of studies that determine crop vegetation indices. Thick and dense clouds display extremely high reflectance values, whereas cloud shadows have low values, and are sometimes wrongly classified as water bodies. It is therefore important to mask out clouds and their shadows prior to many forms of image analysis.
Apart from clouds, the analysis intentions will help to determine which feature(s) to mask prior to image analysis. For example in smallholder agricultural systems, especially in sub-Saharan Africa, it is common to find tree(s) in crop fields, as the trees often have economic value and are sometimes used as shelter by the farmers. Even in small fields, many trees may be present, so to derive correct temporal crop profiles (from the areas in-between the trees), trees and tree shadows must be masked out.
Manually masking clouds, trees and other unwanted features can be tedious and time-consuming if such features are abundant in the scene. For this reason, and certainly when ambitions are to cover areas wall-to-wall, automated approaches in detecting and masking clouds and trees are needed, and have been implemented.
Clouds and their shadows can be automatically detected based on a decision tree of thresholding bands and indices (implemented in R) that excludes cloudy pixels and detects false alarms of very bright pixels. In the case of trees, R code has been developed for automatic detection that models the shape and position of tree shadow. Based on the detected clouds, trees and their shadows of a single image, masking is performed to produce an image of cropland area for analysis.