Effacer les filtres
Effacer les filtres

videoreader reads frames very slowly. how can I improve it?

7 vues (au cours des 30 derniers jours)
nirit
nirit le 28 Nov 2018
I have a movie, and selected list of frames (called frameNums) I want to read.
I tried reading them like this :
VR=VideoReader(aviFilename)
for t = 1:numel(frameNums)
currFrameNum = frameNums(t)
VR.read(currFrameNum)
%do something%
end
but this does not read the exact current frame at some of my movies (a probelm which sevral of others already noticed). so I switched to this:
VR=VideoReader(aviFilename)
videoFrameCount=0
for t = 1:numel(frameNums)
currFrameNum = frameNums(t)
while (hasFrame(VR) && (currFrameNum~=videoFrameCount))
CurrFrame = readFrame(VR);
videoFrameCount=videoFrameCount+1;
end
%do something%
end
which works out great, but if my first frame number is really big (like 22533) it takes forever to read the frame, and I cant work like that.
any tips of how to improve this?

Réponses (0)

Produits


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by