Here is a simple procedure of using the free and open source software Imagemagick and the threshold option to generate the cloud masks from the photos. The assumption is that clouds in aerial photos would be brighter than the terrain underneath. An example aerial photo with clouds is shown below.
|Photo credit: Kevin Payravi, Wikimedia Commons|
- In the Windows Command Prompt, type in the following:
C:/> convert Overview_head_of_cloud_with_shadow.jpg -threshold 40% cloud_mask.png
Note: the threshold option tells Imagemagick to set pixel values below 40% to 0 (black) and above to white.
The mask is created.
- Optional. In some software, black is the mask so it may be necessary to invert the mask with the following command.
C:/> convert cloud_mask.png -channel rgba -transparent black -fill black -opaque white -fill white -opaque none -alpha off -define png:color-type=6 cloud_invert_mask.png
The mask is inverted as RGB file type
Note: if there are bright objects on the ground e.g. river, stream, road, metallic rooftops, then the mask may contain these objects too. It may be necessary to edit the mask to remove these objects.