加快光流(createOptFlow_DualTVL1) [英] Speeding up optical flow (createOptFlow_DualTVL1)

查看:364
本文介绍了加快光流(createOptFlow_DualTVL1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用createOptFlow_DualTVL1()来计算光流,这正好满足了我的需求,但是速度非常慢.有什么办法可以加快速度,还是有其他光流函数可以在更少的处理时间下获得相同的结果? 我用过calcOpticalFlowFarneback()cvGoodFeaturesToTrack(),但是质量不好.请帮忙.

I am using createOptFlow_DualTVL1() to calculate optical flow which is giving me exactly what I want but it is very slow. Is there any way I can speed it up a little bit or is there any other optical flow function which will give me the same result with less processing time? I have used calcOpticalFlowFarneback(), cvGoodFeaturesToTrack() but the quality is not good. please help.

预先感谢您以下是我申请createOptFlow_DualTVL1()

Thank you in advance Below is how I apply createOptFlow_DualTVL1()

Ptr<DenseOpticalFlow> tvl1 = createOptFlow_DualTVL1();
tvl1->calc(Previous_Gray_Frame, Current_Gray_Frame, Optical_Flow);

推荐答案

为了加快计算速度,您需要减少每次执行的计算总数.这似乎很明显,但是实现该目标的大量策略可能会令人困惑.因此,这里有一些建议:

In order to speed up the computation, you need to reduce the total count of computations performed each time. This seems obvious, but the huge number of strategies to achieve that goal can be confusing. So, here are some proposals:

  1. 缩小图片的尺寸(输入数据).特别是,您应尝试将其尺寸沿每个尺寸除以2,计算流量,然后使用线性插值计算全尺寸流量.除非您的应用程序要求非常高的精度,否则该解决方案应该是可以接受的,并且可以大大提高您的速度.

  1. Reduce the size of your images (input data). In particular, you should try to divide their size by 2 along each dimension, compute the flow, then compute a full size flow with linear interpolation. Unless your application requires a very high accuracy, this solution should be acceptable and will give you a huge speedup.

减少每标度的经纱数量(参数:warps).这将损害准确性,但是除非您有非常困难的运动模式(例如,当所有图像像素都朝不同方向移动时,或者当图像内部运动非常快时),否则结果仍然可以接受.该算法在图像金字塔中每级运行最小化步骤warps次,因此,即使warps的微小变化也会为您带来明显的加速.

Reduce the number of warps (parameter: warps) per scale. This will harm a little the accuracy, but unless you have very difficult motion patterns (e.g., when all the image pixels are moving in different directions, or when you have a very fast motion inside the image) the result should still be acceptable. The algorithms runs the minimization procedure warps times per level in the image pyramid, so even a small change in warps will give you a noticeable speedup.

减少图像金字塔中的级别数(参数:scales).不过,这可能会对准确性产生重要影响,因此请小心并进行大量实验.在文献中发现,级别之间的良好(精确度)比例因子是0.8,因此您应该相应地计算级别数.在0.8之前,光流实验的标准是0.5的比例因子,因此您可以尝试降低到该值.

Reduce the number of levels in the image pyramid (parameter: scales). This can have an important impact on the accuracy though, so be careful and experiment a lot with it. It has been found in the literature that a good (for accuracy) scale factor between levels is 0.8, so you should compute your number of levels accordingly. Before 0.8, the standard in experimenting with optical flow was a scale factor of 0.5, so you can try to go down until this value.

收敛速度:理论上,L1最小化的内部过程对于时间步长(参数:tau)稳定,理论上最高为1/8(0.125),但实际值为1/4(0.25)已知仍在工作.

Convergence speed: the inner procedure for L1 minimization is stable for time steps (parameter: tau) up to 1/8 (0.125) in theory, but in practice values of 1/4 (0.25) are known to still work.

这篇关于加快光流(createOptFlow_DualTVL1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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