Read 2 frames simultaneously from same video
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lukas Wyon
am 16 Okt. 2019
Beantwortet: Walter Roberson
am 16 Okt. 2019
I want to do some video processing, and i need two frames contiously. the two frames need be right after each other, so i am able to compare them, either being subtracting or else.
clc; clear all;
Video = VideoReader('VID_1.mp4','CurrentTime',11);
opticFlow = opticalFlowLK('NoiseThreshold',0.009);
h = figure;
movegui(h);
hViewPanel = uipanel(h,'Position',[0 0 1 1],'Title','Plot of Optical Flow Vectors');
hPlot = axes(hViewPanel);
while hasFrame(Video)
frameRGB = readFrame(Video);
frameGray = rgb2gray(frameRGB);
frameRGB2 = readFrame(Video,CurrentTime+1); % I need help here...
flow = estimateFlow(opticFlow,frameGray);
imshow(frameRGB2)
hold on
plot(points.selectStrongest(50));
plot(flow,'DecimationFactor',[5 5],'ScaleFactor',100,'Parent',hPlot);
hold off
pause(10^-3)
end
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 16 Okt. 2019
frameRGB = readFrame(Video);
while hasFrame(Video)
frameRGB2 = readFrame(Video);
%now process like you did
frameRGB = frameRGB2; %make current frame the previous frame
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!