Reputation: 3
I am newly working with 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'.
Thank you very much.
Upvotes: 0
Views: 3363
Reputation: 104464
There is no such thing as hasFrames
in MATLAB for the VideoReader
class.
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
. 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. I currently use R2013a
. Check out this thread from MathWorks for more details: 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. 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. Don't use 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.
Calling readFrame
will provide you a video frame where you can do your analysis. You call it each time to grab the next frame in the video.
Good luck!
Upvotes: 3