How to Remove Clouds Using Fmask From Landsat Images In 10 Easy Steps

So how would you remove clouds using Fmask from Landsat images? Fmask is a great and easy-to-use tool to mask out cloud covers from satellite images. Follow the steps below and you will have images free of cloud cover and shadows in no time.

Note: The steps below assume that you have already downloaded your Landsat images and unzipped. If not, go to USGS and download the images for free.

1. Make sure to download the latest Fmask version from the official fmask website. Pick the one applicable for your system. I used the “Fmask 2.2v Windows executable.”

2. Download and install the Matlab Runtime Compiler (MCRInstaller.exe). You can find the file oneline at: http://www.mathworks.com/products/compiler/ with 64 bit windows 2012a MCRInstaller.

3. Place all the Landsat files you have unzipped in a folder. In the same folder, place also the Fmask executable file (Fmask.exe) that you just downloaded.

4. Now go to your PC’s “Command Prompt”. It is usually located under “Accessories.” Type and run each line below (side comments have been italicized).

C:\Fmask (Or run the folder where your files are.)

Click enter.

C:\Fmask>Fmask_3_2 (This is the executable Fmask file. Make sure you are running the right file name.)

Click enter.

Wait while Fmask does the masking. This may take a couple of minutes or maybe a little more.

5. Result of the masking will appear in the same folder with a filename that looks like this: xxxxfmask. This file is now your cloud mask that you can open in the ENVI software.

6. Go to ENVI and load the xxxxfmask. If it will appear black, apply linear stretching to see the mask on screen. The mask will give you 6 classes: 0 for band pixel; 1 for water; 2 for cloud shadow; 3 for snow; 4 for cloud; and 255 for no observation.

Now, let us apply the mask to the original Landsat image. If you are using ENVI, here are the next steps:

7. In Toolbox —> Raster Management —> Masking —> Apply Mask

8. Input the Landsat image with snow/cloud/cloud cover —> Select Band Mask. In the “Mask Option” click “Mask data ignore values [all bands]”, then click OK.

9. In “Apply Parameters” window, make sure that the mask value is 0.00.

10. Name your output file, your new image without the snow/cloud/cloud cover contamination. Click OK.

That’s about it.

You can do anything you want with the raster xxxxfmask file. You can convert it into a mask shapefile too (with 6 classes). Use can even use the shapefile in ARCMap.

4 thoughts on “How to Remove Clouds Using Fmask From Landsat Images In 10 Easy Steps

Leave a Reply

Your email address will not be published. Required fields are marked *

eleven − seven =

This site uses Akismet to reduce spam. Learn how your comment data is processed.