title: Convert RGB image to YUV and convert back in matlab
body: <p>I am very new to Matlab. I am trying to convert an RGB image to YUV, and convert it back to RGB. This is my code:</p>
  
  <pre><code>RGB = imread('ist.jpg');
  
  R = RGB(:,:,1);
  G = RGB(:,:,2);
  B = RGB(:,:,3);
  
  Y = 0.299 * R + 0.587 * G + 0.114 * B;
  U = -0.14713 * R - 0.28886 * G + 0.436 * B;
  V = 0.615 * R - 0.51499 * G - 0.10001 * B;
  
  R = Y + 1.139834576 * V;
  G = Y -.3946460533 * U -.58060 * V;
  B = Y + 2.032111938 * U;
  
  RGB = cat(3,R,G,B);
  imshow(RGB); 
  </code></pre>
  
  <p>The final image that Matlab shows me is very blue-ish and very different from the initial RGB image. Also when I compare the certain pixels before and after Blue channel values, I get different values then each other. What am I doing wrong.</p>
  
  <p>Also if there is a more efficient and shorter way to let me access an image's Y, U and V values, it would be better.</p>
  
  <p>I would be really thankful for any help of any kind.</p>