summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m31
1 files changed, 0 insertions, 31 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m
deleted file mode 100755
index 68a2a9f..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m
+++ /dev/null
@@ -1,31 +0,0 @@
1% E = ENTROPY2(MTX,BINSIZE)
2%
3% Compute the first-order sample entropy of MTX. Samples of VEC are
4% first discretized. Optional argument BINSIZE controls the
5% discretization, and defaults to 256/(max(VEC)-min(VEC)).
6%
7% NOTE: This is a heavily biased estimate of entropy when you
8% don't have much data.
9
10% Eero Simoncelli, 6/96.
11
12function res = entropy2(mtx,binsize)
13
14%% Ensure it's a vector, not a matrix.
15vec = mtx(:);
16[mn,mx] = range2(vec);
17
18if (exist('binsize') == 1)
19 nbins = max((mx-mn)/binsize, 1);
20else
21 nbins = 256;
22end
23
24[bincount,bins] = histo(vec,nbins);
25
26%% Collect non-zero bins:
27H = bincount(find(bincount));
28H = H/sum(H);
29
30res = -sum(H .* log2(H));
31