diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/histoMatch.m')
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/histoMatch.m | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/histoMatch.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/histoMatch.m deleted file mode 100755 index ab82782..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/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 | |||
| 9 | function res = histoMatch(mtx, N, X) | ||
| 10 | |||
| 11 | if ( exist('histo') == 3 ) | ||
| 12 | [oN, oX] = histo(mtx(:), size(X(:),1)); | ||
| 13 | else | ||
| 14 | [oN, oX] = hist(mtx(:), size(X(:),1)); | ||
| 15 | end | ||
| 16 | |||
| 17 | oStep = oX(2) - oX(1); | ||
| 18 | oC = [0, cumsum(oN)]/sum(oN); | ||
| 19 | oX = [oX(1)-oStep/2, oX+oStep/2]; | ||
| 20 | |||
| 21 | N = N(:)'; | ||
| 22 | X = X(:)'; | ||
| 23 | N = N + mean(N)/(1e8); %% HACK: no empty bins ensures nC strictly monotonic | ||
| 24 | |||
| 25 | nStep = X(2) - X(1); | ||
| 26 | nC = [0, cumsum(N)]/sum(N); | ||
| 27 | nX = [X(1)-nStep/2, X+nStep/2]; | ||
| 28 | |||
| 29 | nnX = interp1(nC, nX, oC, 'linear'); | ||
| 30 | |||
| 31 | if ( exist('pointOp') == 3 ) | ||
| 32 | res = pointOp(mtx, nnX, oX(1), oStep); | ||
| 33 | else | ||
| 34 | res = reshape(interp1(oX, nnX, mtx(:)),size(mtx,1),size(mtx,2)); | ||
| 35 | end | ||
