|
a |
|
b/functions/functions_FeatExtr/computeGaborResponses.m |
|
|
1 |
function gaborResponses = computeGaborResponses(im, gabor, NumFilters) |
|
|
2 |
|
|
|
3 |
%init |
|
|
4 |
gaborResponses = zeros(size(im,1), size(im,2), NumFilters); |
|
|
5 |
|
|
|
6 |
for oriIndex = 1 : NumFilters |
|
|
7 |
|
|
|
8 |
filter = real(gabor(oriIndex).filter); |
|
|
9 |
|
|
|
10 |
%normalize |
|
|
11 |
%%%%%%%%%%%%%%%%%%%%% |
|
|
12 |
filter = filter ./ max(filter(:)); |
|
|
13 |
%%%%%%%%%%%%%%%%%%%%% |
|
|
14 |
|
|
|
15 |
gaborResponses(:, :, oriIndex) = imfilter(im, filter, 'replicate', 'same', 'conv'); |
|
|
16 |
|
|
|
17 |
%gaborResponses(:, :, oriIndex) = abs(imfilter(im, gabor(oriIndex).filter, 'replicate', 'same', 'conv')); |
|
|
18 |
%gaborResponses(:, :, oriIndex) = gaborResponses(:, :, oriIndex) - mean2(gaborResponses(:, :, oriIndex)); |
|
|
19 |
|
|
|
20 |
% figure, |
|
|
21 |
% imshow(gaborResponses(:, :, oriIndex), []) |
|
|
22 |
% pause |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
end %for oriIndex = 1 : param.divTheta |
|
|
26 |
|