如何从calcOpticalFlowFarneback中提取像素的速度向量 [英] How to extract velocity vectors of a pixels from calcOpticalFlowFarneback

查看:106
本文介绍了如何从calcOpticalFlowFarneback中提取像素的速度向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找提取每个帧b/n两个帧的速度矢量.我将opencv函数用作流程:

I have been looking to extract velocity vectors of every pixels b/n two frames. I used the opencv function as flows:

calcOpticalFlowFarneback(Previous_Gray, Current_Gray, Optical_Flow, 0.5, 3, 15, 3, 5, 1.2, 0);

Previous_Gray = previous frame 
Current_Gray = current frame 

它为我提供了第三个参数Optical_Flow中的数组,但我真的不能说出如何使用该数组提取速度矢量.

And it gives me the array in the 3rd argument Optical_Flow but I can't really tell how to extract the velocity vectors using this array.

预先感谢.

Dawit

推荐答案

垫子流动: 计算的流图;将具有与prevImg相同的大小 然后输入CV_32FC2

Mat& flow: The computed flow image; will have the same size as prevImg and type CV_32FC2

此类型表示每个像素的运动都有2个float变量(假定为x和y). 试试这个:

This type means that you have 2 float variables (presumed x and y) for each pixel's motion. Try this:

Optical_Flow.at<cv::Point2f>(1023,767).x
Optical_Flow.at<cv::Point2f>(1023,767).y

这篇关于如何从calcOpticalFlowFarneback中提取像素的速度向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