annotate general/numerical/normalise01.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 8476b3d9d295
children
rev   line source
samer@21 1 function x=normalise01(x,dim)
samer@21 2 % normalise01 - scale and shift all values into the range [0,1].
samer@4 3 %
samer@21 4 % normalise01 :: [Size], D:natural -> [Size].
samer@4 5
samer@4 6 if nargin<2,
samer@4 7 sz=size(x);
samer@4 8 dims=find(sz>1);
samer@4 9 if isempty(dims), dim=1; else dim=dims(1); end
samer@4 10 end
samer@4 11
samer@4 12 x=divnorm(@(z)max(z,[],dim),addnorm(@(y)min(y,[],dim),x));
samer@4 13