summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m24
1 files changed, 24 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m
new file mode 100755
index 0000000..8351eb4
--- /dev/null
+++ b/SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m
@@ -0,0 +1,24 @@
1% K = KURT2(MTX,MEAN,VAR)
2%
3% Sample kurtosis (fourth moment divided by squared variance)
4% of a matrix. Kurtosis of a Gaussian distribution is 3.
5% MEAN (optional) and VAR (optional) make the computation faster.
6
7% Eero Simoncelli, 6/96.
8
9function res = kurt2(mtx, mn, v)
10
11if (exist('mn') ~= 1)
12 mn = mean(mean(mtx));
13end
14
15if (exist('v') ~= 1)
16 v = var2(mtx,mn);
17end
18
19if (isreal(mtx))
20 res = mean(mean(abs(mtx-mn).^4)) / (v^2);
21else
22 res = mean(mean(real(mtx-mn).^4)) / (real(v)^2) + ...
23 i*mean(mean(imag(mtx-mn).^4)) / (imag(v)^2);
24end