def iterated_wiener(noisy_img, size=3):
 noisy_img = noisy_img
 denoised_img = local_mean(noisy_img, size=size)
 l_var = local_var(noisy_img, size=size)
 for i in range(3):
  res = (noisy_img - denoised_img)
  noise = ((res ** 2).sum() / res.size)
  noise_level = (1 - (noise / l_var))
  noise_level[(noise_level < 0)] = 0
  denoised_img += (noise_level * res)
 return denoised_img

def iterated_wiener ( noisy_img , size = 3 ) : noisy_img = noisy_img denoised_img = local_mean ( noisy_img , size = size ) l_var = local_var ( noisy_img , size = size ) for i in range ( 3 ) : res = ( noisy_img - denoised_img ) noise = ( ( res ** 2 ) . sum ( ) / res . size ) noise_level = ( 1 - ( noise / l_var ) ) noise_level [ ( noise_level < 0 ) ] = 0 denoised_img += ( noise_level * res ) return denoised_img
wiener filter with iterative computation of the noise variance .