sentinel-hub / sentinel2-cloud-detector

Sentinel Hub Cloud Detector for Sentinel-2 images in Python
Creative Commons Attribution Share Alike 4.0 International
428 stars 93 forks source link

Without using Sentinel Hub for processing #4

Closed jassantos closed 6 years ago

jassantos commented 6 years ago

I actually have downloaded Sentinel 2 scenes. Is it possible not to use the sentinel hub to download the Sentinel 2 data and just use the ones I am keeping? As I have seen in your examples, it uses the Sentinel Hub.

AleksMat commented 6 years ago

Hi jassantos,

it is possible to use your own data for classification. Sentinel Hub services in the examples only provide the required data. You can also read your data, resize all band images to the same size and join them together into one numpy array where bands are in the order B01,B02,B04,B05,B08,B8A,B09,B10,B11,B12 (not all bands are used).

The cloud masks can then be calculated like this

cloud_detector = S2PixelCloudDetector(threshold=0.4, average_over=4, dilation_size=2)

cloud_probs = cloud_detector.get_cloud_probability_maps(my_band_images)
cloud_masks = cloud_detector.get_cloud_masks(my_band_images)
azupanc commented 6 years ago

In addition, I believe you need to divide the band values by 10000. The classifier expects the reflectances to be between 0 and 1.

jassantos commented 6 years ago

Thank you AleksMat and azupanc for your responses. I will look into it.