title: converting RGB and HSV values in matlab / octave
body: <p>I created an animation to see the different values of RGB and the equivalent HSV values using <code>rgb2hsv</code> but the <code>colors don't match at all</code> am I using the conversion incorrectly?  <em>I was expecting to get similar colors and get the equivalent HSV values to that of the RGB values</em>, How can I do this? </p>
  
  <p>Example code I used to test along with animation below.</p>
  
  <p><a href="https://i.stack.imgur.com/l6hqv.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l6hqv.gif" alt="rgb2hsv values"></a></p>
  
  <pre><code>clear all,clf reset,tic,clc
  pkg load image
  for ii=1:5:255
    ii;
  
    r(:,:,1)=127;
    g(:,:,1)=mod(19+ii,255);
    b(:,:,1)=12;
    rgb_img(:,:,1)=r;
    rgb_img(:,:,2)=g;
    rgb_img(:,:,3)=b;
    rgb_img=uint8(rgb_img); %convert so Imshow an show image
  
    hsv_img=rgb2hsv(rgb_img);
    h=hsv_img(:,:,1);
    s=hsv_img(:,:,2);
    v=hsv_img(:,:,3);
    hsv_img=uint8(hsv_img); %convert so Imshow an show image
  
    pause(.0001)
  
    height_wanted=300;%size(img,1) %length wanted needs to stay size(repmat_rgb,1) to get all colors. only change for testing
    width_wanted=280; %width wanted can be changed
  
    rgb_out = imresize(rgb_img, [height_wanted, width_wanted]); %reshape output
    hsv_out = imresize(hsv_img, [height_wanted, width_wanted]); %reshape output
  
    str_rgb1=('RGB Values');
    str_rgb2=(sprintf('\nRed=%3d  Green=%3d  Blue=%3d',r,g,b));
    str_hsv1=('HSV Values');
    str_hsv2=(sprintf('\nHue=%0.3f  Satuation=%0.3f  Value=%0.3f',h,s,v));
  
    subplot(1,2,1);imshow(rgb_out); title([str_rgb1,str_rgb2]);
    subplot(1,2,2);imshow(hsv_out); title([str_hsv1,str_hsv2]);
  end
  </code></pre>
  
  <p>Ps:  I'm using Octave 4.0 which is like Matlab</p>