Creating a video from a structure array field
9 ビュー (過去 30 日間)
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');
for m = 1:nFrames
%img = readFrame(mov(m).cdata);
But I got the following error:
Error using VideoWriter/writeVideo (line 414)
Frames of type double must be in the range 0 to 1.
How can this error be solved?
Kshitij Chhabra 2021 年 10 月 14 日
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!
その他の回答 (0 件)
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!