Code covered by the BSD License  

Highlights from
Plot on an image- addMarkerLines2Img

image thumbnail

Plot on an image- addMarkerLines2Img

by

 

09 Jul 2012 (Updated )

Plot a curve line/points on an image

numericcolor=colorName2Val(colorName)
function numericcolor=colorName2Val(colorName)
% The function converts Matlab supported colorName Short/Long color name to RGB triple.
%   See ColorSpec for details
switch(colorName)
   case({'y', 'yellow'})
      numericcolor=zeros(1,1,3);
      numericcolor(1:2)=1;
   case({'m', 'magenta'})
      numericcolor=zeros(1,1,3);
      numericcolor([1,3])=1;
   case({'c', 'cyan'})
      numericcolor=zeros(1,1,3);
      numericcolor(2:3)=1;
   case({'r', 'red'})
      numericcolor=zeros(1,1,3);
      numericcolor(1)=1;
   case({'g', 'green'})
      numericcolor=zeros(1,1,3);
      numericcolor(2)=1;
   case({'b', 'blue'})
      numericcolor=zeros(1,1,3);
      numericcolor(3)=1;
   case({'w', 'white'})
      numericcolor=ones(1,1,3);
   case({'k', 'black'})
      numericcolor=zeros(1,1,3);
   case({'none', 'NONE'})
      numericcolor=[];  % numericcolor='none';
   otherwise
      assert( isnumeric(colorName),'Color %s is not supported', colorName);
      numericcolor=colorName; % if  colorName is a number- just use the numeric value 
      if length(numericcolor)==1
         numericcolor=repmat(numericcolor, [1,1,3]);
      end
end

Contact us