也谈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 这个读取的是这样的格式:
随机推荐
- ACM ICPC 2016–2017, NEERC, Northern Subregional Contest Problem J. Java2016
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:2s 空间限制:256MB 题目大意: 给定一个数字c 用 " ...
- [pascal入门]数组
一.本节目标 本节我们将要讲述数组.本节目标: 一维数组 二维数组 字符数组 二.一维数组 我们通过一个案例来简单的理解数组.班主任要计算班级里面50个同学数学成绩的平均成绩,道理上讲这是一个比较简单 ...
- 将 Spring 和 Hibernate 与 WebSphere Application Server 一起使用
本文摘要 如果您考虑将 Spring 或 Hibernate 与 IBM® WebSphere® Application Server 一起使用,则本文向您阐述了如何配置这些框架,以适用于 WebSp ...
- vim 简单用法
vim 是一个纯文本编辑器 模式化的编辑器 1:编辑模式2:输入模式3:末行模式 : 具有命令的接口,在末行模式中可以直接的通过命令修改vim编辑器打开的文本文件 模式转换 1:编辑模式—>输入 ...
- 关于初装kali linux 2.0时DEB文件安装失败的问题
kali linux 是一个基于debian 的linux发行版本,支持deb文件格式的图形化安装. 刚装上kali linux时安装程序总是失败,提示处理时错误. 经过一番爬贴,是软件源的原因,解决 ...
- 常用的一些sql
--根据某一列中包括的逗号将一行数据变多行 select a,c from (with test as (select 'abc' a,'1,2,3' c from dual e) select a, ...
- c语言基础笔记
一 :数据类型 1.float类型,在输出的时候可以使用 .数字 来把浮点数精确到小数点后几位,比如 printf("%.3f",float)精确到小数点后三位,不足补0 2.字 ...
- ADO.NET DBHelper 类库
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...
- Java中int与String间的类型转换
int -> String int i=12345;String s=""; 除了直接调用i.toString();还有以下两种方法第一种方法:s=i+"" ...
- 【uoj#139】[UER #4]被删除的黑白树 贪心
题目描述 给出一个 $n$ 个节点的树,$1$ 号点为根.现要将其中一些点染成黑色,使得每个叶子节点(不包括根节点)到根节点路径上的黑点数相同.求最多能够染多少个黑点. 题解 贪心 显然有结论:选择的 ...