Thread Subject: question on creating movie

Subject: question on creating movie

From: CFY30 CFY30

Date: 23 May, 2008 06:42:06

Message: 1 of 4

I have 2 problems on the code as attached.
1. Size of the figure changes when it rotates. How to force
it to a fixed size?
2. mpgwrite complains the following error. Anyone has any
clue?
"??? Error using ==> mpgwrite
All movie frames must have the same size"

CFY30+


Z = peaks;
surf(Z);

axis tight
set(gca,'nextplot','replacechildren');
count = 1;
for x=1:2:180
    view(x, 20)
    M(:, count) = getframe;
    count = count + 1;
end;

mpgwrite(M, colormap, 't');




Subject: question on creating movie

From: Scott

Date: 23 May, 2008 22:20:04

Message: 2 of 4

"CFY30 CFY30" <cfy30@yahoo.com> wrote in message
<g15ovu$7ro$1@fred.mathworks.com>...
> I have 2 problems on the code as attached.
> 1. Size of the figure changes when it rotates. How to
force
> it to a fixed size?
> 2. mpgwrite complains the following error. Anyone has any
> clue?
> "??? Error using ==> mpgwrite
> All movie frames must have the same size"
>
> CFY30+
>
>
> Z = peaks;
> surf(Z);
>
> axis tight
> set(gca,'nextplot','replacechildren');
> count = 1;
> for x=1:2:180
> view(x, 20)
> M(:, count) = getframe;
> count = count + 1;
> end;
>
> mpgwrite(M, colormap, 't');
>



[X Y Z] = sphere(25);
sz = size(Z);
C = rand(sz(1),sz(2),3);
C(:,end,:) = C(:,1,:);

figure('color',[0 0 0]);
sp = surf(X,Y,Z,C,'FaceColor','interp',...
    'FaceLighting','phong');
material shiny
axis off vis3d
cl = camlight('right');
camzoom(1.5)
set(sp,'EdgeColor','none');
set(sp,'EdgeAlpha',1);
drawnow

view_vect_yaw = [-180:3:180];
sz_vect = size(view_vect_yaw);
for f = 1:sz_vect(2)
    view([view_vect_yaw(f) 15]);
    camlight(cl,'right')
    drawnow
    m(f) = capturescreen(gcf);
end
mpgwrite(m,C,'my_truecolor_movie.mpg',...
    [1, 0, 1, 0, 10, 1, 1, 1]);

Scott

Subject: question on creating movie

From: CFY30 CFY30

Date: 24 May, 2008 07:19:02

Message: 3 of 4

Hi Scott,

   Your code is terrific and thanks for helping out. It
really open my eyes on how powerful Matlab is. "axis vis3d"
is what I wanted. I still encounter the problem on
converting the movie to mpeg format. "Error using ==>
mpgwrite. All movie frames must have the same size". I
checked the frames, they are not in the same size. Any idea?


Thanks,
CFY30

"Scott " <no@spam.com> wrote in message
<g17fuk$bqg$1@fred.mathworks.com>...
> "CFY30 CFY30" <cfy30@yahoo.com> wrote in message
> <g15ovu$7ro$1@fred.mathworks.com>...
> > I have 2 problems on the code as attached.
> > 1. Size of the figure changes when it rotates. How to
> force
> > it to a fixed size?
> > 2. mpgwrite complains the following error. Anyone has
any
> > clue?
> > "??? Error using ==> mpgwrite
> > All movie frames must have the same size"
> >
> > CFY30+
> >
> >
> > Z = peaks;
> > surf(Z);
> >
> > axis tight
> > set(gca,'nextplot','replacechildren');
> > count = 1;
> > for x=1:2:180
> > view(x, 20)
> > M(:, count) = getframe;
> > count = count + 1;
> > end;
> >
> > mpgwrite(M, colormap, 't');
> >
>
>
>
> [X Y Z] = sphere(25);
> sz = size(Z);
> C = rand(sz(1),sz(2),3);
> C(:,end,:) = C(:,1,:);
>
> figure('color',[0 0 0]);
> sp = surf(X,Y,Z,C,'FaceColor','interp',...
> 'FaceLighting','phong');
> material shiny
> axis off vis3d
> cl = camlight('right');
> camzoom(1.5)
> set(sp,'EdgeColor','none');
> set(sp,'EdgeAlpha',1);
> drawnow
>
> view_vect_yaw = [-180:3:180];
> sz_vect = size(view_vect_yaw);
> for f = 1:sz_vect(2)
> view([view_vect_yaw(f) 15]);
> camlight(cl,'right')
> drawnow
> m(f) = capturescreen(gcf);
> end
> mpgwrite(m,C,'my_truecolor_movie.mpg',...
> [1, 0, 1, 0, 10, 1, 1, 1]);
>
> Scott
>

Subject: question on creating movie

From: Bob

Date: 27 May, 2008 20:01:51

Message: 4 of 4

Scott, try passing GETFRAME the handle to your figure.

Cheers
Bob

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

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com