Error using VideoReader/hasFrame Method 'hasFrame' is not defined for class 'VideoReader' or is removed from MATLAB's search path.

1 次查看(过去 30 天)
Hello I can't get the frames from an avi file, I don't know what's happen. the code is
%%crea directorio donde guardar
workingDir = tempname;
mkdir(workingDir)
mkdir(workingDir,'images')
VideoName = VideoReader('vid1.avi');%%%Acá reemplazar por el nombre real del video con extensión .avi
ii = 1; %%%contador
while hasFrame(VideoName)
img = readFrame(VideoName); %%%lee el cuadro
filename = [sprintf('%03d',ii) '.png']; %%%crea nombre y fija el formato Puede ser .jpg,.bmp, etc
fullname = fullfile(workingDir,'images',filename); %%%crea directorio
imwrite(img,fullname) %%%Graba la imagen a el formato elegido(img1.jpg, img2.jpg, etc.)
imwrite(img, sprintf('captured%.3d.png', ii));
ii = ii+1;
end
  3 个评论

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by