?? comp_assign2.m
字號:
% EE569 Computer Assignment 2: Color format conversion and video output
% Objective: get familiar with the conversion between YUV
% and RGB format
% Background information
% The YUV video data given in assignment 1 follow 4:2:0 format
% which downsamples chrominance channel by a factor of two
% along both directions. The color conversion matric from RGB
% to YUV is given by
T=[.299 .587 .114; -.169 -.332 .5;.5 -.419 -0.0813];
% Note the DC shift by 128 in the conversion formula of slide 20
% Part I: convert YUV to RGB (3pt)
% read in the first 30 frames of given mobile_cif.yuv sequence
[Y,U,V]=read_video('football_qcif.yuv',144,176,30);
% write a MATLAB function YUV2RGB.m to convert YUV format to RGB
% Syntax for YUV2RGB:
% function [R,G,B]=YUV2RGB(Y,U,V)
[R,G,B]=YUV2RGB(Y,U,V);
% test the green channel
play_video(G);
% write another MATLAB function play_yuv.m to display color video
% Syntax for play_color_video:
% function play_yuv(Y,U,V)
play_yuv(Y,U,V);
% Part II: convert RGB to YUV (2pt)
% You are given a sequence of color images stored in PPM formats (im0.ppm-im8.ppm)
% Write a MATLAB function named RGB2YUV.m to first read in RGB images from a specified
% filename and then convert them to YUV format
% Syntax for RGB2YUV: function [Y,U,V]=RGB2YUV(filename,length)
% Now we read in the first 30 frames of football_qcif sequence
[Y,U,V]=RGB2YUV('im',9);
% Write another MATLAB function named write_yuv.m to write Y/U/V data to a
% .yuv file
write_yuv('teddy.yuv',Y,U,V);
% Use the given YUV viewer software to check the correctness of teddy.yuv
% Part III: bonus part (1pt)
% You are given a video sequence of iris in .avi format (supported by most cameras)
% MATLAB does have a function named ``aviread'' to handle such type of data.
% write a MATLAB function to display .avi file under MATLAB
% Syntax for play_avi: function play_avi(filename)
% What you need to submit: all MATLAB files you have generated -
% YUV2RGB.m, play_yuv.m, RGB2YUV.m, write_yuv.m and play_avi.m (optional)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -