diff options
author | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 03:47:33 -0400 |
---|---|---|
committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 03:47:33 -0400 |
commit | a32f220f06cc463e5b56e7fa0b1b1334d94d08f3 (patch) | |
tree | 4af4caa60074465d85fc2ef5cc1b23e74c064329 /SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m | |
parent | 79f30887129145e15e5172e36a7d7602859fc932 (diff) |
matlab removed
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m')
-rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m deleted file mode 100755 index 84ef466..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkSquare.m +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | % IM = mkSquare(SIZE, PERIOD, DIRECTION, AMPLITUDE, PHASE, ORIGIN, TWIDTH) | ||
2 | % or | ||
3 | % IM = mkSine(SIZE, FREQ, AMPLITUDE, PHASE, ORIGIN, TWIDTH) | ||
4 | % | ||
5 | % Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar) | ||
6 | % containing samples of a 2D square wave, with given PERIOD (in | ||
7 | % pixels), DIRECTION (radians, CW from X-axis, default = 0), AMPLITUDE | ||
8 | % (default = 1), and PHASE (radians, relative to ORIGIN, default = 0). | ||
9 | % ORIGIN defaults to the center of the image. TWIDTH specifies width | ||
10 | % of raised-cosine edges on the bars of the grating (default = | ||
11 | % min(2,period/3)). | ||
12 | % | ||
13 | % In the second form, FREQ is a 2-vector of frequencies (radians/pixel). | ||
14 | |||
15 | % Eero Simoncelli, 6/96. | ||
16 | |||
17 | % TODO: Add duty cycle. | ||
18 | |||
19 | function [res] = mkSquare(sz, per_freq, dir_amp, amp_phase, phase_orig, orig_twidth, twidth) | ||
20 | |||
21 | %------------------------------------------------------------ | ||
22 | %% OPTIONAL ARGS: | ||
23 | |||
24 | if (prod(size(per_freq)) == 2) | ||
25 | frequency = norm(per_freq); | ||
26 | direction = atan2(per_freq(1),per_freq(2)); | ||
27 | if (exist('dir_amp') == 1) | ||
28 | amplitude = dir_amp; | ||
29 | else | ||
30 | amplitude = 1; | ||
31 | end | ||
32 | if (exist('amp_phase') == 1) | ||
33 | phase = amp_phase; | ||
34 | else | ||
35 | phase = 0; | ||
36 | end | ||
37 | if (exist('phase_orig') == 1) | ||
38 | origin = phase_orig; | ||
39 | end | ||
40 | if (exist('orig_twidth') == 1) | ||
41 | transition = orig_twidth; | ||
42 | else | ||
43 | transition = min(2,2*pi/(3*frequency)); | ||
44 | end | ||
45 | if (exist('twidth') == 1) | ||
46 | error('Too many arguments for (second form) of mkSine'); | ||
47 | end | ||
48 | else | ||
49 | frequency = 2*pi/per_freq; | ||
50 | if (exist('dir_amp') == 1) | ||
51 | direction = dir_amp; | ||
52 | else | ||
53 | direction = 0; | ||
54 | end | ||
55 | if (exist('amp_phase') == 1) | ||
56 | amplitude = amp_phase; | ||
57 | else | ||
58 | amplitude = 1; | ||
59 | end | ||
60 | if (exist('phase_orig') == 1) | ||
61 | phase = phase_orig; | ||
62 | else | ||
63 | phase = 0; | ||
64 | end | ||
65 | if (exist('orig_twidth') == 1) | ||
66 | origin = orig_twidth; | ||
67 | end | ||
68 | if (exist('twidth') == 1) | ||
69 | transition = twidth; | ||
70 | else | ||
71 | transition = min(2,2*pi/(3*frequency)); | ||
72 | end | ||
73 | |||
74 | end | ||
75 | |||
76 | %------------------------------------------------------------ | ||
77 | |||
78 | if (exist('origin') == 1) | ||
79 | res = mkRamp(sz, direction, frequency, phase, origin) - pi/2; | ||
80 | else | ||
81 | res = mkRamp(sz, direction, frequency, phase) - pi/2; | ||
82 | end | ||
83 | |||
84 | [Xtbl,Ytbl] = rcosFn(transition*frequency,pi/2,[-amplitude amplitude]); | ||
85 | |||
86 | res = pointOp(abs(mod(res+pi, 2*pi)-pi),Ytbl,Xtbl(1),Xtbl(2)-Xtbl(1),0); | ||
87 | |||
88 | % OLD threshold version: | ||
89 | %res = amplitude * (mod(res,2*pi) < pi); | ||