The cloud shadows are dark and, of course, they are due the presence of a nearby cloud.
Apart from these facts, there is not much information to detect clouds, and for this reason, the cloud shadows are even more difficult to detect than the clouds themselves.
The shadows are not the only dark objects, and cloud shadows can be confused with plots of bare soil, with water bodies or with shadows cast by the terrain. Again, using multi-temporal methods can reduce the risk of confusion : here the algorithm must detect a sudden darkening of a pixel. However, the effect of plowing, rainfall or irrigation on a bare soil may be similar to the effect of a cloud shadow.
To be sure that the pixels that suddenly darkened are true cloud shadows, it is useful to check that the shadow matches the cloud that casted it.
In our processor, we do as follows :
1. Cloud detection
2. Compute the difference between the processed image and a previous image (using the red spectral band)
3. For an altitude between 500m and 10000m :
- compute the cloud shadow projection for this altitude.
- compute the average darkening for this altitude from the diference image obtained at step 2.
4. Find the altitude for which the darkening is maximal
5. Compute the shadow mask from the cloud mask, for the altitude obtained at step 4.
However, one has to pay attention that some clouds, outside the image may cast shadows within the image. As the clouds may reach 5 to 10 km altitude, and the solar elevation may be low in winter, some shadows in a large par of the image near the borders mays be missed. With this regard, the larger the image the better. This will be the case with sentinel 2.