summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-20 03:47:33 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 03:47:33 -0400
commita32f220f06cc463e5b56e7fa0b1b1334d94d08f3 (patch)
tree4af4caa60074465d85fc2ef5cc1b23e74c064329 /SD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m
parent79f30887129145e15e5172e36a7d7602859fc932 (diff)
matlab removed
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m58
1 files changed, 0 insertions, 58 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m
deleted file mode 100755
index 8da36e5..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/histo.m
+++ /dev/null
@@ -1,58 +0,0 @@
1% [N,X] = histo(MTX, nbinsOrBinsize, binCenter);
2%
3% Compute a histogram of (all) elements of MTX. N contains the histogram
4% counts, X is a vector containg the centers of the histogram bins.
5%
6% nbinsOrBinsize (optional, default = 101) specifies either
7% the number of histogram bins, or the negative of the binsize.
8%
9% binCenter (optional, default = mean2(MTX)) specifies a center position
10% for (any one of) the histogram bins.
11%
12% How does this differ from MatLab's HIST function? This function:
13% - allows uniformly spaced bins only.
14% +/- operates on all elements of MTX, instead of columnwise.
15% + is much faster (approximately a factor of 80 on my machine).
16% + allows specification of number of bins OR binsize. Default=101 bins.
17% + allows (optional) specification of binCenter.
18
19% Eero Simoncelli, 3/97.
20
21function [N, X] = histo(mtx, nbins, binCtr)
22
23%% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD)
24
25%fprintf(1,'WARNING: You should compile the MEX version of "histo.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n');
26
27mtx = mtx(:);
28
29%------------------------------------------------------------
30%% OPTIONAL ARGS:
31
32[mn,mx] = range2(mtx);
33
34if (exist('binCtr') ~= 1)
35 binCtr = mean(mtx);
36end
37
38if (exist('nbins') == 1)
39 if (nbins < 0)
40 binSize = -nbins;
41 else
42 binSize = ((mx-mn)/nbins);
43 tmpNbins = round((mx-binCtr)/binSize) - round((mn-binCtr)/binSize);
44 if (tmpNbins ~= nbins)
45 warning('Using %d bins instead of requested number (%d)',tmpNbins,nbins);
46 end
47 end
48else
49 binSize = ((mx-mn)/101);
50end
51
52firstBin = binCtr + binSize*round( (mn-binCtr)/binSize );
53
54tmpNbins = round((mx-binCtr)/binSize) - round((mn-binCtr)/binSize);
55
56bins = firstBin + binSize*[0:tmpNbins];
57
58[N, X] = hist(mtx, bins);