声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3032|回复: 2

[求助]如何用MATLAB显示YUV序列文件?

[复制链接]
发表于 2006-5-30 12:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
<br>网上载了一个读取YUV序列的MATLAB代码,但运行后出现错误,哪位可以帮忙看看啊?刚接触这个,拜托各位指教一下好吗?谢谢!!!!!!<br><br>close all;<br>clear<br>fid = fopen('D:\Sequence\akiyo_cif.yuv','r')<br>row=176*2;col=144*2;<br>frames=8; % total=300<br><br>for frame=1:frames<br>Y=zeros(row,col,frames);<br>U=zeros(row/2,col/2,frames);<br>V=zeros(row/2,col/2,frames);<br>UU=zeros(row,col,frames);<br>VV=zeros(row,col,frames);<br>[Y(:,:,frame),count] = fread(fid,[row,col],'uchar');<br>[U(:,:,frame),count1]=fread(fid,[row/2,col/2],'uchar');<br>[V(:,:,frame),count2]=fread(fid,[row/2,col/2],'uchar');<br>%fclose(fid)<br><br>%figure,imshow(Y);<br><br>UU(1:2:row-1,1:2:col-1,frame)=U(:,:,frame);<br>UU(1:2:row-1,2:2:col,frame)=U(:,:,frame);<br>UU(2:2:row,1:2:col-1,frame)=U(:,:,frame);<br>UU(2:2:row,2:2:col,frame)=U(:,:,frame);<br><br>VV(1:2:row-1,1:2:col-1,frame)=V(:,:,frame);<br>VV(1:2:row-1,2:2:col,frame)=V(:,:,frame);<br>VV(2:2:row,1:2:col-1,frame)=V(:,:,frame);<br>VV(2:2:row,2:2:col,frame)=V(:,:,frame);<br><br>R = Y + 1.140 * (VV-128 );<br>G = Y + 0.395 * (UU-128 ) - 0.581 *(VV-128);<br>B = Y + 2.032 *(UU-128);<br><br>for i=1:row<br>for j=1:col<br>if R(i,j,frame)&lt;0<br>R(i,j,frame)=0;<br>end<br>if R(i,j,frame)&gt;255<br>R(i,j,frame)=255;<br>end<br>if G(i,j,frame)&lt;0<br>G(i,j,frame)=0;<br>end<br>if G(i,j,frame)&gt;255<br>G(i,j,frame)=255;<br>end<br>if B(i,j,frame)&lt;0<br>B(i,j,frame)=0;<br>end<br>if B(i,j,frame)&gt;255<br>B(i,j,frame)=255;<br>end<br>end<br>end<br>R=R/255;G=G/255;B=B/255;<br>%X=[R',G',B'];<br>figure,imshow(R(:,:,frame)',G(:,:,frame)',B(:,:,frame)');<br>%M(frame) =im2frame(X,map);<br>end<br>%movie(M,10,30) <br><br><br>错误信息:<br><br><br>??? Error using ==&gt; iptchecknargin<br>Function IMAGEDISPLAYPARSEINPUTS expected at most 2 input arguments<br>but was called instead with 3 input arguments.<br><br>Error in ==&gt; imuitools\private\imageDisplayParseInputs at 117<br>iptchecknargin(0,2,num_args,mfilename);<br><br>Error in ==&gt; imshow at 151<br>  [cdata, cdatamapping, clim, map, xdata, ydata, ...<br><br><br>
回复
分享到:

使用道具 举报

发表于 2006-5-30 16:23 | 显示全部楼层

回复:(Lind)[求助]如何用MATLAB显示YUV序列文件?

你这一部分代码中没有涉及到iptchecknargin这个函数啊<BR>显示的错误又出自iptchecknargin
 楼主| 发表于 2006-5-31 13:47 | 显示全部楼层
这确实是完整的代码,不知道为什么有这样的错误?刚接触MATLAB,请好心人指教一下啊,谢谢了!!! <br>
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-12 20:32 , Processed in 0.066703 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表