首页 文章

提取在视频中生成向量x和y的点

提问于
浏览
1

此代码是计算机视觉系统工具箱的一个示例,它生成光流的运动矢量 . 好奇的是从每个视频帧中提取数组[x,y]和制作这些矢量的坐标点 .

videoReader=vision.VideoFileReader('videoname','ImageColorSpace','Intensity',...
'VideoOutputDataType','uint8');

converter = vision.ImageDataTypeConverter;
opticalFlow = vision.OpticalFlow('ReferenceFrameDelay', 1);
opticalFlow.OutputValue = 'Horizontal and vertical components in complex form';
shapeInserter = vision.ShapeInserter('Shape', 'Lines', 'BorderColor',...
'Custom','CustomBorderColor', 255);
VideoPlayer = vision.VideoPlayer('Name','Motion Vector');

videoInfo    = info(videoReader);
videoPlayer  = vision.VideoPlayer('Position',...
[100 100 videoInfo.VideoSize(1:2)+30]);

while ~isDone(videoReader)
frame = step(videoReader);
im = step(converter, frame);
of = step(opticalFlow, im);
lines = videooptflowlines(of, 20);
if ~isempty(lines)
   out = step(shapeInserter, im, lines);
    step(videoPlayer, out);
end
end

release(videoPlayer);
release(videoReader);

用google搜索videooptflowlines = function(f,20);生成光流线的坐标点 . 我试图在命令窗口中放置'lines',等待我返回带有这些数据的数组,但显然不是预期的数组 . 与此矩阵相反?

1 回答

  • 0

    运动矢量存储在 of 中,这是一个复数的二维数组 . 实部包含x坐标,虚部包含y坐标 .

相关问题