How to convert struct to a video

6 次查看(过去 30 天)
v = VideoReader(path);
vidHeight = v.Height;
vidWidth = v.Width;
mov=struct('cdata',zeros(vidHeight,vidWidth,3,'uint8'),'colormap',[]);
numFrames = get(v,'NumberOfFrames');
for k=1:numFrames
mov(k).cdata = read(v,k);
end
Then I will apply some change to the mov, but I cannot output a video using VideoWriter or VideoFileWriter, as it says something like the input does not correct
Is that mean I cant use any of them to convert a struct to a video? What else can I do? Thanks

采纳的回答

Walter Roberson
Walter Roberson 2016-11-26
Videofilewriter step method only accepts individual image arrays (or y cr cb arrays).
Videowriter writeVideo method only accepts individual image arrays or individual frames compatible with movie structure (your mov is an array of those)
You will need to loop writing the contents of your mov structure array.

更多回答(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