%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%=====ABSTRACT=====
% translate MP4 file to images. cause the appearance of block artifact, the
% frames of mp4 file will undergo down-sampling and gaussian filter before
% saved as images
%
%=====AUTHOR:dp=====
%
%=====DATE:151117=====
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear
close all
xyloObj = VideoReader('su35.mp4');
nFrames = xyloObj.NumberOfFrames;
vidHeight = xyloObj.Height;
vidWidth = xyloObj.Width;
for k = 1 : nFrames
im = read(xyloObj, k);%读取第k帧,存入im中
imwrite(im, ['original_frame',num2str(k),'.bmp'], 'bmp');%把im存储成图片,并且存储的文件名根据序号改变
end
代码如上咯
本文介绍了一种将MP4视频文件转换为图像序列的方法。通过使用MATLAB的VideoReader功能,逐帧读取视频并应用下采样及高斯滤波处理以减少块效应伪影,最终将每帧保存为单独的图像文件。
2742

被折叠的 条评论
为什么被折叠?



