def morph_dilation(input_image_raster, filter_size):
'''
Morphological dilation of raster
'''
ndim = 3
if input_image_raster.ndim == 2:
input_image_raster = numpy.expand_dims(input_image_raster, axis=0)
ndim = 2
if input_image_raster.ndim != 3:
raise Exception("Input array has to be 3D")
if ndim == 3:
return ndimage.grey_dilation(input_image_raster, (1, filter_size, filter_size))
else:
return ndimage.grey_dilation(input_image_raster, (1, filter_size, filter_size))[0]
评论列表
文章目录