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/matlabPyrTools/skew2.m | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/skew2.m (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/skew2.m') diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/skew2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/skew2.m new file mode 100755 index 0000000..623d6ca --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/skew2.m @@ -0,0 +1,21 @@ +% S = SKEW2(MTX,MEAN,VAR) +% +% Sample skew (third moment divided by variance^3/2) of a matrix. +% MEAN (optional) and VAR (optional) make the computation faster. + +function res = skew2(mtx, mn, v) + +if (exist('mn') ~= 1) + mn = mean2(mtx); +end + +if (exist('v') ~= 1) + v = var2(mtx,mn); +end + +if (isreal(mtx)) + res = mean(mean((mtx-mn).^3)) / (v^(3/2)); +else + res = mean(mean(real(mtx-mn).^3)) / (real(v)^(3/2)) + ... + i * mean(mean(imag(mtx-mn).^3)) / (imag(v)^(3/2)); +end -- cgit v1.2.2