Landsat Missions

This site will be relocating soon!  Check out this HEADLINE for more details. 

What is the C Function of Mask (CFMask) algorithm?

You are here


What is the C Function of Mask (CFMask) algorithm?


The CFMask algorithm populates cloud, cloud confidence, cloud shadow, and snow/ice pixels in the processing of Landsat Level-1 data products, with the results represented as bit-mapped values within the Landsat Collection 1 Level-1 Quality Assessment (QA) Band.  CFMask derives from the Function of Mask (FMask), an algorithm written in MATLAB at Boston University and translated to C at USGS EROS to facilitate its implementation in a production environment.

CFMask is a multi-pass algorithm that uses decision trees to prospectively label pixels in the scene; it then validates or discards those labels according to scene-wide statistics. It also creates a cloud shadow mask by iteratively estimating cloud heights and projecting them onto the ground.

Users should be aware that, like other cloud algorithms, CFMask may have difficulties over bright targets such as building tops, beaches, snow/ice, sand dunes, and salt lakes. Optically thin clouds will always be challenging to identify and have a higher probability of being omitted by the algorithm. In addition, the algorithm performance has only been validated for cloud detection, and to a lesser extent for cloud shadows. No rigorous evaluation of the snow/ice detection has been performed. More details can be found in the CFMask Algorithm Description Document.

This paper, published in 2017, describes the comparison of the various cloud detection algorithms used for Landsat data products, and provides important information about CFMask: Foga, S., Scaramuzza, P.L., Guo, S., Zhu, Z., Dilley, R.D., Beckmann, T., Schmidt, G.L., Dwyer, J.L., Hughes, M.J., Laue, B. (2017). Cloud detection algorithm comparison and validation for operational Landsat data products. Remote Sensing of Environment, 194, 379-390.

Landsat cloud cover assessment (CCA) validation data can be accessed from the Landsat Cloud Cover Assessment Validation Datasets webpage.



Landsat represents the world's longest continuously acquired collection of space-based moderate-resolution land remote sensing data. Four decades of imagery provides a unique resource for those who work in agriculture, geology, forestry, regional planning, education, mapping, and global change research. Landsat images are also invaluable for emergency response and disaster relief.


Contact Us

Landsat Updates

The Landsat Update is an informal communication tool, prepared periodically and distributed electronically to USGS Landsat partners, to provide information about Landsat activities and related topics of interest.

Accessibility FOIA Privacy Policies and Notices logo U.S. Department of the Interior | U.S. Geological Survey
Page Contact Information: Ask Landsat
Page Last Modified: 10/18/18 11:39 am