Thread Subject: getframe , addframe

Subject: getframe , addframe

From: gianni schena

Date: 9 Jun, 2011 12:06:04

Message: 1 of 3


this is an old question on newsgroup

getframe + addframe used to save an avi file in a long loop slow down the code ...

after adding say 300 frame the code is almost immobilized ... it is very busy with addframe

any workaround ? (OS win64 windows 7 )

actually on my windows 7 getframe does not work properly and hardcopy is used instead (as suggested in the support notes ).

thank you for any tip, gianni



any

Subject: getframe , addframe

From: Steven_Lord

Date: 9 Jun, 2011 13:18:07

Message: 2 of 3



"Gianni Schena" <schena@univ.trieste.it> wrote in message
news:isqcvc$bok$1@newscl01ah.mathworks.com...
>
> this is an old question on newsgroup
> getframe + addframe used to save an avi file in a long loop slow down the
> code ...
> after adding say 300 frame the code is almost immobilized ... it is very
> busy with addframe

Are you certain that the problem is with ADDFRAME? Are you doing something
along the lines of:

hold on
for k = 1:1000
    plot(x, y);
    myavifile(k) = getframe;
end

If so, each iteration through the loop adds an additional graphics object to
the axes due to the HOLD ON; it is the number of graphics objects that
MATLAB needs to display that's likely slowing your code down. Delete the
lines you don't need or reuse them by using SET to change their XData and
YData properties.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: getframe , addframe

From: gianni schena

Date: 10 Jun, 2011 06:31:05

Message: 3 of 3

"Steven_Lord" <slord@mathworks.com> wrote in message <isqh6f$nrk$1@newscl01ah.mathworks.com>...
>
>
> "Gianni Schena" <schena@univ.trieste.it> wrote in message
> news:isqcvc$bok$1@newscl01ah.mathworks.com...
> >
> > this is an old question on newsgroup
> > getframe + addframe used to save an avi file in a long loop slow down the
> > code ...
> > after adding say 300 frame the code is almost immobilized ... it is very
> > busy with addframe
>
> Are you certain that the problem is with ADDFRAME? Are you doing something
> along the lines of:
>
> hold on
> for k = 1:1000
> plot(x, y);
> myavifile(k) = getframe;
> end
>
> If so, each iteration through the loop adds an additional graphics object to
> the axes due to the HOLD ON; it is the number of graphics objects that
> MATLAB needs to display that's likely slowing your code down. Delete the
> lines you don't need or reuse them by using SET to change their XData and
> YData properties.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

I do something like


for k = 1:1000
    imshow(...)
     Fr = getframe();
   my_avi=addframe(my_avi,fr)

 %how TO FREE any POSSIBLE graphic obj. residual related to the use of HOLD ON ?

 end
my_avi=close(...)

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