简体   繁体   English

在MATLAB中获取视频帧计数的最快方法是什么?

[英]What's the fastest way to get a video frame count in MATLAB?

Paging through a video with 1423 frames (192X1080 resolution) consumed 63 seconds using this code: 使用以下代码在具有1423帧(192X1080分辨率)的视频中分页花费了63秒:

vidObj = VideoReader(videoname);
nFrames = 0;
while hasFrame(vidObj)
    readFrame(vidObj);
    nFrames = nFrames + 1;
end

Loading the same video returned a frame count in a mere 4 seconds. 加载相同的视频仅需4秒钟即可返回帧计数。

How can the video frame counting be sped-up? 如何加快视频帧计数?

All you have to do is fetch the NumberOfFrames property from the VideoReader object: 您所要做的就是从VideoReader对象获取NumberOfFrames属性

vidObj = VideoReader(videoname);
nFrames = vidObj.NumberOfFrames;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在MATLAB中展开矩阵的最快方法是什么? - What's the fastest way to unroll a matrix in MATLAB? 在MATLAB中减去两个单元格数组的最快方法是什么 - what's the fastest way to subtract two cell arrays in matlab 将 double[][] 转换为 Java 中的 MATLAB 矩阵的最快方法是什么? - What is the fastest way to get double[][] to a MATLAB matrix in Java? 什么是在Matlab中加载数据的最快方法 - What is the fastest way to load data in Matlab 在MATLAB中进行此计算的最快方法是什么? - What is the fastest way of doing this computation in MATLAB? 在MATLAB上处理视频的最节省内存的方法是什么? - What's the most memory-efficient way of processing a video on MATLAB? 在Matlab中,绘图时分配不同标签值的最快方法是什么 - In Matlab, what's the fastest way to assign different label values when plotting 计算数组中元素的最快方法是什么? - What is the fastest way to count elements in an array? 在MATLAB中删除或更改数组中大量条目的最快方法是什么? - What's the fastest way to remove or change large number of entries in arrays in MATLAB? MATLAB:计算整数向量中2个数字组合的唯一#的最快方法 - MATLAB: Fastest Way to Count Unique # of 2 Number Combinations in a Vector of Integers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM