Thread Subject: compiling images into a video

Subject: compiling images into a video

From: Jimmy

Date: 20 Oct, 2009 18:33:04

Message: 1 of 11

        Hi all,
I am wondering if there is anybody can help me convert images to a video
I have 9 images, which you can see on http://www.flickr.com/photos/43435855@N02/
now I need to make an video from these nine images.
I did some research on some commands such as movie() etc suggested by ImageAnalyst but I still don't know how to start. Can someone who has done it before or know how to do it give me a hand?
           Any help is really appreciated
            Thank you for your time

Subject: compiling images into a video

From: Peter Webb

Date: 20 Oct, 2009 19:23:08

Message: 2 of 11


These show how to use the MOVIE command in MATLAB:
http://www.rpi.edu/~holmes/NumDiffEqs/Demos/matlab.movie.info.pdf
http://www.math.canterbury.ac.nz/~c.scarrott/MATLAB_Movies/movies.html
http://www.math.uic.edu/~jan/mcs320s03/matlec6.pdf

If you have .JPEG images, simply read them into MATLAB using IMREAD, then
apply the techniques suggested above.

"Jimmy " <testbest1@yahoo.com> wrote in message
news:hbkvp0$2tu$1@fred.mathworks.com...
> Hi all,
> I am wondering if there is anybody can help me convert images to a video
> I have 9 images, which you can see on
> http://www.flickr.com/photos/43435855@N02/
> now I need to make an video from these nine images.
> I did some research on some commands such as movie() etc suggested by
> ImageAnalyst but I still don't know how to start. Can someone who has done
> it before or know how to do it give me a hand?
> Any help is really appreciated
> Thank you for your time

Subject: compiling images into a video

From: Jimmy

Date: 20 Oct, 2009 20:41:01

Message: 3 of 11

  Thank you very much for your reply, the images are .tiff format. Does this make any
  difference. I'll try to read the links you've given and work it out.
        

"Peter Webb" <pwebb@mathworks.com> wrote in message <hbl2ms$j96$1@fred.mathworks.com>...
>
> These show how to use the MOVIE command in MATLAB:
> http://www.rpi.edu/~holmes/NumDiffEqs/Demos/matlab.movie.info.pdf
> http://www.math.canterbury.ac.nz/~c.scarrott/MATLAB_Movies/movies.html
> http://www.math.uic.edu/~jan/mcs320s03/matlec6.pdf
>
> If you have .JPEG images, simply read them into MATLAB using IMREAD, then
> apply the techniques suggested above.
>
> "Jimmy " <testbest1@yahoo.com> wrote in message
> news:hbkvp0$2tu$1@fred.mathworks.com...
> > Hi all,
> > I am wondering if there is anybody can help me convert images to a video
> > I have 9 images, which you can see on
> > http://www.flickr.com/photos/43435855@N02/
> > now I need to make an video from these nine images.
> > I did some research on some commands such as movie() etc suggested by
> > ImageAnalyst but I still don't know how to start. Can someone who has done
> > it before or know how to do it give me a hand?
> > Any help is really appreciated
> > Thank you for your time
>

Subject: compiling images into a video

From: Jan Simon

Date: 20 Oct, 2009 21:43:02

Message: 4 of 11

Dear Jimmy!

> Thank you very much for your reply, the images are .tiff format. Does this make any
> difference. I'll try to read the links you've given and work it out.

TIFF files are accepted also.
What do you mean with "video"? AVI, DVD, animated GIF, a real video tape, Matlab movie object, mpeg, MOV, ... ?

Kind regards, Jan

Subject: compiling images into a video

From: Jimmy

Date: 20 Oct, 2009 21:54:03

Message: 5 of 11

        Hi Jan,
I mean a simple video format such as avi which follows the sequence of the images from image 1 to image 9.
      Thank you

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <hblat6$k7q$1@fred.mathworks.com>...
> Dear Jimmy!
>
> > Thank you very much for your reply, the images are .tiff format. Does this make any
> > difference. I'll try to read the links you've given and work it out.
>
> TIFF files are accepted also.
> What do you mean with "video"? AVI, DVD, animated GIF, a real video tape, Matlab movie object, mpeg, MOV, ... ?
>
> Kind regards, Jan

Subject: compiling images into a video

From: Jan Simon

Date: 20 Oct, 2009 22:42:03

Message: 6 of 11

Dear Jimmy!

> I mean a simple video format such as avi which follows the sequence of the images from image 1 to image 9.

There may be better solution than doing this in Matlab. Especially the AVI-encoder may not macth the optimal quality. But it works, of course:

  % List of files (or any other trick to get the file names dynamically):
  ImageList = {'ImageFile1.tif', 'ImageFile2.tif', 'ImageFile3.tif', ...
    'ImageFile4.tif', 'ImageFile5.tif', 'ImageFile6.tif', ...
    'ImageFile7.tif', 'ImageFile8.tif', 'ImageFile9.tif'};

  AVI = avifile('D:\The9Pic.avi', 'FPS', 1, 'Compression', 'none');
  for iImage = 1:9
    aImage = imread(ImageList{iImage});
    AVI = addframe(AVI, aImage);
  end
  close(AVI);

See help of AVIFILE for more parameters.
This code can fail, if the TIFF is encode with CMYK colors, and a lot of further problems can appear. But for 24bit RGB images the AVI creation should work directly. Please try it.

