function [RGBlin] = tolinear(RGBnon)

% Accepts a matrix of [Rnon,Gnon,Bnon]' values and returns them as linear
% RGB values after the inverse gamma correction.
%
% created: JSB 3/00

load ../data/gamfunctions
load ../data/whiteRGBnon

Rnonnorm = RGBnon(1,:)/whiteRGBnon(1);
Rlinnorm = finvR(Rnonnorm);
Rlin = Rlinnorm*255;

Gnonnorm = RGBnon(2,:)/whiteRGBnon(2);
Glinnorm = finvG(Gnonnorm);
Glin = Glinnorm*255;

Bnonnorm = RGBnon(3,:)/whiteRGBnon(3);
Blinnorm = finvB(Bnonnorm);
Blin = Blinnorm*255;

RGBlin = [Rlin;Glin;Blin];
