ubarsc / python-fmask

A set of command line utilities and Python modules that implement the ‘fmask’ algorithm
https://www.pythonfmask.org
GNU General Public License v3.0
74 stars 21 forks source link

About the results #72

Closed oguzhannysr closed 6 months ago

oguzhannysr commented 6 months ago

@gillins, Hello, first of all, thank you. I downloaded a Level 1 image to test it and tried it, but the results were not as I expected.

input_image : T35TPF_20170413T085551_TCI image

result:

image It also masks cloudless areas within the city and produces incorrect results. Am I missing something? What parameters should I change?

neilflood commented 6 months ago

Hi @oguzhannysr

I don't think you are missing anything. It looks like you have run the code correctly. The main problem you are seeing is that Fmask, when used with Sentinel-2 imagery, does have difficulty in urban areas. The bright surfaces common in cities (such as concrete) do tend to confuse it, and the shadows of buildings look the same as cloud shadows, and this all combines to create the sort of thing you are seeing in the city area.

The original Fmask algorithm was designed for Landsat, and the thermal band was able to remove these false clouds, because they are far hotter than clouds should be. However, Sentinel-2 does not have a thermal band, so it gets confused.

There are a couple of parameters you can play with. I would first try the command line parameter --cloudprobthreshold. If you increase that, it will reduce the chance of something being called "cloud", and if you are lucky the false clouds will go out before the true clouds. No guarantees, though.

You could also play with the whiteness threshold, but I don't think we made that accessible from the command line, so you would have to modify the code a little. The starting point would be line 90 in fmask/config.py. If you find that this one is useful, let us know and we may make it easier to set.

Away from the cities, I think what you have is all working well, though.

oguzhannysr commented 6 months ago

Hello, thank you for your return. I tried what you said but I kept getting incorrect reviews for urban areas.

neilflood commented 6 months ago

OK, thanks for trying. I am sorry to hear that it was of no help.

I think you are at the limits of this type of algorithm, though, with Sentinel-2. I know that some other methods will try to use historic data to show pixels which are normally bright, so they are less likely to be counted as cloud, but this is not a part of the current software. I know that other bright areas like beaches and salt flats also show this kind of problem.