diff options
author | leochanj105 <leochanj@live.unc.edu> | 2020-10-19 23:09:30 -0400 |
---|---|---|
committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 02:40:39 -0400 |
commit | f618466c25d43f3bae9e40920273bf77de1e1149 (patch) | |
tree | 460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m | |
parent | 47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff) |
initial sd-vbs
initial sd-vbs
add sd-vbs
sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m')
-rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m new file mode 100755 index 0000000..3d79b4c --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/imStats.m | |||
@@ -0,0 +1,41 @@ | |||
1 | % imStats(IM1,IM2) | ||
2 | % | ||
3 | % Report image (matrix) statistics. | ||
4 | % When called on a single image IM1, report min, max, mean, stdev, | ||
5 | % and kurtosis. | ||
6 | % When called on two images (IM1 and IM2), report min, max, mean, | ||
7 | % stdev of the difference, and also SNR (relative to IM1). | ||
8 | |||
9 | % Eero Simoncelli, 6/96. | ||
10 | |||
11 | function [] = imStats(im1,im2) | ||
12 | |||
13 | if (~isreal(im1)) | ||
14 | error('Args must be real-valued matrices'); | ||
15 | end | ||
16 | |||
17 | if (exist('im2') == 1) | ||
18 | difference = im1 - im2; | ||
19 | [mn,mx] = range2(difference); | ||
20 | mean = mean2(difference); | ||
21 | v = var2(difference,mean); | ||
22 | if (v < realmin) | ||
23 | snr = Inf; | ||
24 | else | ||
25 | snr = 10 * log10(var2(im1)/v); | ||
26 | end | ||
27 | fprintf(1, 'Difference statistics:\n'); | ||
28 | fprintf(1, ' Range: [%c, %c]\n',mn,mx); | ||
29 | fprintf(1, ' Mean: %f, Stdev (rmse): %f, SNR (dB): %f\n',... | ||
30 | mean,sqrt(v),snr); | ||
31 | else | ||
32 | [mn,mx] = range2(im1); | ||
33 | mean = mean2(im1); | ||
34 | var = var2(im1); | ||
35 | stdev = sqrt(real(var))+sqrt(imag(var)); | ||
36 | kurt = kurt2(im1, mean, stdev^2); | ||
37 | fprintf(1, 'Image statistics:\n'); | ||
38 | fprintf(1, ' Range: [%f, %f]\n',mn,mx); | ||
39 | fprintf(1, ' Mean: %f, Stdev: %f, Kurtosis: %f\n',mean,stdev,kurt); | ||
40 | end | ||
41 | |||