필터 지우기
필터 지우기

Video from 3D matrix

조회 수: 3 (최근 30일)
Alexandr Lozak
Alexandr Lozak 2019년 2월 26일
댓글: Alexandr Lozak 2019년 3월 5일
Hi all, i have problem with making video from 3D matrix. I read other people examples and i tried to repeat them.
but Matlab gives me error:
v = VideoWriter('TeAc.avi');
open(v);
%% initial frame
Z = Di3(:,:,1);
Z=surf(Z);
Z.LineStyle='none';
axis tight manual
colormap jet
set(gca,'nextplot','replacechildren');
%% Loop of images
for k = 1:2550
Z=surf(Di3(:,:,k));
Z.LineStyle='none';
axis tight manual
colormap jet
set(gca,'nextplot','replacechildren');
frame = getframe;
writeVideo(v,frame);
end
close(v);
Error using VideoWriter/writeVideo (line 356)
Frame must be 435 by 343
frame.cdata is 344*435*uint8
  댓글 수: 1
Alexandr Lozak
Alexandr Lozak 2019년 2월 26일
편집: Alexandr Lozak 2019년 3월 5일
I found part of code that helped me
%% Loop of images
for k = 1:2550
Z=surf(Di3(:,:,k));
Z.LineStyle='none';
axis tight manual
colormap jet
set(gca,'nextplot','replacechildren');
set(gcf,'Renderer','zbuffer'); % addition of this line helped me
frame = getframe(gcf); % and change in getframe
writeVideo(v,frame);
end
close(v);

댓글을 달려면 로그인하십시오.

채택된 답변

Pinkesh Narsinghani
Pinkesh Narsinghani 2019년 3월 5일
From the above information , It seems like you are facing this error because frame size is changing on an iteration of your for loop .I would suggest you to refer the following MATLAB Answer and make changes in your code accordingly :
  댓글 수: 1
Alexandr Lozak
Alexandr Lozak 2019년 3월 5일
Yes.You are right.
Thank you for answer

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by