def local_mean(img, size=3):
 structure_element = np.ones((size, size), dtype=img.dtype)
 l_mean = signal.correlate(img, structure_element, mode='same')
 l_mean /= (size ** 2)
 return l_mean

def local_mean ( img , size = 3 ) : structure_element = np . ones ( ( size , size ) , dtype = img . dtype ) l_mean = signal . correlate ( img , structure_element , mode = 'same' ) l_mean /= ( size ** 2 ) return l_mean
compute a image of the local average .