help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying an animation / "movie"


From: Robert A. Macy
Subject: Re: Displaying an animation / "movie"
Date: Thu, 04 May 2006 09:44:14 -0700

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" <address@hidden> 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 <address@hidden> 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" <address@hidden> 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 <address@hidden>
> 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" <address@hidden> 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
> > > >
> > > >
> > > >
> >
> >



reply via email to

[Prev in Thread] Current Thread [Next in Thread]