summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.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/matlab/shrink.m
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m25
1 files changed, 25 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m
new file mode 100755
index 0000000..7af0151
--- /dev/null
+++ b/SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m
@@ -0,0 +1,25 @@
1function ts=shrink(t,f)
2
3% It shrinks an image in a factor f
4% in each dimension.
5% ts = shrink(t,f)
6% ts may also be complex.
7% See also: expand.m, blurDn.m
8% JPM, April 95, Instituto de Optica, CSIC, Madrid.
9
10[my,mx]=size(t);
11T=fftshift(fft2(t))/f^2;
12Ts=zeros(my/f,mx/f);
13y1=my/2+2-my/(2*f);
14y2=my/2+my/(2*f);
15x1=mx/2+2-mx/(2*f);
16x2=mx/2+mx/(2*f);
17Ts(2:my/f,2:mx/f)=T(y1:y2,x1:x2);
18Ts(1,2:mx/f)=(T(y1-1,x1:x2)+T(y2+1,x1:x2))/2;
19Ts(2:my/f,1)=(T(y1:y2,x1-1)+T(y1:y2,x2+1))/2;
20Ts(1,1)=(T(y1-1,x1-1)+T(y1-1,x2+1)+T(y2+1,x1-1)+T(y2+1,x2+1))/4;
21Ts=fftshift(Ts);
22ts=ifft2(Ts);
23if all(imag(t)==0),
24 ts = real(ts);
25end