Displaying an animation / "movie"

classic Classic list List threaded Threaded
36 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Displaying an animation / "movie"

Jeff Miller-5
Hi,
I would really like to use Octave, but there is an important feature I need, which so far I haven't figured out how to do:

In Matlab I can do:
for i=1:100; imshow(rand(100,100)); drawnow; end;

...and it rapidly displays a series of matrices in the same window, like an animated movie. In Octave, when I try this, it opens 100 ImageMagick windows, with each one containing a separate image.

Is there a way to get the desired behavior in Octave? (or any other open-source numerical computation package?)

Thanks for any help!
Jeff


_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Bob Weigel-3

In Matlab I was never satisfied with the movies created using imshow.  I
prefered the finer-grained control of using epstk to create 1 eps file per
frame and then png2swf [http://www.swftools.org/] after converting .eps
to .png with the ImageMagick command line program "convert" .  Using this
method I am able to create full-screen movies without muddled text and lines.
(Also, if I ever want to re-create a movie when typical monitors are
16000x12000 pixels, I just need to run a script that operates on the
vector .eps files and change the -density parameter.)

Here is my .m and shell script I use to automate the process:

for i = 1:99
FileName=sprintf('./figures/Figure_%03d.eps');
% postscript file creation commands
end

#!/bin/bash

DEN=200

cd ./figures
for k in $(ls *.eps); do
    echo "Converting $k";
    convert -density $DENx$DEN $k $k.png;
done
png2swf -o all_X_$DEN.swf -r 12 *.png
                                                                               


On Tuesday 02 May 2006 16:46, Jeff Miller wrote:

> Hi,
> I would really like to use Octave, but there is an important feature I
> need, which so far I haven't figured out how to do:
>
> In Matlab I can do:
> for i=1:100; imshow(rand(100,100)); drawnow; end;
>
> ...and it rapidly displays a series of matrices in the same window, like an
> animated movie. In Octave, when I try this, it opens 100 ImageMagick
> windows, with each one containing a separate image.
>
> Is there a way to get the desired behavior in Octave? (or any other
> open-source numerical computation package?)
>
> Thanks for any help!
> Jeff
_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Robert A. Macy
In reply to this post by Jeff Miller-5
Jeff,

I ran across just such a need and wrote this function for
plotting...
  plotmovie.m

but you could modify it inserting
>> gsplot matrix;
in the for loop and get the same effect for displaying a
matrix.

            - Robert -

On Tue, 2 May 2006 16:46:50 -0400
 "Jeff Miller" <[hidden email]> wrote:

> Hi,
> I would really like to use Octave, but there is an
> important feature I need,
> which so far I haven't figured out how to do:
>
> In Matlab I can do:
> for i=1:100; imshow(rand(100,100)); drawnow; end;
>
> ...and it rapidly displays a series of matrices in the
> same window, like an
> animated movie. In Octave, when I try this, it opens 100
> ImageMagick
> windows, with each one containing a separate image.
>
> Is there a way to get the desired behavior in Octave? (or
> any other
> open-source numerical computation package?)
>
> Thanks for any help!
> Jeff

_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave

plotmovie.m (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Josh Rigler
In reply to this post by Bob Weigel-3
Robert S. Weigel wrote:

> In Matlab I was never satisfied with the movies created using imshow.  I
> prefered the finer-grained control of using epstk to create 1 eps file per
> frame and then png2swf [http://www.swftools.org/] after converting .eps
> to .png with the ImageMagick command line program "convert" .  Using this
> method I am able to create full-screen movies without muddled text and lines.
> (Also, if I ever want to re-create a movie when typical monitors are
> 16000x12000 pixels, I just need to run a script that operates on the
> vector .eps files and change the -density parameter.)
>
> Here is my .m and shell script I use to automate the process:
>
> for i = 1:99
> FileName=sprintf('./figures/Figure_%03d.eps');
> % postscript file creation commands
> end
>
> #!/bin/bash
>
> DEN=200
>
> cd ./figures
> for k in $(ls *.eps); do
>     echo "Converting $k";
>     convert -density $DENx$DEN $k $k.png;
> done
> png2swf -o all_X_$DEN.swf -r 12 *.png
>                                                                                


...and for the archives...

For those using certain versions of Fedora Linux, you may have long ago
noticed that something was broken with Imagemagick's 'convert' routine
whenever converting from .eps to some sort of rasterized format.  The
resolution was bad no matter what you set '-density' equal to, black
lines were changed into white lines, and a whole slew of other things
that resulted in an image of very poor quality.  I'm still not sure what
the problem was/is with convert, but the equivalent ghostscript command
to 'convert -density 300 test.eps test.png' goes as follows:


shell prompt>  gs -q -dBATCH -dNOPAUSE -dEPSCrop -sDEVICE=png16m
-dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r300x300
-sOutputFile=./test.png test.eps


A description of most of these options can be found in the ghostscript
documentation, but the ones you might want to play with are:

-sDEVICE - type of output file;  a list of supported file types can
            be found in a file called devs.mak, which is not always
            distributed with ghostscript binaries, but can be easily
            found at www.ghostscript.com in their CVS archives.

-dTextAlphaBits - sets text antialiasing level; 1, 2, and 4 are valid
            values, each performing a little more antialiasing

-dGraphicsAlphabits - sets graphics antialiasing level; 1, 2, and 4
            are valid values

-r       - sets resolution in dpi; it can be just a single value, or
            a pair of dimensions separated by an 'x'

Sorry for the somewhat off-topic post/reply, but after all the effort I
wasted to figure out that 'convert' was indeed the broken culprit, and
then figuring out the equivalent ghostcript command, I thought this
information might be helpful to others on this list.

-EJR
_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Dmitri A. Sergatskov
On 5/3/06, Joshua Rigler <[hidden email]> wrote:

> ...and for the archives...
>
> For those using certain versions of Fedora Linux, you may have long ago
> noticed that something was broken with Imagemagick's 'convert' routine
> whenever converting from .eps to some sort of rasterized format.  The
> resolution was bad no matter what you set '-density' equal to, black
> lines were changed into white lines, and a whole slew of other things
> that resulted in an image of very poor quality.

Though I like ghostscript myself, just for the record -- convert seems to be
working fine for me on Fedora Core 5 with recent updates.

> -EJR

Dmitri.
--

_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Josh Rigler
Dmitri A. Sergatskov wrote:

> On 5/3/06, Joshua Rigler <[hidden email]> wrote:
>
>> ...and for the archives...
>>
>> For those using certain versions of Fedora Linux, you may have long ago
>> noticed that something was broken with Imagemagick's 'convert' routine
>> whenever converting from .eps to some sort of rasterized format.  The
>> resolution was bad no matter what you set '-density' equal to, black
>> lines were changed into white lines, and a whole slew of other things
>> that resulted in an image of very poor quality.
>
>
> Though I like ghostscript myself, just for the record -- convert seems
> to be
> working fine for me on Fedora Core 5 with recent updates.

Thank you for the update.

I had noticed the problem in Core 3 and 4.  It was not an issue with
Core 2, nor with any of the Enterprise RH's I used at work, all of which
had a 5.x version of Imagemagick installed I believe.  I'm glad to hear
it is again functioning properly in Fedora Core 5, which I have not been
brave enough to test yet myself.

-EJR
_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Displaying an animation / "movie"

Jeff Miller-5
In reply to this post by Bob Weigel-3
Robert,
Thanks for the reply. I don't really need to create a separate movie
file to replay later, I just need to be able to visualize the series
of images once... Is there a way to view images sequentially in the
same window?

I suppose I could use the approach you described to automatically save
the images to files, create a movie file, replay it, and then delete
all the files. That just seems more complicated than what I'm trying
to do. But if it's the only way...

I noticed that Gnuplot 4.1 (developmental) supports images (I only
have 4.0). That might work, but it's a gamble.

Jeff

On 5/2/06, Robert S. Weigel <[hidden email]> wrote:

>
> In Matlab I was never satisfied with the movies created using imshow.  I
> prefered the finer-grained control of using epstk to create 1 eps file per
> frame and then png2swf [http://www.swftools.org/] after converting .eps
> to .png with the ImageMagick command line program "convert" .  Using this
> method I am able to create full-screen movies without muddled text and
> lines.
> (Also, if I ever want to re-create a movie when typical monitors are
> 16000x12000 pixels, I just need to run a script that operates on the
> vector .eps files and change the -density parameter.)
>
> Here is my .m and shell script I use to automate the process:
>
> for i = 1:99
> FileName=sprintf('./figures/Figure_%03d.eps');
> % postscript file creation commands
> end
>
> #!/bin/bash
>
> DEN=200
>
> cd ./figures
> for k in $(ls *.eps); do
>     echo "Converting $k";
>     convert -density $DENx$DEN $k $k.png;
> done
> png2swf -o all_X_$DEN.swf -r 12 *.png
>
>
>
> On Tuesday 02 May 2006 16:46, Jeff Miller wrote:
> > Hi,
> > I would really like to use Octave, but there is an important feature I
> > need, which so far I haven't figured out how to do:
> >
> > In Matlab I can do:
> > for i=1:100; imshow(rand(100,100)); drawnow; end;
> >
> > ...and it rapidly displays a series of matrices in the same window, like
> an
> > animated movie. In Octave, when I try this, it opens 100 ImageMagick
> > windows, with each one containing a separate image.
> >
> > Is there a way to get the desired behavior in Octave? (or any other
> > open-source numerical computation package?)
> >
> > Thanks for any help!
> > Jeff
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>

_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Jeff Miller-5
In reply to this post by Robert A. Macy
Robert,
Thanks for the function. It works great for animated line plots, but I
still can't figure out how to show a series of images.

You said in the for loop I could use:
gsplot matrix

I have to admit I'm not very familiar with gnuplot, but I couldn't
find any references to such a command that would display an image.
What would be the exact command?

I have Gnuplot 4.0 ... maybe I need 4.1 to support the functionality
you're describing?

Thanks,
Jeff

On 5/2/06, Robert A. Macy <[hidden email]> wrote:

> Jeff,
>
> I ran across just such a need and wrote this function for
> plotting...
>   plotmovie.m
>
> but you could modify it inserting
> >> gsplot matrix;
> in the for loop and get the same effect for displaying a
> matrix.
>
>             - Robert -
>
> On Tue, 2 May 2006 16:46:50 -0400
>  "Jeff Miller" <[hidden email]> wrote:
> > Hi,
> > I would really like to use Octave, but there is an
> > important feature I need,
> > which so far I haven't figured out how to do:
> >
> > In Matlab I can do:
> > for i=1:100; imshow(rand(100,100)); drawnow; end;
> >
> > ...and it rapidly displays a series of matrices in the
> > same window, like an
> > animated movie. In Octave, when I try this, it opens 100
> > ImageMagick
> > windows, with each one containing a separate image.
> >
> > Is there a way to get the desired behavior in Octave? (or
> > any other
> > open-source numerical computation package?)
> >
> > Thanks for any help!
> > Jeff
>
>
>

_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Robert A. Macy
Jeff,

I don't know what imshow does.  On both my machines it does
strange things [Win 98 and WinXP ]
>> imshow(rand(50,50));drawnow;

However try
>> gsplot rand(100,100);

That plots a matrix and you can move it around with your
mouse forbetter viewing.  

but doubt that's what you were after

             - Robert -

On Wed, 3 May 2006 21:04:50 -0400
 "Jeff Miller" <[hidden email]> wrote:

> Robert,
> Thanks for the function. It works great for animated line
> plots, but I
> still can't figure out how to show a series of images.
>
> You said in the for loop I could use:
> gsplot matrix
>
> I have to admit I'm not very familiar with gnuplot, but I
> couldn't
> find any references to such a command that would display
> an image.
> What would be the exact command?
>
> I have Gnuplot 4.0 ... maybe I need 4.1 to support the
> functionality
> you're describing?
>
> Thanks,
> Jeff
>
> On 5/2/06, Robert A. Macy <[hidden email]> wrote:
> > Jeff,
> >
> > I ran across just such a need and wrote this function
> for
> > plotting...
> >   plotmovie.m
> >
> > but you could modify it inserting
> > >> gsplot matrix;
> > in the for loop and get the same effect for displaying
> a
> > matrix.
> >
> >             - Robert -
> >
> > On Tue, 2 May 2006 16:46:50 -0400
> >  "Jeff Miller" <[hidden email]> wrote:
> > > Hi,
> > > I would really like to use Octave, but there is an
> > > important feature I need,
> > > which so far I haven't figured out how to do:
> > >
> > > In Matlab I can do:
> > > for i=1:100; imshow(rand(100,100)); drawnow; end;
> > >
> > > ...and it rapidly displays a series of matrices in
> the
> > > same window, like an
> > > animated movie. In Octave, when I try this, it opens
> 100
> > > ImageMagick
> > > windows, with each one containing a separate image.
> > >
> > > Is there a way to get the desired behavior in Octave?
> (or
> > > any other
> > > open-source numerical computation package?)
> > >
> > > Thanks for any help!
> > > Jeff
> >
> >
> >

_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

WINDOWS

Alberto Fedrigotti
In reply to this post by Jeff Miller-5

Dear Friends,
All the problems is with my operating system. The program is working correctly.
Thank you very much for your help.
Have a nice day.
 


Alberto Fedrigotti   (Alt-beirt Feidraich-goth-is)
Via Monte Hermada 46/6                    
33100 UDINE - ITALY                                    
tel.0039-0432-46355  


How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Jeff Miller-5
In reply to this post by Robert A. Macy
Robert,
When I do imshow on a matrix, it displays an image where each number in the matrix corresponds to the intensity (or color) of the pixel in the image with the corresponding indices (e.g. (0,0), (0,1), ...). So, this would display a square:

x = [0 0 0 0 0
     0 1 1 1 0
     0 1 0 1 0
     0 1 1 1 0
     0 0 0 0 0];
imshow(x);

What I'd like to do is take a series of such matrices that represent moving objects and display them sequentially like a movie. For example, this would show that square moving downward (looping around the edges):

for i=1:100
    x = shift(x, 1);
    imshow(x);
end


This works in Matlab, but I can't seem to make it work in Octave. I could probably use the approach that the other Robert mentioned (saving all images to files, making a movie from the files, then displaying the movie) but I'm hoping there's a simpler way.

(By the way, I'm using this for computer vision stuff, so I can visualize what's going on...)

Thanks for your help,
Jeff


On 5/4/06, Robert A. Macy <[hidden email]> wrote:
Jeff,

I don't know what imshow does.  On both my machines it does
strange things [Win 98 and WinXP ]
>> imshow(rand(50,50));drawnow;

However try
>> gsplot rand(100,100);

That plots a matrix and you can move it around with your
mouse forbetter viewing.

but doubt that's what you were after

             - Robert -

On Wed, 3 May 2006 21:04:50 -0400
"Jeff Miller" <[hidden email]> wrote:

> Robert,
> Thanks for the function. It works great for animated line
> plots, but I
> still can't figure out how to show a series of images.
>
> You said in the for loop I could use:
> gsplot matrix
>
> I have to admit I'm not very familiar with gnuplot, but I
> couldn't
> find any references to such a command that would display
> an image.
> What would be the exact command?
>
> I have Gnuplot 4.0 ... maybe I need 4.1 to support the
> functionality
> you're describing?
>
> Thanks,
> Jeff
>
> On 5/2/06, Robert A. Macy <[hidden email]> wrote:
> > Jeff,
> >
> > I ran across just such a need and wrote this function
> for
> > plotting...
> >   plotmovie.m
> >
> > but you could modify it inserting
> > >> gsplot matrix;
> > in the for loop and get the same effect for displaying
> a
> > matrix.
> >
> >             - Robert -
> >
> > On Tue, 2 May 2006 16:46:50 -0400
> >  "Jeff Miller" <[hidden email]> wrote:
> > > Hi,
> > > I would really like to use Octave, but there is an
> > > important feature I need,
> > > which so far I haven't figured out how to do:
> > >
> > > In Matlab I can do:
> > > for i=1:100; imshow(rand(100,100)); drawnow; end;
> > >
> > > ...and it rapidly displays a series of matrices in
> the
> > > same window, like an
> > > animated movie. In Octave, when I try this, it opens
> 100
> > > ImageMagick
> > > windows, with each one containing a separate image.
> > >
> > > Is there a way to get the desired behavior in Octave?
> (or
> > > any other
> > > open-source numerical computation package?)
> > >
> > > Thanks for any help!
> > > Jeff
> >
> >
> >



_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Stéfan van der Walt
On Thu, May 04, 2006 at 07:29:34AM -0400, Jeff Miller wrote:
> What I'd like to do is take a series of such matrices that represent moving
> objects and display them sequentially like a movie. For example, this would
> show that square moving downward (looping around the edges):
>
> for i=1:100
>     x = shift(x, 1);
>     imshow(x);
> end

I've written wrappings around ffmpeg, that allows you to create AVI
files from a sequence of images. You can find the code at
http://mentat.za.net.

Regards
Stéfan
_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Jordi Gutiérrez Hermoso
On 5/4/06, Stefan van der Walt <[hidden email]> wrote:
> I've written wrappings around ffmpeg, that allows you to create AVI
> files from a sequence of images. You can find the code at
> http://mentat.za.net.

This sounds like it could come in handy some day! Would you be able to
put version of this in octave-forge?

- Jordi

_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Stéfan van der Walt
On Thu, May 04, 2006 at 11:23:31AM -0500, Jordi Gutierrez Hermoso wrote:
> On 5/4/06, Stefan van der Walt <[hidden email]> wrote:
> > I've written wrappings around ffmpeg, that allows you to create AVI
> > files from a sequence of images. You can find the code at
> > http://mentat.za.net.
>
> This sounds like it could come in handy some day! Would you be able to
> put version of this in octave-forge?

I would be very glad to have the code in Octave Forge -- I just havn't
gotten round to moving and reconfiguring it yet (and I don't foresee
having much time in the near future, so any help would also be
appreciated).

Regards
Stéfan
_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Robert A. Macy
In reply to this post by Jeff Miller-5
If it's just for visualizing,

>> for i=1:100;x=shift(x,1);gsplot x;endfor;

see what you get.

As I said, you can rotate the matrix with your mouse and
get "best" viewing.

         - Robert -

On Thu, 4 May 2006 07:29:34 -0400
 "Jeff Miller" <[hidden email]> wrote:

> Robert,
> When I do imshow on a matrix, it displays an image where
> each number in the
> matrix corresponds to the intensity (or color) of the
> pixel in the image
> with the corresponding indices (e.g. (0,0), (0,1), ...).
> So, this would
> display a square:
>
> x = [0 0 0 0 0
>      0 1 1 1 0
>      0 1 0 1 0
>      0 1 1 1 0
>      0 0 0 0 0];
> imshow(x);
>
> What I'd like to do is take a series of such matrices
> that represent moving
> objects and display them sequentially like a movie. For
> example, this would
> show that square moving downward (looping around the
> edges):
>
> for i=1:100
>     x = shift(x, 1);
>     imshow(x);
> end
>
>
> This works in Matlab, but I can't seem to make it work in
> Octave. I could
> probably use the approach that the other Robert mentioned
> (saving all images
> to files, making a movie from the files, then displaying
> the movie) but I'm
> hoping there's a simpler way.
>
> (By the way, I'm using this for computer vision stuff, so
> I can visualize
> what's going on...)
>
> Thanks for your help,
> Jeff
>
_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Robert A. Macy
In reply to this post by Jeff Miller-5
try this:


x=zeros(50,50);

x(24,24)=1;
x(24,25)=1;
x(24,26)=1;
x(25,24)=1;
x(25,26)=1;
x(26,24)=1;
x(26,25)=1;
x(26,26)=1;

for i=1:100
    x = shift(x, 1);
    gsplot x;
endfor



On Thu, 4 May 2006 07:29:34 -0400
 "Jeff Miller" <[hidden email]> wrote:

> Robert,
> When I do imshow on a matrix, it displays an image where
> each number in the
> matrix corresponds to the intensity (or color) of the
> pixel in the image
> with the corresponding indices (e.g. (0,0), (0,1), ...).
> So, this would
> display a square:
>
> x = [0 0 0 0 0
>      0 1 1 1 0
>      0 1 0 1 0
>      0 1 1 1 0
>      0 0 0 0 0];
> imshow(x);
>
> What I'd like to do is take a series of such matrices
> that represent moving
> objects and display them sequentially like a movie. For
> example, this would
> show that square moving downward (looping around the
> edges):
>
> for i=1:100
>     x = shift(x, 1);
>     imshow(x);
> end
>
>
> This works in Matlab, but I can't seem to make it work in
> Octave. I could
> probably use the approach that the other Robert mentioned
> (saving all images
> to files, making a movie from the files, then displaying
> the movie) but I'm
> hoping there's a simpler way.
>
> (By the way, I'm using this for computer vision stuff, so
> I can visualize
> what's going on...)
>
> Thanks for your help,
> Jeff
>
>
> On 5/4/06, Robert A. Macy <[hidden email]> wrote:
> >
> > Jeff,
> >
> > I don't know what imshow does.  On both my machines it
> does
> > strange things [Win 98 and WinXP ]
> > >> imshow(rand(50,50));drawnow;
> >
> > However try
> > >> gsplot rand(100,100);
> >
> > That plots a matrix and you can move it around with
> your
> > mouse forbetter viewing.
> >
> > but doubt that's what you were after
> >
> >              - Robert -
> >
> > On Wed, 3 May 2006 21:04:50 -0400
> > "Jeff Miller" <[hidden email]> wrote:
> > > Robert,
> > > Thanks for the function. It works great for animated
> line
> > > plots, but I
> > > still can't figure out how to show a series of
> images.
> > >
> > > You said in the for loop I could use:
> > > gsplot matrix
> > >
> > > I have to admit I'm not very familiar with gnuplot,
> but I
> > > couldn't
> > > find any references to such a command that would
> display
> > > an image.
> > > What would be the exact command?
> > >
> > > I have Gnuplot 4.0 ... maybe I need 4.1 to support
> the
> > > functionality
> > > you're describing?
> > >
> > > Thanks,
> > > Jeff
> > >
> > > On 5/2/06, Robert A. Macy <[hidden email]>
> wrote:
> > > > Jeff,
> > > >
> > > > I ran across just such a need and wrote this
> function
> > > for
> > > > plotting...
> > > >   plotmovie.m
> > > >
> > > > but you could modify it inserting
> > > > >> gsplot matrix;
> > > > in the for loop and get the same effect for
> displaying
> > > a
> > > > matrix.
> > > >
> > > >             - Robert -
> > > >
> > > > On Tue, 2 May 2006 16:46:50 -0400
> > > >  "Jeff Miller" <[hidden email]> wrote:
> > > > > Hi,
> > > > > I would really like to use Octave, but there is
> an
> > > > > important feature I need,
> > > > > which so far I haven't figured out how to do:
> > > > >
> > > > > In Matlab I can do:
> > > > > for i=1:100; imshow(rand(100,100)); drawnow; end;
> > > > >
> > > > > ...and it rapidly displays a series of matrices
> in
> > > the
> > > > > same window, like an
> > > > > animated movie. In Octave, when I try this, it
> opens
> > > 100
> > > > > ImageMagick
> > > > > windows, with each one containing a separate
> image.
> > > > >
> > > > > Is there a way to get the desired behavior in
> Octave?
> > > (or
> > > > > any other
> > > > > open-source numerical computation package?)
> > > > >
> > > > > Thanks for any help!
> > > > > Jeff
> > > >
> > > >
> > > >
> >
> >

_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Jeff Miller-5
In reply to this post by Robert A. Macy
OK, I finally got this working! Woo hoo!

I'll try to cover what I did, for the record. (Note: This on Debian Linux.)

1. Install Gnuplot 4.1
This is currently developmental, but it supports images.
http://www.gnuplot.info/development/index.html
Note: The CVS server from the url above wasn't working for me, but *luckily* a smart person provided a download here:
http://article.gmane.org/gmane.comp.graphics.gnuplot.devel/4318

2. Set Octave to use Gnuplot 4.1 instead of 4.0
In your .octaverc file, add this line:
gnuplot_binary = '/usr/local/bin/gnuplot'
The default location for the 4.0 gnuplot binary is /usr/bin/gnuplot -- this sets Octave to use the default location for 4.1 instead.

3. Download the imagegp scripts from:
http://www.gnuplot.info/links.html
Follow the directions given to setup Octave to use these files instead of the normal image m-functions.
Note: For me, the imshow function given here doesn't work... it just seems to get stuck and I have to kill the process. However, imagesc seems to work fine.

Now, when I run this code in Octave:
for i=1:100; imagesc(rand(100,100)); end;

...it shows a series of images in a movie / animation. And the frame rate appears comparable to Matlab.  ;)

Thanks for everyone's help... I'm looking forward to using Octave.

Jeff


On 5/4/06, Robert A. Macy <[hidden email]> wrote:
If it's just for visualizing,

>> for i=1:100;x=shift(x,1);gsplot x;endfor;

see what you get.

As I said, you can rotate the matrix with your mouse and
get "best" viewing.

         - Robert -

On Thu, 4 May 2006 07:29:34 -0400
"Jeff Miller" <[hidden email]> wrote:

> Robert,
> When I do imshow on a matrix, it displays an image where
> each number in the
> matrix corresponds to the intensity (or color) of the
> pixel in the image
> with the corresponding indices (e.g. (0,0), (0,1), ...).
> So, this would
> display a square:
>
> x = [0 0 0 0 0
>      0 1 1 1 0
>      0 1 0 1 0
>      0 1 1 1 0
>      0 0 0 0 0];
> imshow(x);
>
> What I'd like to do is take a series of such matrices
> that represent moving
> objects and display them sequentially like a movie. For
> example, this would
> show that square moving downward (looping around the
> edges):
>
> for i=1:100
>     x = shift(x, 1);
>     imshow(x);
> end
>
>
> This works in Matlab, but I can't seem to make it work in
> Octave. I could
> probably use the approach that the other Robert mentioned
> (saving all images
> to files, making a movie from the files, then displaying
> the movie) but I'm
> hoping there's a simpler way.
>
> (By the way, I'm using this for computer vision stuff, so
> I can visualize
> what's going on...)
>
> Thanks for your help,
> Jeff
>


_______________________________________________
Help-octave mailing list
[hidden email]
https://www.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Francesco Potortì
In reply to this post by Stéfan van der Walt
More than two years ago, Stefan wrote:

>I've written wrappings around ffmpeg, that allows you to create AVI
>files from a sequence of images. You can find the code at
>http://mentat.za.net.

The code is still there, but the API of the ffmpeg libraries has
apparently changed int he meantime, so even after fixing configure's
problems, I get compilation errors.

Can anyone suggest a simple way to make animations?

My problem is that I have about 30 plots representing how a parameter
affects my results, and would like to move through them using a cursor
or something like this.  I am thinking about writing wrappers around
Octave's print function and around an external call to ffmpeg, but if
someone has better ideas or a working implementation...

--
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: [hidden email]
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/

--
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: [hidden email]
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Søren Hauberg
lør, 13 09 2008 kl. 12:23 +0200, skrev Francesco Potorti`:
> More than two years ago, Stefan wrote:
>
> >I've written wrappings around ffmpeg, that allows you to create AVI
> >files from a sequence of images. You can find the code at
> >http://mentat.za.net.
>
> The code is still there, but the API of the ffmpeg libraries has
> apparently changed int he meantime, so even after fixing configure's
> problems, I get compilation errors.

Have you tried the 'video' package from Octave-Forge? I've never used
it, but I'm under the impression that it works with fairly recent
versions of ffmpeg.

> Can anyone suggest a simple way to make animations?
>
> My problem is that I have about 30 plots representing how a parameter
> affects my results, and would like to move through them using a cursor
> or something like this.  I am thinking about writing wrappers around
> Octave's print function and around an external call to ffmpeg, but if
> someone has better ideas or a working implementation...

Whenever I need to make animations, I use 'print' to generate a file for
each frame in the animation. Then I call ffmpeg from the shell to
generate a video from these files. Not an elegant solution, but it
works...

Søren

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Displaying an animation / "movie"

Francesco Potortì
>Have you tried the 'video' package from Octave-Forge? I've never used
>it, but I'm under the impression that it works with fairly recent
>versions of ffmpeg.

I use Debian, but I see no octave-video package...

>Whenever I need to make animations, I use 'print' to generate a file for
>each frame in the animation. Then I call ffmpeg from the shell to
>generate a video from these files. Not an elegant solution, but it
>works...

Yes, I am writing a function to manage this more generally.  To speed up
my work, would you please tell me what kind of output you choose for
print() and what options you give to ffmpeg?
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
12