[iaisdftsym] [Up] [iacontour] | Image Filtering |
Filters the image f by the Laplacian of Gaussian (LoG) filter with parameter sigma. This filter is also known as the Marr-Hildreth filter. Obs: to better efficiency, this implementation computes the filter in the frequency domain.
>>> import Numeric
>>> f = iaread('cameraman.pgm')
>>> iashow(f)
(256, 256) Min= 0 Max= 251 Mean=137.066 Std=87.20
>>> g07 = ialogfilter(f, 0.7)
>>> iashow(g07)
(256, 256) Min= -269.655036756 Max= 310.836484048 Mean=1.337 Std=32.34
>>> iashow(g07 > 0)
(256, 256) Min= 0 Max= 1 Mean=0.583 Std=0.49
f | g07 |
g07 > 0 |
>>> import Numeric
>>> g5 = ialogfilter(f, 5)
>>> iashow(g5)
(256, 256) Min= -171.646121233 Max= 231.568565924 Mean=0.000 Std=48.06
>>> iashow(g5 > 0)
(256, 256) Min= 0 Max= 1 Mean=0.512 Std=0.50
>>> g10 = ialogfilter(f, 10)
>>> iashow(g10)
(256, 256) Min= -222.174752597 Max= 160.392577479 Mean=0.000 Std=50.27
>>> iashow(g10 > 0)
(256, 256) Min= 0 Max= 1 Mean=0.517 Std=0.50
g5 | g5 > 0 |
g10 | g10 > 0 |
def ialogfilter(f, sigma): from Numeric import shape, NewAxis, array from FFT import fft2d, inverse_fft2d if len(shape(f)) == 1: f = f[NewAxis,:] h = ialog(shape(f), map(int, array(shape(f))/2.), sigma) h = iaifftshift(h) H = fft2d(h) if not iaisdftsym(H): iaerror("error: log filter is not symetrical") return None G = fft2d(f) * H g = inverse_fft2d(G).real return g
[iaisdftsym] [Up] [iacontour] | |