Creating a Colour Wheel in lab colour space
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Hello Matlab community, I don't seem to be having much luck figuring this out on my own, so I thought I would appeal to you folks on here. I'm very new to MATLAB and so please forgive my rather simplistic questions here.
But what I need to do for an experiment is to generate a colour wheel that would look something like this: http://colors.napcsweb.com/colorschemer/images/cs_RYB.gif
But the wheel itself needs to be in CIELAB colour space. I don't really understand how to start doing this. We ran a previous experiment in my lab that contained a colour wheel in the HSV space . . .I've included the first part of the code below where it generates 252 colours in HSV space. Basically I need to do something like this, but generated in the CIELAB space. Any thoughts/ideas?
Thanks so much in advance.
for i = 1:252
    val = 1/252*i
    H = val; 
    S = 1;
    V = 1;
    if S == 0 %HSV from 0 to 1 
        R = V * 255; 
        G = V * 255; 
        B = V * 255; 
    else
       var_h = H * 6;
       if ( var_h == 6 )  
           var_h = 0;      %//H must be < 1
       end
       var_i = floor( var_h );             %//Or ... var_i = floor( var_h );
       var_1 = V * ( 1 - S );
       var_2 = V * ( 1 - S * ( var_h - var_i ) );
       var_3 = V * ( 1 - S * ( 1 - ( var_h - var_i ) ) );
     if ( ar_i == 0 ) 
         var_r = V     ; 
         var_g = var_3 ; 
         var_b = var_1 ;
     elseif ( var_i == 1 ) 
         var_r = var_2 ; 
         var_g = V     ;
         var_b = var_1 ;
     elseif ( var_i == 2 ) 
         var_r = var_1 ; 
         var_g = V     ; 
         var_b = var_3 ;
     elseif ( var_i == 3 )  
         var_r = var_1 ; 
         var_g = var_2 ; 
         var_b = V     ;
     elseif ( var_i == 4 )  
         var_r = var_3 ; 
         var_g = var_1 ; 
         var_b = V     ;
     else    
          var_r = V     ; 
          var_g = var_1 ; 
          var_b = var_2 ;
     end
     R = var_r * 255     ;            % //RGB results from 0 to 255
     G = var_g * 255;
     B = var_b * 255;
  end
newmap(i,1:3) = [R G B];
1 comentario
  irvin rynning
 el 27 de Mayo de 2013
				
      Editada: irvin rynning
 el 27 de Mayo de 2013
  
			Did you ever get it to work? your link to the colours is broken by the way, and you are missing an  end which terminates the  for loop
Respuestas (2)
  Image Analyst
      
      
 el 27 de Mayo de 2013
        You might be able to find it here: http://www.mathworks.com/matlabcentral/fileexchange/40640-computational-colour-science-using-matlab-2e in Stephen Westland's File Exchange. He's the professor who quite literally wrote the book on colour science using MATLAB.
0 comentarios
Ver también
Categorías
				Más información sobre Printing and Saving en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



