分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
在matlab中输入help mmreader来查阅一下该函数,有如下信息:
MMREADER Create a multimedia reader object.
OBJ = MMREADER(FILENAME) constructs a multimedia reader object, OBJ, that
can read in video data from a multimedia file. FILENAME is a string
specifying the name of a multimedia file. There are no restrictions
on file extensions. By default, MATLAB looks for the file FILENAME on
the MATLAB path.
If the object cannot be constructed for any reason (for example, if the
file cannot be opened or does not exist, or if the file format is not
recognized or supported), then MATLAB throws an error.
OBJ = MMREADER(FILENAME, 'P1', V1, 'P2', V2, ...)
constructs a multimedia reader object, assigning values V1, V2, etc. to the
specified properties P1, P2, etc.
If an invalid property name or property value is specified, MATLAB throws
an error and the object is not created. Note that the property value pairs
can be in any format supported by the SET function, e.g. parameter-value
string pairs, structures, or parameter-value cell array pairs.
下面给出两个简单的应用:
clearclccd('C:\Documents and Settings\Administrator\桌面\matlab');% .avi必须是无损压缩的. matlab读取发现,视频尺寸为176*144fileName = 'ntia_wfall-qcif_original.avi'; % mm不表示美眉,而表示multimedia. obj是一个对象obj = mmreader(fileName); % 读取所有的帧数据vidFrames = read(obj); % 帧的总数numFrames = obj.numberOfFrames;% 读取数据% mov(k)是一个结构体,mov(k).cdata实际上就是一个有RGB的帧 for k = 1 : numFrames mov(k).cdata = vidFrames(:,:,:,k); mov(k).colormap = [];end % 在matlab中播放视频movie(mov);
clearclccd('C:\Documents and Settings\Administrator\桌面\matlab');% 有损压缩的.mpg视频. matlab读取后发现,视频大小为352*288fileName = '功夫熊猫_盖世五侠的秘密.mpg'; % mm不表示美眉,而表示multimedia. obj是一个对象obj = mmreader(fileName); begin = 1001;% 读取[begin begin + 99]中的100帧数据vidFrames = read(obj, [begin begin + 99]);% 读取数据% mov(k)是一个结构体,mov(k).cdata实际上就是一个有RGB的帧 for k = 1 : 100 mov(k).cdata = vidFrames(:,:,:,k); mov(k).colormap = [];end % 在matlab中播放视频movie(mov);