- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在视频剪辑的帧子集中,我有六个点的 (x,y) 像素坐标。我想为这些数据点之间的帧(时间)的(x,y)像素值生成一个平滑的插值器。
它们在下面显示为 x、y 中的轨迹,以及单独与时间的关系。
在 scipy.interpolate
中,有非常丰富的可能选择(许多不同类型的插值方法)。 我的问题是: 我应该从哪里开始?我正在寻找具有插值经验的人的推荐。 在 SciPy 中所有可用的插值方法中,为了插值此数据和类似数据,我应该首先尝试学习哪些方法?
一些可用的方法可以将 x 和 y 拟合在一起 - 例如MultivariateSplines 但不确定将它们一起处理或单独处理是否有优势。
注意:我只使用 NumPy 和 SciPy,请不要推荐其他软件包。谢谢!
如果您想查看数据,都在 paths = np.array...
行中:
import numpy as np
import matplotlib.pyplot as plt
# this line is very long - has all the data for the plot!
paths = np.array([[[45.0, 135.0], [42.0, 130.0], [41.0, 123.0], [41.0, 120.0], [38.0, 119.0], [35.0, 124.0], [34.0, 124.0], [36.0, 122.0], [36.0, 118.0], [37.0, 113.0], [41.0, 107.0], [45.0, 97.0], [49.0, 82.0], [54.0, 72.0], [56.0, 66.0], [57.0, 61.0], [58.0, 59.0], [57.0, 55.0], [-1, -1], [53.0, 47.0], [47.0, 41.0], [42.0, 35.0], [37.0, 27.0], [34.0, 23.0], [33.0, 21.0], [35.0, 23.0], [38.0, 23.0], [43.0, 21.0], [46.0, 17.0], [50.0, 16.0], [50.0, 19.0], [50.0, 26.0], [47.0, 35.0], [46.0, 41.0], [47.0, 44.0], [48.0, 48.0], [47.0, 51.0], [43.0, 55.0], [39.0, 56.0], [36.0, 52.0]], [[50.0, 139.0], [48.0, 135.0], [46.0, 128.0], [46.0, 125.0], [43.0, 124.0], [40.0, 128.0], [40.0, 130.0], [41.0, 127.0], [42.0, 124.0], [43.0, 120.0], [45.0, 112.0], [51.0, 102.0], [54.0, 91.0], [60.0, 79.0], [63.0, 70.0], [62.0, 67.0], [68.0, 62.0], [62.0, 62.0], [-1, -1], [63.0, 52.0], [53.0, 48.0], [49.0, 41.0], [44.0, 33.0], [40.0, 30.0], [40.0, 27.0], [41.0, 29.0], [44.0, 30.0], [48.0, 27.0], [52.0, 24.0], [56.0, 22.0], [58.0, 27.0], [56.0, 32.0], [54.0, 42.0], [52.0, 48.0], [53.0, 52.0], [55.0, 55.0], [54.0, 59.0], [50.0, 62.0], [45.0, 63.0], [42.0, 58.0]], [[113.0, 134.0], [110.0, 130.0], [110.0, 123.0], [110.0, 121.0], [107.0, 120.0], [105.0, 123.0], [105.0, 123.0], [107.0, 121.0], [108.0, 119.0], [110.0, 115.0], [113.0, 108.0], [118.0, 96.0], [-1, -1], [128.0, 72.0], [122.0, 68.0], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [127.0, 40.0], [123.0, 35.0], [118.0, 29.0], [116.0, 24.0], [115.0, 21.0], [117.0, 22.0], [122.0, 23.0], [128.0, 19.0], [-1, -1], [136.0, 15.0], [-1, -1], [138.0, 26.0], [137.0, 35.0], [136.0, 41.0], [138.0, 43.0], [140.0, 48.0], [140.0, 50.0], [137.0, 54.0], [134.0, 55.0], [133.0, 51.0]], [[192.0, 154.0], [190.0, 148.0], [191.0, 140.0], [192.0, 137.0], [191.0, 137.0], [188.0, 142.0], [189.0, 143.0], [193.0, 139.0], [193.0, 137.0], [197.0, 134.0], [203.0, 128.0], [208.0, 117.0], [217.0, 104.0], [219.0, 93.0], [223.0, 85.0], [226.0, 81.0], [228.0, 78.0], [228.0, 76.0], [228.0, 73.0], [226.0, 68.0], [224.0, 63.0], [220.0, 58.0], [217.0, 52.0], [216.0, 46.0], [216.0, 42.0], [219.0, 42.0], [223.0, 45.0], [230.0, 46.0], [236.0, 48.0], [244.0, 50.0], [247.0, 50.0], [248.0, 50.0], [246.0, 55.0], [245.0, 61.0], [249.0, 71.0], [254.0, 79.0], [257.0, 87.0], [256.0, 89.0], [253.0, 87.0], [251.0, 80.0]], [[216.0, 144.0], [214.0, 139.0], [215.0, 131.0], [216.0, 129.0], [217.0, 127.0], [213.0, 133.0], [214.0, 133.0], [217.0, 130.0], [219.0, 128.0], [222.0, 125.0], [227.0, 118.0], [234.0, 107.0], [239.0, 94.0], [245.0, 82.0], [249.0, 76.0], [253.0, 72.0], [255.0, 69.0], [255.0, 67.0], [255.0, 62.0], [254.0, 57.0], [251.0, 52.0], [248.0, 48.0], [245.0, 42.0], [244.0, 36.0], [245.0, 31.0], [249.0, 32.0], [252.0, 33.0], [259.0, 34.0], [267.0, 38.0], [273.0, 38.0], [277.0, 38.0], [278.0, 39.0], [276.0, 43.0], [276.0, 50.0], [280.0, 58.0], [286.0, 67.0], [288.0, 74.0], [288.0, 76.0], [286.0, 74.0], [286.0, 67.0]], [[252.0, 149.0], [250.0, 143.0], [252.0, 137.0], [253.0, 133.0], [252.0, 132.0], [250.0, 137.0], [252.0, 137.0], [255.0, 134.0], [257.0, 132.0], [262.0, 130.0], [266.0, 123.0], [273.0, 111.0], [277.0, 97.0], [286.0, 86.0], [289.0, 80.0], [293.0, 77.0], [295.0, 75.0], [296.0, 71.0], [296.0, 66.0], [296.0, 61.0], [294.0, 57.0], [290.0, 52.0], [288.0, 48.0], [289.0, 42.0], [289.0, 37.0], [293.0, 35.0], [298.0, 37.0], [305.0, 39.0], [313.0, 42.0], [319.0, 43.0], [324.0, 44.0], [325.0, 44.0], [324.0, 49.0], [325.0, 55.0], [329.0, 63.0], [336.0, 71.0], [339.0, 78.0], [339.0, 80.0], [337.0, 79.0], [338.0, 73.0]]])
paths[paths<0] = np.nan # turn the -1's back into np.nan
plt.figure()
for path in paths:
x, y = path.T
plt.plot(x, y, linewidth=3)
plt.plot(x, y, '.k')
plt.show()
plt.figure()
for i, path in enumerate(paths):
plt.subplot(6, 1, i+1)
x, y = path.T
plt.plot(x)
plt.plot(x, '.k')
plt.plot(y)
plt.plot(y, '.k')
plt.show()
最佳答案
我正在使用 scipy.interpolate.InterpolatedUnivariateSpline
。
我必须处理的一件事是某些方法往往会占用过多的内存空间 - 上面的函数在这方面运行良好。
关于python - 如何为缺少数据的移动对象坐标生成插值器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36566990/
我正在尝试在 map 上绘制一些疾病事件数据的位置。 我用它来导入数据: ByTown% addProviderTiles("CartoDB.Positron")%>% addPolygons
我有一个文件调用 find.js,我使用 node find.js 运行,我的节点是版本 10 我不知道为什么我无法使用 async await。 const axios = require("axi
我有一个项目作为引用添加到 System.Web。 但是,它似乎无法获取 HttpContext。这样做: Imports System.Web _ApplicationBase = HttpCont
在互联网上找到这段代码,出于某种原因它缺少 while 循环逻辑“while(i....)”,虽然我找到了 PigLatin* 问题的其他可行解决方案,但我真的很想了解这个正在工作。 *PigLati
我工作了一整天来运行 Xampp 并在其上安装 TYPO3。现在我登录到后端,但没有显示许多管理模块,例如模板、访问等。 - 一定是我做错了什么,但我不知道。 these are the module
你好 我有编译这个问题 \begin{equation} J = \sum_{j=1}^{C} \end{equation} 我不断收到错误 missing $ inserted 这很奇怪,因
我正在尝试使用 SQLite CLI,但无法获得 generate_series功能来工作。我可以按照文档中的建议使用递归 CTE 对其进行模拟,但我似乎无法获得该链接中的任何示例。这是我的 sess
我目前正在开发我想要的软件,而软件正在安装,它可以在后台为软件创建 native 图像。 我正在考虑使用 NGEN 并将进程优先级设置为低,因为我不希望它消耗 100% CPU。但是我发现我的计算机上
我想使用 Xcodes Instruments 进行 UI 自动化测试。但似乎缺少“自动化”。我怎样才能添加这个? 最佳答案 如果您想使用自动化仪器,请使用 Xcode 7.3。 Apple 在 Xc
我目前在 JS 开发中迈出了一小步,并编写了以下链接添加器: const button = document.getElementById('button') const listdiv = docu
此代码有什么问题: NSError *error = nil; [SFHFKeychainUtils deleteItemForUsername:@"IAPNoob01" andServiceName
出于某种原因,在安装和配置(我认为)一切之后,com.adobe.utils.AGALMiniAssembler 不见了,其他一切正常。 我认为我已尽一切努力让孵化器正常工作,但显然我错过了一步。 如
我有一个名为 new 的方法。调用 new 时,我传递了一个参数,但是当我运行应用程序时,出现没有参数或参数为空的错误。 StepReader.pm package StepReader; use s
安装 gtk 1.2(包名 gtk1)和 macports chokes 在最终的 make 中,在 libintl.h 的第 440 行。 extern locale_t libintl_newlo
我用按钮创建表格。 这是javascript代码: function layersListTable(layers) { var content =''; $.each($(layer
我在使用此 javascript 时遇到此错误,任何人都可以帮我弄清楚我做错了什么吗? $(this).prepend('Check availability »'); 它给我错误 mis
我有一个独立的工具链 NDK13b、api19、llvm 3.8 编译器、arm 32 位、带有 libcpp(llvm C++ 库) 我想避免依赖 libgcc,所以我构建了 compiler-rt
我按照一些教程使用 phonegap 的条形码扫描器插件。但是当我从现有源创建一个新的 android 项目来创建条码库时 (step 6 in this page)我收到错误:“AndroidMan
我现在尝试在 Eclipse 中打开我的布局 xml 文件。我只得到错误 No XML content. Please add a root view or layout to your docume
我的 android-sdk-windows\tools 目录中缺少层次结构查看器工具。 工具链接: http://developer.android.com/guide/developing/too
我是一名优秀的程序员,十分优秀!