I do not have MATLAB access any more so can't test this. However, imread
is most likely returning uint8
data. Do whos
and see what the data type is. If it is uint8
, the RGB->YUV->RGB conversion is clipping. Try this:
RGB = double(imread('ist.jpg')); % convert to double
% RGB->YUV->RGB like you have them in the current code
RGB = cat(3,R,G,B)./255; % since it's a double now, need 0..1 range for imshow.
% Divide 0..255 by 255 to get 0..1.
imshow(RGB);
See this for more discussion of imshow
and data types.