Create a video from a 4D array
Mostra commenti meno recenti
Hello, I have a problem in this code.
function [] = writeBufferToFinalVideo(buffer)
video = VideoWriter('example','MPEG-4');
video.FrameRate = 25;
open(video)
for i = 1:size(buffer,4)
img = buffer(i);
img(img>1) = 1;
img(img<0) = 0;
writeVideo(video,img);
end
close(video);
end
My buffer is a 4-dimensional array that has frames inside. It is composed of: (height, width, numChannels, framesPerSymbol). The latter is the number of frames that are in a symbol, that is, the size of my buffer.
In my opinion, I think the code is correct, but I always get an empty video without the frames in my buffer.
2 Commenti
Ameer Hamza
il 17 Apr 2020
What is the class if buffer?
class(buffer)
Risposta accettata
Più risposte (1)
Image Analyst
il 18 Apr 2020
Make sure buffer is uint8.
buffer = zeros(height, width, numChannels, framesPerSymbol, 'uint8')
Categorie
Scopri di più su Computer Vision with Simulink in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
