简体   繁体   English

光流和手指跟踪

[英]Optical flow and finger tracking

I am using opencv to implement finger tracking system And also use calcOpticalFlowPyrLK(pGmask,nGmask,fingers,track,status,err); 我正在使用opencv实现手指跟踪系统,还使用了calcOpticalFlowPyrLK(pGmask,nGmask,fingers,track,status,err); to perform a LK tracker. 执行LK跟踪器。

The concept I am not clear, after I implement the LK tracker, how should I detect the movement of fingers? 我不清楚这个概念,在实施LK跟踪器之后,应该如何检测手指的运动? Also, the tracker get the last frame and current frame, how to detect a series of action or continuous gesture like within 5 frames? 另外,跟踪器会获取最后一帧和当前帧,如何检测一系列动作或连续手势(例如5帧内)?

The 4th parameter of calcOpticalFlowPyrLK (here track ) will contain the calculated new positions of input features in the second image (here nGmask ). calcOpticalFlowPyrLK的第4个参数(此处为track )将包含第二个图像(此处为nGmask )中输入calcOpticalFlowPyrLK的计算出的新位置。

In the simple case, you can estimate the centroid separately of fingers and track where you can infer to the movement. 在简单的情况下,您可以分别估计fingers的质心并track可以推断出运动的位置。 Making decision can be done from the direction and magnitude of the vector pointing from fingers ' centroid to track 's centroid. 可以从从fingers的质心指向track的质心的向量的方向和大小来做出决策。

Furthermore, complex movements can be considered as time series, because movements are consisting of some successive measurements made over a time interval. 此外,复杂的运动可以被视为时间序列,因为运动是由在一个时间间隔内进行的一些连续测量组成的。 These measurements could be the direction and magnitude of the vector mentioned above. 这些测量可以是上述矢量的方向和大小。 So any movement can be represented as below: 因此,任何运动都可以表示如下:

("label of movement", time_series), where
time_series = {(d1, m1), (d2, m2), ..., (dn, mn)}, where
di is direction and mi is magnitude of the ith vector (i=1..n)

So the time-series consists of n * 2 measurements (sampling n times), that's the only question how to recognize movements? 因此,时间序列由n * 2测量(采样n次)组成,这是唯一的问题,如何识别运动?

If you have prior information about the movement, ie you know how to perform a circular movement, write an a letter etc. then the question can be reduced to: how to align time series to themselves? 如果您有关于运动之前的信息,即你知道如何进行圆运动,写了a字母等等,那么这个问题可以简化为:如何使时间序列自己?

Here comes the well known Dynamic Time Warping (DTW). 这是众所周知的动态时间规整 (DTW)。 It can be also considered as a generative model, but it is used between pairs of sequences. 也可以将其视为生成模型,但可在成对的序列之间使用。 DTW is an algorithm for measuring similarity between two temporal sequences which may vary in time or speed (such in our case). DTW是一种算法,用于测量两个时间序列之间的相似度,这些时间或速度可能会发生变化(在我们的情况下)。

In general, DTW calculates an optimal match between two given time series with certain restrictions. 通常,DTW计算具有特定限制的两个给定时间序列之间的最佳匹配。 The sequences are warped non-linearly in the time dimension to determine a measure of their similarity independent of certain non-linear variations in the time dimension. 在时间维度上对序列进行非线性扭曲以确定其相似性的度量,而与时间维度上的某些非线性变化无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM