让我先解释一下我的目标和问题。 我有一个物体在bocal(准确地说是一只老鼠)内循环移动,我需要知道它在一分钟内旋转了多少圈。这个运动不是一个完美的圆,而且可以是混乱的。它可以停止几秒钟,然后重新开始移动。在
但我知道的是,我每分钟旋转3到20次(0.05赫兹到0.33赫兹)。在
我用一个30 fps的相机在30分钟内拍摄这个物体。 使用Python和OpenCV,我设法提取(X,Y)坐标。由于30fps对于我所寻找的频率来说有点高,所以我选择了15帧,以便采样频率为2hz。在
第一个问题是,有时候,我会漏掉一点,因为OpenCV找不到对象。这是一个我无法解决的问题,因为我用HSV色罩跟踪的点有时是隐藏的。在
事实上,我要过滤的数据是:
例如,我有这样的列表:
This is the king of movement I get, as you can see, I need to filter the high frequency.
现在我的问题是:即使我有一些过滤和编码的基础知识,我也不知道怎么做,也不知道该用哪个库。 我读过scipy应该有所有必需的功能,但我不知道该用哪一个,以及如何使用。在
我不确定,但我想我应该做这样的事情:
你能告诉我我是不是对的,并给我指出编码部分的正确方向吗?在
谢谢你的帮助
马修
下面是我用你告诉我的代码: 我创建了两个函数:
目前,我还没有尝试改变a的值来找到正确的值,但它确实给了我很好的结果。在
Preliminary results
我也尝试过在scipy库中使用butterworth过滤器,但是我无法使其工作。以下是我无法理解的代码:
^{pr2}$如果你知道如何让这个巴特沃斯工作,我很乐意听到。在
在深入研究傅立叶变换之前,您可以只应用一阶或二阶低通滤波器。你可以先线性插值数据,这样你就可以有一个恒定的
2Hz
频率。然后可以对数据点应用一阶低通滤波器。在x是你的观察值,y是你的过滤后的估计值。在
然后,如果第一个原型产生一些有用的结果,您就可以使用一些物理模型来获得更好的估计值。Kalman滤波器可以更好地利用你潜在的物理现实。但要做到这一点,你首先需要知道如何模拟物理现实。在
https://en.wikipedia.org/wiki/Kalman_filter
在这里,你也许还可以找到一个更接近计算机视觉跟踪运动的例子: http://www.diss.fu-berlin.de/docs/servlets/MCRFileNodeServlet/FUDOCS_derivate_000000000473/2005_12.pdf
相关问题 更多 >
编程相关推荐