From: Naeem on
I am trying to use the code below to convert yuv sequences into a single matlab video file.
but when i run the code it shows error "Invalid file identifier".

can someone please point out the mistake it would be a great help.

clear;
%***************
for i=1:150
i
indx=num2str(i,'%11.3d');

fid = fopen(['C:\video_sim\test_seq\tennis\tt',indx,'.yuv'],'r');
s = fread(fid,[352 240],'uchar');
fclose(fid);
frames_t(:,:,i)=s;
end
frames=frames_t;
for j = 1:150
imshow(frames_t(:,:,j)/255);
Frm(j) = getframe;
end
fp_sec=10;
movie(Frm,2,fp_sec)
From: Walter Roberson on
Naeem wrote:
> I am trying to use the code below to convert yuv sequences into a single
> matlab video file.
> but when i run the code it shows error "Invalid file identifier".

That means an open failed. Your code does not check for that
possibility, and does not display the status result of the open if it
happens.

> can someone please point out the mistake it would be a great help.
>
> clear;
> %***************
> for i=1:150
> i
> indx=num2str(i,'%11.3d');

That is going to result in spaces before the number, and will have .000
at the end (since all the values being converted are integers). Do you
really want a name that has spaces and a decimal place in it?

>
> fid = fopen(['C:\video_sim\test_seq\tennis\tt',indx,'.yuv'],'r');

Test the result of the fopen!
From: Naeem on
Walter Roberson <roberson(a)hushmail.com> wrote in message <bwtNn.21306$7d5.16059(a)newsfe17.iad>...
> Naeem wrote:
> > I am trying to use the code below to convert yuv sequences into a single
> > matlab video file.
> > but when i run the code it shows error "Invalid file identifier".
>
> That means an open failed. Your code does not check for that
> possibility, and does not display the status result of the open if it
> happens.
>
> > can someone please point out the mistake it would be a great help.
> >
> > clear;
> > %***************
> > for i=1:150
> > i
> > indx=num2str(i,'%11.3d');
>
> That is going to result in spaces before the number, and will have .000
> at the end (since all the values being converted are integers). Do you
> really want a name that has spaces and a decimal place in it?
>
> >
> > fid = fopen(['C:\video_sim\test_seq\tennis\tt',indx,'.yuv'],'r');
>
> Test the result of the fopen!


well i have 112 yuv sequences with names like tt001.yuv, tt002.yuv,tt003.yuv etc
i got the above code from a friend , the loop runs for each of 112 frames but the fopen function doesn't seem to work.

If i could atleast convert these sequences into yuv video then i could use yuv2mov function to convert to matlab movie.

do u have any idea please help me out.
From: Walter Roberson on
Naeem wrote:
>> Naeem wrote:

>> > %***************
>> > for i=1:150
>> > i
>> > indx=num2str(i,'%11.3d');

>> > > fid = fopen(['C:\video_sim\test_seq\tennis\tt',indx,'.yuv'],'r');

> well i have 112 yuv sequences with names like tt001.yuv,
> tt002.yuv,tt003.yuv etc
> i got the above code from a friend , the loop runs for each of 112
> frames but the fopen function doesn't seem to work.

for i = 1:150
filename = sprintf('C:\video_sim\test_seq\tennis\tt%03d.yuv', i);
fid = fopen(filename,'r);
...
end
From: Naeem on
Walter Roberson <roberson(a)hushmail.com> wrote in message <hu67dh$2g9$2(a)canopus.cc.umanitoba.ca>...
> Naeem wrote:
> >> Naeem wrote:
>
> >> > %***************
> >> > for i=1:150
> >> > i
> >> > indx=num2str(i,'%11.3d');
>
> >> > > fid = fopen(['C:\video_sim\test_seq\tennis\tt',indx,'.yuv'],'r');
>
> > well i have 112 yuv sequences with names like tt001.yuv,
> > tt002.yuv,tt003.yuv etc
> > i got the above code from a friend , the loop runs for each of 112
> > frames but the fopen function doesn't seem to work.
>
> for i = 1:150
> filename = sprintf('C:\video_sim\test_seq\tennis\tt%03d.yuv', i);
> fid = fopen(filename,'r);
> ...
> end


could u please tell me how to convert a matlab movie into a mat file.