matlab读取YUV视频Word文档格式.doc
《matlab读取YUV视频Word文档格式.doc》由会员分享,可在线阅读,更多相关《matlab读取YUV视频Word文档格式.doc(3页珍藏版)》请在冰点文库上搜索。
)
row=176*2;
col=144*2;
frames=8;
%total=300
forframe=1:
frames
Y=zeros(row,col,frames);
U=zeros(row/2,col/2,frames);
V=zeros(row/2,col/2,frames);
UU=zeros(row,col,frames);
VV=zeros(row,col,frames);
[Y(:
:
frame),count]=fread(fid,[row,col],'
uchar'
);
[U(:
frame),count1]=fread(fid,[row/2,col/2],'
[V(:
frame),count2]=fread(fid,[row/2,col/2],'
%fclose(fid)
%figure,imshow(Y);
UU(1:
2:
row-1,1:
col-1,frame)=U(:
frame);
row-1,2:
col,frame)=U(:
UU(2:
row,1:
row,2:
VV(1:
col-1,frame)=V(:
col,frame)=V(:
VV(2:
R=Y+1.140*(VV-128);
G=Y+0.395*(UU-128)-0.581*(VV-128);
B=Y+2.032*(UU-128);
fori=1:
row
forj=1:
col
ifR(i,j,frame)<
R(i,j,frame)=0;
end
ifR(i,j,frame)>
255
R(i,j,frame)=255;
ifG(i,j,frame)<
G(i,j,frame)=0;
ifG(i,j,frame)>
G(i,j,frame)=255;
ifB(i,j,frame)<
B(i,j,frame)=0;
ifB(i,j,frame)>
B(i,j,frame)=255;
R=R/255;
G=G/255;
B=B/255;
%X=[R'
G'
B'
];
figure,imshow(R(:
frame)'
G(:
B(:
%M(frame)=im2frame(X,map);
%movie(M,10,30)