How can I solve this error?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
while I am developing a code to read data from a video and by using the following command,
clc
clear all
mmfileinfo('MB.mov');
obj=VideoReader('MB.mov');
VidFrames = readFrame(obj);
numofframes=obj.NumberOfFrames,'NumberOfFrames';
for k=1:numofframes
mov(k).CData= VidFrames(:,:,:,k);
mov(k).colormap=[];
end
Matlab showed me the following error:
Error using VideoReader/get.NumberOfFrames (line 310)
Cannot query NUMBEROFFRAMES property after using READFRAME or
HASFRAME methods or setting the CURRENTTIME property. Recreate the
object to query the number of frames.
Error in Objecttracking (line 7)
numofframes=obj.NumberOfFrames,'NumberOfFrames';
could you please help me to solve this issue?
0 comentarios
Respuestas (1)
Walter Roberson
el 21 de Dic. de 2017
You can
obj.NumberOfFrames
before you have done the first readFrame(), but not after you have done the first readFrame()
When you
obj.NumberOfFrames
you get an estimate of the number of frames, based upon the approximate frame rate and the recorded duration of the movie. However, this can be off by about +/- 3 just due to round-off errors, and can be wrong by hundreds of frames in the case of a variable frame-rate movie.
The only reliable way to find the number of frames in a movie is to read all of the frames, counting as you go.
0 comentarios
Ver también
Categorías
Más información sobre Point Cloud Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!