Skip to content

Commit

Permalink
S2PixelCloudDetector can now calculate binary masks for previously cl…
Browse files Browse the repository at this point in the history
…assified cloud probability maps (by applying convolution+dilation+threshold).
  • Loading branch information
Anze Zupanc committed Jun 19, 2018
1 parent bb18cd9 commit e072a7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions s2cloudless/S2PixelCloudDetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ def get_cloud_masks(self, X):

cloud_probs = self.get_cloud_probability_maps(X)

return self.get_mask_from_prob(cloud_probs)

def get_mask_from_prob(self, cloud_probs):
"""
Returns cloud mask by applying morphological operations -- convolution and dilation --
to input cloud probabilities.
:param cloud_probs: cloud probability map
:type cloud_probs: numpy array of cloud probabilities (shape n_images x n x m)
:return: raster cloud mask
:rtype: numpy array (shape n_images x n x m)
"""
if self.average_over:
cloud_masks = np.asarray([convolve(cloud_prob, self.conv_filter) > self.threshold
for cloud_prob in cloud_probs], dtype=np.int8)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

__version__ = '1.1.0'
__version__ = '1.2.0'

setup(name='s2cloudless',
version=__version__,
Expand Down

0 comments on commit e072a7d

Please sign in to comment.