# Synopse

Low-Pass Butterworth frequency filter.

• H = iabwlp(fsize, tc, n, option='circle')
• H: Image.
• fsize: Image. Filter size: a col vector: first element: rows, second: cols, etc. uses same convention as the return of size.
• tc: Double. Cutoff period.
• n: Double. Filter order.
• option: String. Filter options. Possible values: 'circle' or 'square'.
```01. from numpy import *
02. import string
03.
04. def iabwlp(fsize, tc, n, option='circle'):
05.     from iafftshift import iafftshift
06.
07.     def test_exp(x, y):
08.         try:
09.             return x**(2*y)
10.         except:
11.             return 1E300 # Infinito!
12.
13.     rows, cols = fsize[0], fsize[1]
14.     mh, mw = rows/2, cols/2
15.     rr, cc = meshgrid(arange(-mh,rows-mh), arange(-mw,cols-mw), indexing='ij') # center
16.     if string.find(string.upper(option), 'SQUARE') != -1:
17.         H = 1./(1.+(sqrt(2)-1)*(maximum(abs(1.*rr/rows) , abs(1.*cc/cols))*tc)**(2*n))
18.     else:
19.         aux1 = ravel(sqrt(((1.*rr)/rows)**2 + ((1.*cc)/cols)**2)*tc)
20.         aux2 = 0.*aux1 + n
21.         aux = reshape(map(test_exp, aux1, aux2), cc.shape)
22.         H = 1./(1+(sqrt(2)-1)*aux)
23.     H = iafftshift(H)
24.     return H```

# Description

This function generates a frequency domain Low Pass Butterworth Filter with cutoff period tc and order n. At the cutoff period the filter amplitude is about 0.7 of the amplitude at H(0,0). This function returns the mask filter with H(0,0). As the larger the filter order, sharper will be the amplitude transition at cutoff period. The minimum cutoff period is always 2 pixels, despite of the size of the frequency filter.

# Examples

## Example 1

```01. from ia636 import iabwlp, iadftview
02.
03. H2_10 = iabwlp([100,100],2,10) # cutoff period: 2 pixels, order: 10
05. H4_1 = iabwlp([100,100],4,1) # cutoff period: 4, order: 1
07. H8_100 = iabwlp([100,100],8,100) # cutoff period: 8, order: 100
09. H4_1box = iabwlp([100,100],4,1,'square') # cutoff period: 4, order: 1

## Example 2

```01. f = adreadgray('cookies.pgm')