也谈matlab中读取视频的一个重要函数mmreader
在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.
下面给出两个简单的应用:
- clear
- clc
- cd('C:\Documents and Settings\Administrator\桌面\matlab');
- % .avi必须是无损压缩的. matlab读取发现,视频尺寸为176*144
- fileName = '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);
- clear
- clc
- cd('C:\Documents and Settings\Administrator\桌面\matlab');
- % 有损压缩的.mpg视频. matlab读取后发现,视频大小为352*288
- fileName = '功夫熊猫_盖世五侠的秘密.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中播放视频
也谈matlab中读取视频的一个重要函数mmreader的更多相关文章
- matlab中读取txt数据文件(txt文本文档)
matlab中读取txt数据文件(txt文本文档) 根据txt文档不同种类介绍不同的读取数据方法 一.纯数据文件(没有字母和中文,纯数字) 对于这种txt文档,从matalb中读取就简单多了 例如te ...
- Matlab中如何将(自定义)函数作为参数传递给另一个函数
假如我们编写了一个积分通用程序,想使它更具有通用性,那么可以把被积函数也作为一个参数.在c/c++中,可以使用函数指针来实现上边的功能,在matlab中如何实现呢?使用函数句柄--这时类似于函数指针的 ...
- 【机器学习】Matlab中实现QQ-plot的一个好工具gqqplot
Matlab中实现QQ-plot的一个好工具gqqplot 26JUN June 26, 2013 这几天看了一下QQ-plot以及在Matlab中的实现,可是Matlab自带的qqplot函数不能满 ...
- MATLAB中白噪声的WGN和AWGN函数的使用
MATLAB中白噪声的WGN和AWGN函数的使用如下: MATLAB中产生高斯白噪声非常方便,可以直接应用两个函数,一个是WGN,另一个是AWGN.WGN用于产生高斯白噪声,AWGN则用于在某一 信号 ...
- php字符串查找函数 php查找字符串中出现的次数函数substr_count,判断字符串中是否包含另一个字符串函数strpos
php字符串查找函数 php查找字符串中出现的次数函数substr_count,判断字符串中是否包含另一个字符串函数strpossubstr_count($haystack, $needle [,$o ...
- opencv 从摄像头中读取视频并保存(c++版)
原文:http://blog.csdn.net/zhongshijunacm/article/details/68947890 OpenCV中的视频操作函数如下表所列: VideoCapture Vi ...
- matlab中读取txt数据文件(转)
根据txt文档不同种类介绍不同的读取数据方法 一.纯数据文件(没有字母和中文,纯数字) 对于这种txt文档,从matalb中读取就简单多了 例如test.txt文件,内容为“17.901 -1.111 ...
- Matlab中image、imagesc和imshow函数用法解析
来源:https://blog.csdn.net/zhuiyuanzhongjia/article/details/79621813 1.显示RGB图像 相同点:这三个函数都是把m*n*3的矩阵中的数 ...
- 把一个文件中所有文件名或者文件路径读取到一个txt文件,然后在matlab中读取
链接: http://blog.csdn.net/dreamgchuan/article/details/51113295 dir /on/b/s 这个读取的是这样的格式:
随机推荐
- c# webBrowser打开pdf问题
1.生成模式使用release加*86尝试,使用debug则webBrowser不生效
- 论文爬取 & 词频统计2.0
一.Github地址 课程项目要求 队友博客 二.具体分工 031602225 林煌伟 :负责C++部分主要功能函数的编写,算法的设计以及改进优化 031602230 卢恺翔 : 爬虫 ...
- C语言之goto浅析
1. 读代码时遇了的疑惑点: static int do_bind(const char *host, int port, int protocol, int *family) { int fd; ...
- 各种GIT代码托管工具比较
bitbucket免费支持5个开发成员的团队创建无限私有代码托管库. GOES是一个由GO语音编写的自组GIT托管服务. gitorious 是一个基于GIT版本控制系统的WEB项目托管平台,基于RU ...
- influxdb 命令
写入数据: curl -X POST -d '[{"name":"foo","columns":["val"],&quo ...
- Java中int与String间的类型转换
int -> String int i=12345;String s=""; 除了直接调用i.toString();还有以下两种方法第一种方法:s=i+"" ...
- 卸载iptables 小心了!!怎么关闭和卸载iptables
千万千万不要使用下面的命令卸载iptables yum remove iptables 这样操作会卸载掉很多系统必要的组件,那就开不了机了,链接不上了.切记切记. 如果想永远停用,使用以下命令即可: ...
- JAVA里面"=="和euqals的区别
(1)基本数据类型,用双等号“==”比较,比较的是他们的值,值类型是存储在内存中的栈中 (2)复合数据类型中, 当他们用“==”进行比较的时候,比较的是他们在内存中的存放地址,其变量在栈中仅仅是存储引 ...
- 安装redis环境
1 安装redis至 /home/www/redis目录下 [root@cuijian www]# tar zxf redis-2.8.13.tar.gz [root@cuijian www]# cd ...
- 电子商务(电销)平台中商品模块(Product)数据库设计明细
以下是自己在电子商务系统设计中的数据库设计经验总结,而今发表出来一起分享,如有不当,欢迎跟帖讨论~ 商品表 (product)|-- 自动编号 (product_id)|-- 商品名称 (produc ...