summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m50
1 files changed, 0 insertions, 50 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m
deleted file mode 100755
index 0c12490..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/rconv2.m
+++ /dev/null
@@ -1,50 +0,0 @@
1% RES = RCONV2(MTX1, MTX2, CTR)
2%
3% Convolution of two matrices, with boundaries handled via reflection
4% about the edge pixels. Result will be of size of LARGER matrix.
5%
6% The origin of the smaller matrix is assumed to be its center.
7% For even dimensions, the origin is determined by the CTR (optional)
8% argument:
9% CTR origin
10% 0 DIM/2 (default)
11% 1 (DIM/2)+1
12
13% Eero Simoncelli, 6/96.
14
15function c = rconv2(a,b,ctr)
16
17if (exist('ctr') ~= 1)
18 ctr = 0;
19end
20
21if (( size(a,1) >= size(b,1) ) & ( size(a,2) >= size(b,2) ))
22 large = a; small = b;
23elseif (( size(a,1) <= size(b,1) ) & ( size(a,2) <= size(b,2) ))
24 large = b; small = a;
25else
26 error('one arg must be larger than the other in both dimensions!');
27end
28
29ly = size(large,1);
30lx = size(large,2);
31sy = size(small,1);
32sx = size(small,2);
33
34%% These values are one less than the index of the small mtx that falls on
35%% the border pixel of the large matrix when computing the first
36%% convolution response sample:
37sy2 = floor((sy+ctr-1)/2);
38sx2 = floor((sx+ctr-1)/2);
39
40% pad with reflected copies
41clarge = [
42 large(sy-sy2:-1:2,sx-sx2:-1:2), large(sy-sy2:-1:2,:), ...
43 large(sy-sy2:-1:2,lx-1:-1:lx-sx2); ...
44 large(:,sx-sx2:-1:2), large, large(:,lx-1:-1:lx-sx2); ...
45 large(ly-1:-1:ly-sy2,sx-sx2:-1:2), ...
46 large(ly-1:-1:ly-sy2,:), ...
47 large(ly-1:-1:ly-sy2,lx-1:-1:lx-sx2) ];
48
49c = conv2(clarge,small,'valid');
50