diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer.m')
-rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer.m | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer.m deleted file mode 100755 index 8f9c2ac..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/steer.m +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | % RES = STEER(BASIS, ANGLE, HARMONICS, STEERMTX) | ||
2 | % | ||
3 | % Steer BASIS to the specfied ANGLE. | ||
4 | % | ||
5 | % BASIS should be a matrix whose columns are vectorized rotated copies of a | ||
6 | % steerable function, or the responses of a set of steerable filters. | ||
7 | % | ||
8 | % ANGLE can be a scalar, or a column vector the size of the basis. | ||
9 | % | ||
10 | % HARMONICS (optional, default is N even or odd low frequencies, as for | ||
11 | % derivative filters) should be a list of harmonic numbers indicating | ||
12 | % the angular harmonic content of the basis. | ||
13 | % | ||
14 | % STEERMTX (optional, default assumes cosine phase harmonic components, | ||
15 | % and filter positions at 2pi*n/N) should be a matrix which maps | ||
16 | % the filters onto Fourier series components (ordered [cos0 cos1 sin1 | ||
17 | % cos2 sin2 ... sinN]). See steer2HarmMtx.m | ||
18 | |||
19 | % Eero Simoncelli, 7/96. | ||
20 | |||
21 | function res = steer(basis,angle,harmonics,steermtx) | ||
22 | |||
23 | num = size(basis,2); | ||
24 | |||
25 | if ( any(size(angle) ~= [size(basis,1) 1]) & any(size(angle) ~= [1 1]) ) | ||
26 | error('ANGLE must be a scalar, or a column vector the size of the basis elements'); | ||
27 | end | ||
28 | |||
29 | %% If HARMONICS are not passed, assume derivatives. | ||
30 | if (exist('harmonics') ~= 1) | ||
31 | if (mod(num,2) == 0) | ||
32 | harmonics = [0:(num/2)-1]'*2 + 1; | ||
33 | else | ||
34 | harmonics = [0:(num-1)/2]'*2; | ||
35 | end | ||
36 | else | ||
37 | harmonics = harmonics(:); | ||
38 | if ((2*size(harmonics,1)-any(harmonics == 0)) ~= num) | ||
39 | error('harmonics list is incompatible with basis size'); | ||
40 | end | ||
41 | end | ||
42 | |||
43 | %% If STEERMTX not passed, assume evenly distributed cosine-phase filters: | ||
44 | if (exist('steermtx') ~= 1) | ||
45 | steermtx = steer2HarmMtx(harmonics, pi*[0:num-1]/num, 'even'); | ||
46 | end | ||
47 | |||
48 | steervect = zeros(size(angle,1),num); | ||
49 | arg = angle * harmonics(find(harmonics~=0))'; | ||
50 | if (all(harmonics)) | ||
51 | steervect(:, 1:2:num) = cos(arg); | ||
52 | steervect(:, 2:2:num) = sin(arg); | ||
53 | else | ||
54 | steervect(:, 1) = ones(size(arg,1),1); | ||
55 | steervect(:, 2:2:num) = cos(arg); | ||
56 | steervect(:, 3:2:num) = sin(arg); | ||
57 | end | ||
58 | |||
59 | steervect = steervect * steermtx; | ||
60 | |||
61 | if (size(steervect,1) > 1) | ||
62 | tmp = basis' .* steervect'; | ||
63 | res = sum(tmp)'; | ||
64 | else | ||
65 | res = basis * steervect'; | ||
66 | end | ||
67 | |||
68 | |||