フィルターのクリア

different frames using VideoReader

2 ビュー (過去 30 日間)
Ameni chetouane
Ameni chetouane 2019 年 6 月 27 日
コメント済み: Ameni chetouane 2019 年 6 月 27 日
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

回答 (1 件)

KSSV
KSSV 2019 年 6 月 27 日
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 件のコメント
Ameni chetouane
Ameni chetouane 2019 年 6 月 27 日
thank you for your reply.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by