view graphics/colour/desat.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 82075c94eed1
children
line wrap: on
line source
function D=desat(C,s)
% desat(C,s)
% desaturate colormap - moves all colours towards
% a grey of roughly equivalent brightness
% C - colourmap (N by 3 matrix)
% s - saturation: 1 no change, 0 completely grey

% this matrix transforms to grey
G=[0.3 0.5 0.2]'*[1 1 1];
D=s*C + (1-s)*C*G;