|
Raj <rajanikanth@gmail.com> wrote in message <c9e5a834-8d3c-
4b14-8df2-9fb2be9927bc@v4g2000hsf.googlegroups.com>...
> Hi!
>
> Could somebody tell me what is the efficient way to make
a movie from
> a set of images in Matlab?
>
> Thanks,
>
> Raj
Raj,
Here is a short movie creation demo. It requires
mpgwrite.dll which is available in the file exchange. Just
drop mgpwrite.dll into the directory where you are creating
movies:
% create some image data
[X Y Z] = sphere(25);
sz = size(Z);
C = rand(sz(1),sz(2),3);
% stitch data to wrap color around sphere
C(:,end,:) = C(:,1,:);
% render an image
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');
drawnow
% setup the rotation vector for the movie
view_vect_yaw = [-180:3:180];
sz_vect = size(view_vect_yaw);
% "lights, camera, action!"
for f = 1:sz_vect(2)
% set the view, reset light position and render
view([view_vect_yaw(f) 15]);
camlight(cl,'right')
drawnow
% grab a frame
m(f) = getframe(gcf);
end
% format frames as mpeg and write to file
mpgwrite(m,C,'my_movie.mpg',...
[1, 0, 1, 0, 10, 1, 1, 1]);
% end of code
hth,
Scott
|