diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m')
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/entropy2.m | 31 |
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 | |||
| 12 | function res = entropy2(mtx,binsize) | ||
| 13 | |||
| 14 | %% Ensure it's a vector, not a matrix. | ||
| 15 | vec = mtx(:); | ||
| 16 | [mn,mx] = range2(vec); | ||
| 17 | |||
| 18 | if (exist('binsize') == 1) | ||
| 19 | nbins = max((mx-mn)/binsize, 1); | ||
| 20 | else | ||
| 21 | nbins = 256; | ||
| 22 | end | ||
| 23 | |||
| 24 | [bincount,bins] = histo(vec,nbins); | ||
| 25 | |||
| 26 | %% Collect non-zero bins: | ||
| 27 | H = bincount(find(bincount)); | ||
| 28 | H = H/sum(H); | ||
| 29 | |||
| 30 | res = -sum(H .* log2(H)); | ||
| 31 | |||
