Matlab 2012a 获取Numbe…

Matlab2012a 获取视频文件的总帧数

帮助文档中的例子:
xyloObj = VideoReader('Building.avi');
nFrames = xyloObj.NumberOfFrames;
vidHeight = xyloObj.Height;
vidWidth = xyloObj.Width;

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

% Read one frame at a time.
for k = 1 : nFrames
    mov(k).cdata = read(xyloObj, k);
end

% Size a figure based on the video's width and height.
hf = figure;
set(hf, 'position', [150 150 vidWidth vidHeight])

% Play back the movie once at the video's frame rate.
movie(hf, mov, 1, xyloObj.FrameRate);

运行结果:
无法确定该文件的帧的数目。
Matlab <wbr>2012a <wbr>获取NumberOfFrames属性
解决方案:
Help:
MATLAB -> User's Guide -> Data Import and Export -> Importing Data ->
Importing Audio and Video ->  Read Video Files ->  Reading Variable Frame Rate Video -> Counting Frames

Matlab <wbr>2012a <wbr>获取NumberOfFrames属性

  1. avi=VideoReader('Building.avi');
  2. lastframe=read(avi,inf);
  3. info=get(avi);
此段代码运行结果:
Matlab <wbr>2012a <wbr>获取NumberOfFrames属性

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值