summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.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/kurt2.m
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
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