How do i solve the error of VideoWriter/writeVideo
Hello , i wrote this code to detect a face during a video :
%Reading the video
VideoFileReader=VideoReader('vidto.avi');
myvideo = VideoWriter('myfile.avi');
depVideoPlayer=vision.DeployableVideoPlayer;
faceDetector = vision.CascadeObjectDetector ;
%Read frame by Frame
while hasFrame(VideoFileReader)
videoFrame = readFrame(VideoFileReader);
bbox = faceDetector(videoFrame);
videoFrame = insertShape(videoFrame,'rectangle',bbox);
% display video
depVideoPlayer(videoFrame);
writeVideo(myvideo, videoFrame);
pause(1/VideoFileReader.FrameRate);
end
but each time i try the same error shows : 'Error using VideoWriter/writeVideo
OBJ must be open before writing video. Call open(obj) before calling writeVideo.'
why does this keep happening ? and how can i solve this
0 commentaires
Réponses (1)
0 commentaires
Voir également
Catégories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!