【发布时间】:2016-05-05 14:15:36
【问题描述】:
我无法理解 Matlab 如何使用 仅 当前帧通过光流计算视频帧的速度矩阵。速度不会是不同的像素位置随时间而变化什么会包括每次分析两帧或更多帧?
http://www.mathworks.com/help/vision/ref/vision.opticalflow-class.html
% Set up for stream
nFrames = 0;
while (nFrames<100) % Process for the first 100 frames.
% Acquire single frame from imaging device.
rgbData = step(vidDevice);
% Compute the optical flow for that particular frame.
optFlow = step(optical,rgb2gray(rgbData)); %***HERE IS THE DOUBT! iT JUST USES ONE FRAME!!!***
% Downsample optical flow field.
optFlow_DS = optFlow(r, c);
H = imag(optFlow_DS)*50;
V = real(optFlow_DS)*50;
% Draw lines on top of image
lines = [Y(:)'; X(:)'; Y(:)'+V(:)'; X(:)'+H(:)'];
rgb_Out = step(shapes, rgbData, lines');
% Send image data to video player
% Display original video.
step(hVideoIn, rgbData);
% Display video along with motion vectors.
step(hVideoOut, rgb_Out);
% Increment frame count
nFrames = nFrames + 1;
end
【问题讨论】:
-
我想这取决于
step函数的作用。但只是看看代码,它看起来像是得到了下一帧?因为要获得rgbdata,代码使用step,而在下一行它再次使用step,所以我的猜测是该行捕获下一帧并一起计算光流
标签: matlab computer-vision matlab-cvst opticalflow