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:
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);
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.
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.
I would be really thankful for any help of any kind.