简体   繁体   English

如何使用tvl1 opencv函数计算光流

[英]How to compute optical flow using tvl1 opencv function

I'm trying to find python example for computing optical flow with tvl1 opencv function createOptFlow_DualTVL1 but it seems that there isn't enough documentation for it. 我正在尝试使用tvl1 opencv函数createOptFlow_DualTVL1找到计算光流的python示例,但似乎没有足够的文档。

Could anyone please let me do that? 有人可以让我这样做吗? I've used calcOpticalFlowFarneback mentioned here http://docs.opencv.org/master/d7/d8b/tutorial_py_lucas_kanade.html but it is not giving me accurate results, will tvl1 good enough and if not is there another method I should look for? 我已经使用了http://docs.opencv.org/master/d7/d8b/tutorial_py_lucas_kanade.html中提到的calcOpticalFlowFarneback但是它没有给我准确的结果,tvl1会不会很好,如果没有,我应该寻找另一种方法?

[[EDIT]] [[编辑]]

I've some regions come from selective search, I want keep only regions with motion in it, so computing the OF for a given frame and then get the avg in each region could do it. 我有一些区域来自选择性搜索,我想只保留其中包含运动的区域,因此计算给定帧的OF然后获得每个区域的平均值可以做到。 It's also described in this paper section 3.1 它也在本文 3.1节中描述

Thanks. 谢谢。

Change this line(Dense Optical example in http://docs.opencv.org/master/d7/d8b/tutorial_py_lucas_kanade.html ): 更改此行( http://docs.opencv.org/master/d7/d8b/tutorial_py_lucas_kanade.html中的密集光学示例):

flow = cv2.calcOpticalFlowFarneback(prvs, next, None, 0.5, 3, 15, 3, 5, 1.2, 0)

By these: 通过这些:

optical_flow = cv2.DualTVL1OpticalFlow_create()
flow = optical_flow.calc(prvs, next, None)

The parameter descriptions can be found here: http://docs.opencv.org/3.3.0/dc/d47/classcv_1_1DualTVL1OpticalFlow.html 参数说明可在此处找到: http//docs.opencv.org/3.3.0/dc/d47/classcv_1_1DualTVL1OpticalFlow.html

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

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