Effacer les filtres
Effacer les filtres

different frames using VideoReader

2 vues (au cours des 30 derniers jours)
Ameni chetouane
Ameni chetouane le 27 Juin 2019
Commenté : Ameni chetouane le 27 Juin 2019
I have read frames with VideoReader,but i don'i get the exact number of frames that contain the video.
the number of frames of the video is 400 but readFrame return only 200 frames.
Does any one have solution to this problem?
clear
clc
% Set up video reader and player
videoFile = 'copie2.avi';
videoReader = VideoReader(videoFile);
iStop = []; % Stop the frame display if this is not empty
fps = get(videoReader, 'FrameRate');
disp(fps); % the fps is correct: it's the same declared in the video file properties
t=1;
while hasFrame(videoReader)& isempty(iStop)
%%for i=0:videoReader.Duration-1
%% videoReader.CurrentTime=i;
fr(:,:,:,t)=readFrame(videoReader);
frGray(:,:,t)=rgb2gray(readFrame(videoReader));
t=t+1;
iStop = input('0 to stop, return to continue');
end

Réponses (1)

KSSV
KSSV le 27 Juin 2019
vidObj = VideoReader(myvideo);
numFrames = 0;
iwant = cell([],1) ;
while hasFrame(vidObj)
F = readFrame(vidObj);
numFrames = numFrames + 1;
imagesc(F)
drawnow
iwant{numFrames} = F ;
end
numFrames
  1 commentaire
Ameni chetouane
Ameni chetouane le 27 Juin 2019
thank you for your reply.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by