summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-19 23:09:30 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 02:40:39 -0400
commitf618466c25d43f3bae9e40920273bf77de1e1149 (patch)
tree460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m52
1 files changed, 52 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m
new file mode 100755
index 0000000..948c2e1
--- /dev/null
+++ b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/upBlur.m
@@ -0,0 +1,52 @@
1% RES = upBlur(IM, LEVELS, FILT)
2%
3% Upsample and blur an image. The blurring is done with filter
4% kernel specified by FILT (default = 'binom5'), which can be a string
5% (to be passed to namedFilter), a vector (applied separably as a 1D
6% convolution kernel in X and Y), or a matrix (applied as a 2D
7% convolution kernel). The downsampling is always by 2 in each
8% direction.
9%
10% The procedure is applied recursively LEVELS times (default=1).
11
12% Eero Simoncelli, 4/97.
13
14function res = upBlur(im, nlevs, filt)
15
16%------------------------------------------------------------
17%% OPTIONAL ARGS:
18
19if (exist('nlevs') ~= 1)
20 nlevs = 1;
21end
22
23if (exist('filt') ~= 1)
24 filt = 'binom5';
25end
26
27%------------------------------------------------------------
28
29if isstr(filt)
30 filt = namedFilter(filt);
31end
32
33if nlevs > 1
34 im = upBlur(im,nlevs-1,filt);
35end
36
37if (nlevs >= 1)
38 if (any(size(im)==1))
39 if (size(im,1)==1)
40 filt = filt';
41 end
42 res = upConv(im,filt,'reflect1',(size(im)~=1)+1);
43 elseif (any(size(filt)==1))
44 filt = filt(:);
45 res = upConv(im,filt,'reflect1',[2 1]);
46 res = upConv(res,filt','reflect1',[1 2]);
47 else
48 res = upConv(im,filt,'reflect1',[2 2]);
49 end
50else
51 res = im;
52end