Hi,
I just submitted my YUY2 to RGB converter to file exchange. But until it appears there, here's the code:
function newdata = YUY2toRGB(data)
%% input is (:,:,1:3), where
%% (:,:,1) is Y, (:,:,2) is U, (:,:,3) is V
Y = single(data(:,:,1));
U = single(data(:,:,2));
V = single(data(:,:,3));
C = Y-16;
D = U - 128;
E = V - 128;
R = uint8((298*C+409*E+128)/256);
G = uint8((298*C-100*D-208*E+128)/256);
B = uint8((298*C+516*D+128)/256);
newdata = uint8(zeros(size(data)));
newdata(:,:,1)=R;
newdata(:,:,2)=G;
newdata(:,:,3)=B;
thanks for your reply... i'll try it...
I recently had the same problem, my webcam takes only the YUY2 format...
I solved this problem doing this:
%1st you set the camera to use.
%'camera' is the DeviceID of your camera.
vinfo = imaqhwinfo('winvideo',camera);
%Then you set the video object 'vid', where 'camera' is the DeviceID of your camera.
%'format' is the index which specifies one of the YUY2 formats of your camera.
vid = videoinput('winvideo',camera,vinfo.SupportedFormats{format});
%Finally, you set the ReturnedColorSpace as RGB!
set(vid,'ReturnedColorSpace','rgb'); %<----- This is the command!!!!
Hope It Works!!!!!
Lautaro Carmona
I referenced your message on my yuy2 to rgb converter M-file page (http://www.mathworks.com/matlabcentral/fileexchange/26249-yuy2-to-rgb-converter).
"Lautaro Carmona" <lcar...@alu.itba.edu.ar> wrote in message <hl2pe0$2jq$1...@fred.mathworks.com>...