summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m
diff options
context:
space:
mode:
authorleochanj <jbakita@cs.unc.edu>2020-10-21 01:52:54 -0400
committerleochanj <jbakita@cs.unc.edu>2020-10-21 01:52:54 -0400
commit25d94aa8aabb8ac3e8bbea0bc439ea6148444cc8 (patch)
treeba80e76d25d9ca9486092e2f6b6d76f0e3352bf7 /SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m
parente2b50015cebdfba68699abd6e8575e38230f5a78 (diff)
debug libextra and remove matlab
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