Lind 发表于 2006-5-30 12:53

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

<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> = fread(fid,,'uchar');<br>=fread(fid,,'uchar');<br>=fread(fid,,'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=;<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>

suffer 发表于 2006-5-30 16:23

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

你这一部分代码中没有涉及到iptchecknargin这个函数啊<BR>显示的错误又出自iptchecknargin

Lind 发表于 2006-5-31 13:47

这确实是完整的代码,不知道为什么有这样的错误?刚接触MATLAB,请好心人指教一下啊,谢谢了!!! <br>
页: [1]
查看完整版本: [求助]如何用MATLAB显示YUV序列文件?