2015-10-21-Matlab coding

[fname,pname]=uigetfile({'*.avi';'*.mp4'},'选择视频');
str=[pname fname];
video = VideoReader(str);

nFrames = video.NumberOfFrames;
vidHeight = video.Height;
vidWidth = video.Width;
T_frames=nFrames-1;

% Preallocate movie structure.
frame = struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),'colormap', []);

%read each frame in the video;

for i=1:T_frames

   frame.cdata=read(video,i);

end

 

posted @ 2015-10-21 14:27  benbenTang  阅读(102)  评论(0)    收藏  举报