-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakeRFSfilters.m
32 lines (29 loc) · 1.06 KB
/
makeRFSfilters.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function F=makeSfilters(SUP)
% Returns the S filter bank of size SUPxSUPx13 in F. To convolve an
% image I with the filter bank you can either use the matlab function
% conv2, i.e. responses(:,:,i)=conv2(I,F(:,:,i),'valid'), or use the
% Fourier transform.
NF=13; % Number of filters
F=zeros(SUP,SUP,NF);
F(:,:,1)=makefilter(SUP,2,1);
F(:,:,2)=makefilter(SUP,4,1);
F(:,:,3)=makefilter(SUP,4,2);
F(:,:,4)=makefilter(SUP,6,1);
F(:,:,5)=makefilter(SUP,6,2);
F(:,:,6)=makefilter(SUP,6,3);
F(:,:,7)=makefilter(SUP,8,1);
F(:,:,8)=makefilter(SUP,8,2);
F(:,:,9)=makefilter(SUP,8,3);
F(:,:,10)=makefilter(SUP,10,1);
F(:,:,11)=makefilter(SUP,10,2);
F(:,:,12)=makefilter(SUP,10,3);
F(:,:,13)=makefilter(SUP,10,4);
return
function f=makefilter(sup,sigma,tau)
hsup=(sup-1)/2;
[x,y]=meshgrid([-hsup:hsup]);
r=(x.*x+y.*y).^0.5;
f=cos(r*(pi*tau/sigma)).*exp(-(r.*r)/(2*sigma*sigma));
f=f-mean(f(:)); % Pre-processing: zero mean
f=f/sum(abs(f(:))); % Pre-processing: L_{1} normalise
return