summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.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/shift.m
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.m15
1 files changed, 15 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.m
new file mode 100755
index 0000000..497297e
--- /dev/null
+++ b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/shift.m
@@ -0,0 +1,15 @@
1% [RES] = shift(MTX, OFFSET)
2%
3% Circular shift 2D matrix samples by OFFSET (a [Y,X] 2-vector),
4% such that RES(POS) = MTX(POS-OFFSET).
5
6function res = shift(mtx, offset)
7
8dims = size(mtx);
9
10offset = mod(-offset,dims);
11
12res = [ mtx(offset(1)+1:dims(1), offset(2)+1:dims(2)), ...
13 mtx(offset(1)+1:dims(1), 1:offset(2)); ...
14 mtx(1:offset(1), offset(2)+1:dims(2)), ...
15 mtx(1:offset(1), 1:offset(2)) ];