Note: WindowsXP (to be exact: MediaPlayer) has problems to play an AVI from the TEMP folder. The error message was excellent: "Cannot find compressor." Moving the AVI outside the TEMP directory solved the problem immediately. Funny.

Good night, Jan

Subject: compiling images into a video

From: Jimmy

Date: 22 Oct, 2009 19:36:19

Message: 7 of 11

      Hi Jan,
thank you very much for your help. Unfortunately I am getting some error which says 'not enough output arguments' when I try to run the code. And it gives error at close(AVI) as well. But thanks a lot for your try.


"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <hblebr$98k$1@fred.mathworks.com>...
> Dear Jimmy!
>
> > I mean a simple video format such as avi which follows the sequence of the images from image 1 to image 9.
>
> There may be better solution than doing this in Matlab. Especially the AVI-encoder may not macth the optimal quality. But it works, of course:
>
> % List of files (or any other trick to get the file names dynamically):
> ImageList = {'ImageFile1.tif', 'ImageFile2.tif', 'ImageFile3.tif', ...
> 'ImageFile4.tif', 'ImageFile5.tif', 'ImageFile6.tif', ...
> 'ImageFile7.tif', 'ImageFile8.tif', 'ImageFile9.tif'};
>
> AVI = avifile('D:\The9Pic.avi', 'FPS', 1, 'Compression', 'none');
> for iImage = 1:9
> aImage = imread(ImageList{iImage});
> AVI = addframe(AVI, aImage);
> end
> close(AVI);
>
> See help of AVIFILE for more parameters.
> This code can fail, if the TIFF is encode with CMYK colors, and a lot of further problems can appear. But for 24bit RGB images the AVI creation should work directly. Please try it.
>
> Note: WindowsXP (to be exact: MediaPlayer) has problems to play an AVI from the TEMP folder. The error message was excellent: "Cannot find compressor." Moving the AVI outside the TEMP directory solved the problem immediately. Funny.
>
> Good night, Jan

Subject: compiling images into a video

From: Jan Simon

Date: 23 Oct, 2009 08:30:20

Message: 8 of 11

Dear Jimmy!
 
> thank you very much for your help. Unfortunately I am getting some error which says 'not enough output arguments' when I try to run the code. And it gives error at close(AVI) as well. But thanks a lot for your try.

It would be helpful if you post the complete error message and the line, where it occurs. I cannot analyse "some error".
On Matlab 6.5, 2008b, 2009a the code works (except I've inserted a typo at posting it here, but I cannot find one). Perhaps there is the same problem as with the AUDIOPLAYER object: For some Matlab version the needed command is:
  play(audioplayer_object)
and for others:
  audioplayer_object.play.

So please look in the already mentioned "help avifile", where you can find an example for creating an AVI with your Matlab version.

Good luck, Jan

Subject: compiling images into a video

From: Irati Epelde

Date: 23 Oct, 2009 09:34:19

Message: 9 of 11

"Jimmy " <testbest1@yahoo.com> wrote in message <hbqc7j$gq9$1@fred.mathworks.com>...
> Hi Jan,
> thank you very much for your help. Unfortunately I am getting some error which says 'not enough output arguments' when I try to run the code. And it gives error at close(AVI) as well. But thanks a lot for your try.
>
> Hi Jimmy:

In the last sentences try with :
AVI=close(AVI);

good luck!!!

Irati.

Subject: compiling images into a video

From: Jimmy

Date: 24 Oct, 2009 19:57:00

Message: 10 of 11

       Hi everyone,
 thank you so much for your help. I managed to create a video changing the last line
with AVI=close(AVI);. But now the quality of the video is very poor and it's impossible to recognize any object. Do you have any idea what the reason may be?
         Thank you

  
   
"Irati Epelde" <irati.epelde@gmail.com> wrote in message <hbrtar$l50$1@fred.mathworks.com>...
> "Jimmy " <testbest1@yahoo.com> wrote in message <hbqc7j$gq9$1@fred.mathworks.com>...
> > Hi Jan,
> > thank you very much for your help. Unfortunately I am getting some error which says 'not enough output arguments' when I try to run the code. And it gives error at close(AVI) as well. But thanks a lot for your try.
> >
> > Hi Jimmy:
>
> In the last sentences try with :
> AVI=close(AVI);
>
> good luck!!!
>
> Irati.

Subject: compiling images into a video

From: Jan Simon

Date: 25 Oct, 2009 20:45:02

Message: 11 of 11

"Jimmy " <testbest1@yahoo.com> wrote in message <hbvm6c$6a$1@fred.mathworks.com>...
> Hi everyone,
> thank you so much for your help. I managed to create a video changing the last line
> with AVI=close(AVI);. But now the quality of the video is very poor and it's impossible to recognize any object. Do you have any idea what the reason may be?

See the help section of AVIFILE:
  help avifile
There you find a descritpion of the Quality property.

If your pictures are photos, AVI files may be ok. But for animations/computer graphics my personal impression is, that AVIs are ugly! E.g. Indeo5 compressor and 90% Quality are a compromise between file size and ugly artifacts. But a simple animated GIF is nicer and smaller. I'm exporting PNGs and let ImageMagick create a nice and tiny GIF...

Good luck, Jan

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com