summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m35
1 files changed, 0 insertions, 35 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m
deleted file mode 100755
index ab82782..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/histoMatch.m
+++ /dev/null
@@ -1,35 +0,0 @@
1% RES = histoMatch(MTX, N, X)
2%
3% Modify elements of MTX so that normalized histogram matches that
4% specified by vectors X and N, where N contains the histogram counts
5% and X the histogram bin positions (see histo).
6
7% Eero Simoncelli, 7/96.
8
9function res = histoMatch(mtx, N, X)
10
11if ( exist('histo') == 3 )
12 [oN, oX] = histo(mtx(:), size(X(:),1));
13else
14 [oN, oX] = hist(mtx(:), size(X(:),1));
15end
16
17oStep = oX(2) - oX(1);
18oC = [0, cumsum(oN)]/sum(oN);
19oX = [oX(1)-oStep/2, oX+oStep/2];
20
21N = N(:)';
22X = X(:)';
23N = N + mean(N)/(1e8); %% HACK: no empty bins ensures nC strictly monotonic
24
25nStep = X(2) - X(1);
26nC = [0, cumsum(N)]/sum(N);
27nX = [X(1)-nStep/2, X+nStep/2];
28
29nnX = interp1(nC, nX, oC, 'linear');
30
31if ( exist('pointOp') == 3 )
32 res = pointOp(mtx, nnX, oX(1), oStep);
33else
34 res = reshape(interp1(oX, nnX, mtx(:)),size(mtx,1),size(mtx,2));
35end