(noisy_img, size=3)
return denoised_img
Wiener filter with iterative computation of the noise variance.

        Do not use this: this is crappy code to demo bugs!
Wiener filter with iterative computation of the noise variance.
Wiener filter with iterative computation of the noise variance .
def iterated_wiener(noisy_img, size=3):
    """ Wiener filter with iterative computation of the noise variance.

        Do not use this: this is crappy code to demo bugs!
    """
    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