fileName = 'XXX.avi'; % .avi必須是無損壓縮的.?
obj = mmreader(fileName);
vidFrames = read(obj);% 讀取所有的幀數(shù)據(jù)
numFrames = obj.numberOfFrames;% 幀的總數(shù)
for k = 1 : numFrames% 讀取數(shù)據(jù)
mov(k).cdata = vidFrames(:,:,:,k);% mov(k)是一個結(jié)構(gòu)體,mov(k).cdata實(shí)際上就是一個有RGB的幀
mov(k).colormap = [];
end
movie(mov);% 在matlab中播放視頻