def reduce_noise(**kwargs):
"""
Reduces noise in the image.
:param kwargs: Additional arguments for skimage.restoration.denoise_bilateral.
:return: The reduce_noise function.
"""
def f(x):
if keras.backend.image_data_format() == 'channels_last':
x = numpy.moveaxis(x, -1, 0)
y = numpy.empty_like(x, dtype=numpy.float64)
for index, img in enumerate(x):
y[index] = skimage.restoration.denoise_bilateral(img, **kwargs)
if keras.backend.image_data_format() == 'channels_last':
y = numpy.moveaxis(y, 0, -1)
return y
return f
评论列表
文章目录