Blame view

stim/matlab/rtsHSVtoRGB.m 522 Bytes
1ff9af85   David Mayerich   added MATLAB/OCTA...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  function RGBval = rtsHSVtoRGB(HSVval)

  

  H = HSVval(1);

  S = HSVval(2);

  V = HSVval(3);

  

  C = V*S;

  Hprime = H/60;

  X = C*(1 - abs(mod(Hprime, 2) - 1));

  

  RGBval = [0 0 0];

  if Hprime >= 0 && Hprime < 1

      RGBval = [C X 0];

  end

  if Hprime >= 1 && Hprime < 2

      RGBval = [X C 0];

  end

  if Hprime >= 2 && Hprime < 3

      RGBval = [0 C X];

  end

  if Hprime >= 3 && Hprime < 4

      RGBval = [0 X C];

  end

  if Hprime >= 4 && Hprime < 5

      RGBval = [X 0 C];

  end

  if Hprime >= 5 && Hprime < 6

      RGBval = [C 0 X];

  end