def shadow_mask_array(image_difference_array, threshold=-5500, filter_size=13, morphing_size=0): # TODO: Is it 0 in morphing_size?? is not 10?? ''' This method returns a mask for the given array, it stacks all the bands into one and filters values that match the threshold. The new array will be filled with 0 when the values are above the threshold and 1 when the values are bellow the threshold. We assume that shadows will have darker values when compared to the reference array. ''' shadows = filter_median((numpy.sum(image_difference_array[3:, :, :], axis=0) < threshold).astype(numpy.int), filter_size) if morphing_size: shadows = morph_dilation(shadows, morphing_size) return shadows
def cloud_mask_array(image_difference_array, threshold=30000, filter_size=13, morphing_size=0): # TODO: Is it 0 in morphing_size?? is not 10?? ''' This method returns a mask for the given array, it stacks all the bands into one and filters values that match the threshold. The new array will be filled with 0 when the values are below the threshold and 1 when the values are above the threshold. We assume that clouds will have brighter values when compared to the reference array. ''' clouds = filter_median((numpy.sum(image_difference_array, axis=0) > threshold).astype(numpy.int), filter_size) if morphing_size: clouds = morph_dilation(clouds, morphing_size) return clouds
def shadow_mask_array( image_difference_array, threshold=-5500, filter_size=13, morphing_size=0): # TODO: Is it 0 in morphing_size?? is not 10?? ''' This method returns a mask for the given array, it stacks all the bands into one and filters values that match the threshold. The new array will be filled with 0 when the values are above the threshold and 1 when the values are bellow the threshold. We assume that shadows will have darker values when compared to the reference array. ''' shadows = filter_median((numpy.sum(image_difference_array[3:, :, :], axis=0) < threshold).astype(numpy.int), filter_size) if morphing_size: shadows = morph_dilation(shadows, morphing_size) return shadows
def cloud_mask_array( image_difference_array, threshold=30000, filter_size=13, morphing_size=0): # TODO: Is it 0 in morphing_size?? is not 10?? ''' This method returns a mask for the given array, it stacks all the bands into one and filters values that match the threshold. The new array will be filled with 0 when the values are below the threshold and 1 when the values are above the threshold. We assume that clouds will have brighter values when compared to the reference array. ''' clouds = filter_median( (numpy.sum(image_difference_array, axis=0) > threshold).astype( numpy.int), filter_size) if morphing_size: clouds = morph_dilation(clouds, morphing_size) return clouds