diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/rconv2.m')
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/rconv2.m | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/rconv2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/rconv2.m deleted file mode 100755 index 0c12490..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/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 | |||
| 15 | function c = rconv2(a,b,ctr) | ||
| 16 | |||
| 17 | if (exist('ctr') ~= 1) | ||
| 18 | ctr = 0; | ||
| 19 | end | ||
| 20 | |||
| 21 | if (( size(a,1) >= size(b,1) ) & ( size(a,2) >= size(b,2) )) | ||
| 22 | large = a; small = b; | ||
| 23 | elseif (( size(a,1) <= size(b,1) ) & ( size(a,2) <= size(b,2) )) | ||
| 24 | large = b; small = a; | ||
| 25 | else | ||
| 26 | error('one arg must be larger than the other in both dimensions!'); | ||
| 27 | end | ||
| 28 | |||
| 29 | ly = size(large,1); | ||
| 30 | lx = size(large,2); | ||
| 31 | sy = size(small,1); | ||
| 32 | sx = 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: | ||
| 37 | sy2 = floor((sy+ctr-1)/2); | ||
| 38 | sx2 = floor((sx+ctr-1)/2); | ||
| 39 | |||
| 40 | % pad with reflected copies | ||
| 41 | clarge = [ | ||
| 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 | |||
| 49 | c = conv2(clarge,small,'valid'); | ||
| 50 | |||
