Problem with a conversion into avi file

조회 수: 20 (최근 30일)
Ren
Ren 2014년 8월 20일
댓글: Ben11 2014년 8월 20일
Hi,I want to convert a stored images to avi file but when i run my code i get this error: Frames of type double must be in the range 0 to 1. Can anyone help me to solve the problem? Thanks in advance.
writerObj = VideoWriter('Uncompressed AVI.avi'); writerObj.FrameRate = 10;
open(writerObj);
[m n number]=size(sub_movie); %the images are stored in sub_movie for k = 1:number frame = sub_movie(:,:,k); writeVideo(writerObj,frame); end close(writerObj);

채택된 답변

Ben11
Ben11 2014년 8월 20일
You just need to convert sub_movie(:,:,k) to a double before exporting. For example:
for k = 1:number
writeVideo(writerObj,double(sub_movie(:,:,k))/65536); % store as 16-bit data (2^16 = 65536).
end
close(writerObj);
  댓글 수: 2
Ren
Ren 2014년 8월 20일
Thanks for the clarification.
Ben11
Ben11 2014년 8월 20일
You're welcome! Please mark the answer as accepted if it solved the problem. Note that you can also export the data in 8-bit, dividing by 255 instead of 65 536.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by