diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m')
-rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/kurt2.m | 24 |
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 | |||
9 | function res = kurt2(mtx, mn, v) | ||
10 | |||
11 | if (exist('mn') ~= 1) | ||
12 | mn = mean(mean(mtx)); | ||
13 | end | ||
14 | |||
15 | if (exist('v') ~= 1) | ||
16 | v = var2(mtx,mn); | ||
17 | end | ||
18 | |||
19 | if (isreal(mtx)) | ||
20 | res = mean(mean(abs(mtx-mn).^4)) / (v^2); | ||
21 | else | ||
22 | res = mean(mean(real(mtx-mn).^4)) / (real(v)^2) + ... | ||
23 | i*mean(mean(imag(mtx-mn).^4)) / (imag(v)^2); | ||
24 | end | ||