简体   繁体   English

逐帧读取视频,并使用Matlab逐帧显示图片

[英]Read video frame by frame and show picture each frame by using Matlab

I am newly working with Matlab. 我刚在Matlab工作。 Now, I'm doing a small project about image processing. 现在,我正在做一个有关图像处理的小项目。 I want to read a video frame by frame and find intensity of each frame. 我想逐帧读取视频并查找每帧的强度。 Help me,please 请帮帮我

Read video code : 

** It can't use hasFrames ** error : Undefined function 'hasFrame' for input arguments of type 'VideoReader'. **无法使用hasFrames **错误:类型为'VideoReader'的输入参数未定义函数'hasFrame'。

Thank you very much. 非常感谢你。

There is no such thing as hasFrames in MATLAB for the VideoReader class. 目前是没有这样的事情hasFrames在MATLAB的VideoReader类。

There is a function called hasFrame in MATLAB: http://www.mathworks.com/help/matlab/ref/videoreader.hasframe.html , but it only exists as of R2014b . MATLAB中有一个称为hasFrame的函数: http : //www.mathworks.com/help/matlab/ref/videoreader.hasframe.html ,但仅从R2014b存在。 The documentation for R2014b was just released last week, and I prematurely said that there wasn't a function called hasFrame because I have never seen it with the VideoReader class that I am used to. R2014b的文档上周刚刚发布,我过早地说没有一个叫做hasFrame的函数,因为我以前从未在VideoReader类中看到过它。 I currently use R2013a . 我目前使用R2013a Check out this thread from MathWorks for more details: http://www.mathworks.com/matlabcentral/answers/157477-unable-to-read-and-playback-movie-file 从MathWorks中查看该线程以了解更多详细信息: http : //www.mathworks.com/matlabcentral/answers/157477-unable-to-read-and-playback-movie-file

This error is probably happening because you don't have the latest version of MATLAB. 由于您没有最新版本的MATLAB,因此可能会发生此错误。 If you want to read a frame from the video file using the VideoReader class, use the readFrame function after you read in the video from file: http://www.mathworks.com/help/matlab/ref/videoreader.readframe.html . 如果要使用VideoReader类从视频文件中读取帧,请在从文件中读取视频后使用readFrame函数: http : //www.mathworks.com/help/matlab/ref/videoreader.readframe.html Don't use hasFrame . 不要使用hasFrame You can always check to see if the matrix that is returned from readFrame is empty which could symbolize whether your video has a frame available or not. 您始终可以检查从readFrame返回的矩阵是否为空,这可以表示您的视频是否有可用的帧。

Calling readFrame will provide you a video frame where you can do your analysis. 调用readFrame将为您提供一个视频帧,您可以在其中进行分析。 You call it each time to grab the next frame in the video. 您每次都调用它以获取视频中的下一帧。

Good luck! 祝好运!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM