annotate DL/RLS-DLA/private/scalarToRGB.m @ 63:e08af264ef93

(none)
author idamnjanovic
date Tue, 15 Mar 2011 12:23:35 +0000
parents ad36f80e2ccf
children
rev   line source
idamnjanovic@60 1 function s = scalarToRGB(x,colors)
idamnjanovic@60 2 % input values are assumed to lie between 0 and 1
idamnjanovic@60 3
idamnjanovic@60 4 % Copyright 2008, Ewout van den Berg and Michael P. Friedlander
idamnjanovic@60 5 % http://www.cs.ubc.ca/labs/scl/sparco
idamnjanovic@60 6 % $Id: scalarToRGB.m 1040 2008-06-26 20:29:02Z ewout78 $
idamnjanovic@60 7
idamnjanovic@60 8 l = size(colors,1);
idamnjanovic@60 9 m = size(x,1);
idamnjanovic@60 10 n = size(x,2);
idamnjanovic@60 11 s = zeros(m,n,3);
idamnjanovic@60 12
idamnjanovic@60 13 for i=1:m
idamnjanovic@60 14 for j=1:n
idamnjanovic@60 15 idx = max(1,min(l,1+floor((l-1) * x(i,j))));
idamnjanovic@60 16 s(i,j,:) = colors(idx,:);
idamnjanovic@60 17 end
idamnjanovic@60 18 end