制作时间序列的 3D 渲染图 [英] Make a 3D rendered plot of time-series

查看:27
本文介绍了制作时间序列的 3D 渲染图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组 3D 坐标(下面 - 仅用于 3D 空间中的单个点):

I have a set of 3D coordinates (below - just for a single point, in 3D space):

x <- c(-521.531433, -521.511658, -521.515259, -521.518127, -521.563416, -521.558044, -521.571228, -521.607178, -521.631165, -521.659973)
y <- c(154.499557, 154.479568, 154.438705, 154.398682, 154.580688, 154.365189, 154.3564, 154.559189, 154.341309, 154.344223)
z <- c(864.379272, 864.354675, 864.365479, 864.363831, 864.495667, 864.35498, 864.358582, 864.50415, 864.35553, 864.359863)
xyz <- data.frame(x,y,z)

我需要使用 3D 渲染制作该点的时间序列图(以便我可以旋转图等).该图将可视化上述时间点的轨迹(例如以实线的形式).我使用 'rgl' 包plot3d 方法,但我做不到它绘制时间序列(下面,只需从时间序列的第一帧绘制一个点):

I need to make a time-series plot of this point with a 3D rendering (so I can rotate the plot, etc.). The plot will visualize a trajectory of the point above in time (for example in the form of solid line). I used 'rgl' package with plot3d method, but I can't make it to plot time-series (below, just plot a single point from first frame in time-series):

require(rgl)    
plot3d(xyz[1,1],xyz[1,2],xyz[1,3],axes=F,xlab="",ylab="",zlab="") 

我找到了这篇文章,但它并没有真正处理实时渲染的 3D 绘图.我将不胜感激任何建议.谢谢.

I found this post, but it doesn't really deal with a real-time rendered 3D plots. I would appreciate any suggestions. Thank you.

推荐答案

解决方案比我想象的要简单,问题是我没有在我的数据上使用 as.matrix.当我只是尝试使用 plot3d 绘制我的整个数据集时,我收到错误 (list) object cannot be coerced to type 'double'(为此找到了解决方案 此处).因此,如果您需要绘制一组坐标的时间序列(在我的例子中是两个演员的动作捕捉数据),这里是我的完整解决方案(仅适用于下面的数据集!):

The solution was simpler than I thought and the problem was that I didn't use as.matrix on my data. I was getting error (list) object cannot be coerced to type 'double' when I was simply trying to plot my entire dataset using plot3d (found a solution for this here). So, if you need to plot time-series of set of coordinates (in my case motion capture data of two actors) here is my complete solution (only works with the data set below!):

  • download example data set
  • read the above data into a table:

data <- read.table("Bob12.txt",sep="	")

  • 将 XYZ 坐标提取到单独的矩阵中:

  • extract XYZ coordinates into a separate matrixes:

    x <- as.matrix(subset(data,select=seq(1,88,3)))
    y <- as.matrix(subset(data,select=seq(2,89,3)))
    z <- as.matrix(subset(data,select=seq(3,90,3)))
    

  • 使用 'rgl' 包:

    require(rgl)
    plot3d(x[1:nrow(x),],y[1:nrow(y),],z[1:nrow(z),],axes=F,xlab="",ylab="",zlab="")
    

  • 您应该得到如下图所示的内容(但您可以旋转它等) - 希望您能认出那里有人的联合中心.我仍然需要调整它以使其在视觉上更好 - 将第一帧作为一个点(以清楚地看到演员的关节),然后是一个可见的中断,然后是其余的帧作为一条线.

    You should get something like on the image below (but you can rotate it etc.) - hope you can recognise there are joint centers for people there. I still need to tweak it to make it visually better - to have first frame as a points (to clearly see actor's joints), then a visible break, and then the rest of frames as a lines.

    这篇关于制作时间序列的 3D 渲染图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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