From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- .../texture_synthesis/src/matlab/shrink.m | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/shrink.m') 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 @@ +function ts=shrink(t,f) + +% It shrinks an image in a factor f +% in each dimension. +% ts = shrink(t,f) +% ts may also be complex. +% See also: expand.m, blurDn.m +% JPM, April 95, Instituto de Optica, CSIC, Madrid. + +[my,mx]=size(t); +T=fftshift(fft2(t))/f^2; +Ts=zeros(my/f,mx/f); +y1=my/2+2-my/(2*f); +y2=my/2+my/(2*f); +x1=mx/2+2-mx/(2*f); +x2=mx/2+mx/(2*f); +Ts(2:my/f,2:mx/f)=T(y1:y2,x1:x2); +Ts(1,2:mx/f)=(T(y1-1,x1:x2)+T(y2+1,x1:x2))/2; +Ts(2:my/f,1)=(T(y1:y2,x1-1)+T(y1:y2,x2+1))/2; +Ts(1,1)=(T(y1-1,x1-1)+T(y1-1,x2+1)+T(y2+1,x1-1)+T(y2+1,x2+1))/4; +Ts=fftshift(Ts); +ts=ifft2(Ts); +if all(imag(t)==0), + ts = real(ts); +end -- cgit v1.2.2