Creating a video from a structure array field

조회 수: 12 (최근 30일)
Md. Al-Imran Abir
Md. Al-Imran Abir 2021년 10월 11일
댓글: Md. Al-Imran Abir 2021년 11월 2일
I am trying to convert a structure array field (mov.cdata) into a video.
mov is a 1×600 struct with 2 fields (cdata and colormap). All of the values of cdata field are uint8 type and has a size of . To convert it into a video, I wrote following code snippet:
wm_video = VideoWriter('Watermarked_video_1.mp4', 'MPEG-4');
open(wm_video);
for m = 1:nFrames
%img = readFrame(mov(m).cdata);
writeVideo(wm_video, mov(m).cdata);
end
close(wm_video);
But I got the following error:
Frames of type double must be in the range 0 to 1.
How can this error be solved?

채택된 답변

Kshitij Chhabra
Kshitij Chhabra 2021년 10월 14일
Hi,
From my understanding you are trying to convert a structure array field into a video using the "writeVideo" function. You need to normalise your mov(m).cdata to fit in the range of 0-1 as mentioned in the documentation.
To do the normalization, you can check a previously answered question the community here.
Hope this helps!
  댓글 수: 1
Md. Al-Imran Abir
Md. Al-Imran Abir 2021년 11월 2일
Thanks @Kshitij Chhabra. I have understood solution of such errors. And sorry for being very late to accept the answer.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by