Why does "getframe" capture frames with different sizes when the Camera properties have been modified in MATLAB R2014a?
Mostrar comentarios más antiguos
I am trying to make a movie by rotating a 3D surface. I do this by using the "view" function within a "for" loop. However, when I use "getframe" to capture the frames that will be passed to the "movie2avi" function, I get an error saying that not all the frames have the same size.
My code is:
% Draw a sphere
sphere
% Make the current axis box square in size
axis('square')
% Define title and labels for reference
title('Rotation of a sphere...')
xlabel('x')
ylabel('y')
zlabel('z')
j = 1;
% Modify azimuth (horizontal rotation) and update drawing
for az = -50 : .2 : 30
view(az, 40)
F(j) = getframe;
j = j+1;
end
% Modify elevation (vertical rotation) and update drawing
for el = 40 : -.2 : -30
view(30, el)
F(j) = getframe;
j = j+1;
end
movie2avi(F,'movie.avi','compression','none')
Which leads to the following error:
Error using avifile/addframe>ValidateFrame (line 289)
Frame must be 290 by 343.
Error in avifile/addframe (line 157)
ValidateFrame(aviobj,width, height,dims);
Error in movie2avi (line 66)
avimov = addframe(avimov,mov);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Animation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!