view general/numerical/addnorm.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents e44f49929e56
children
line wrap: on
line source
function [Y,M]=addnorm(F,X)
% addnorm - additive normalisation with respect to arbitrary function
% 
% addnorm :: 
%    ([[N,M]] -> [[N,1]]) | ([[N,M]] -> [[1,M]]) 
%       ~'function to compute offsets',
%    [[N,M]]           ~'data to normalise'
% -> [[N,M]]           ~'offset vectors' 
%    [[N,1]] | [[1,M]] ~'the vector that was subtracted'.
%
% This function can work row-wise OR column-wise depending on what
% the offset computing function returns.
%
% EXAMPLES
% 
% To zero-mean each ROW of an N-by-M array X, use
%    addnorm(@(t)mean(t,2),X);
%
% To zero the MEDIAN of each COLUMN, use
%    addnorm(@median,X);

Y=vecop1(@minus,X,F(X)); % vecshift(F(X),X);