问题描述
我只需要一些有关我所遇到的问题,在哪里看等等的指导。我正在为我的一个项目使用移动跟踪手套,该手套会为每个手指和手掌返回X,Y和Z值。
I just need some directions regarding a problem I have, where to look, etc.. I am using a movement tracking glove for one of my projects, which returns an X, Y and Z values for each finger and for the palm.
我想做的是首先根据这些坐标创建每个手指运动的表示,然后将每个手指运动附加到手掌的运动上,以代表手。一旦我管理了第一步,这第二步就很容易了,但是...我却没法。
What I would like to do is to first create a representation of each finger movements based on these coordinates, , and then attach each of them to the movement of the palm, to have a representation of the hand. This second step will be easy once I manage the first one, but... I don't manage.
我正在尝试用Java实现它(更好的分析可能性),但只能同时制作包含所有点的3D图形。而且每条曲线中大约有45,000个,因此...您是否知道如何使其更像动画,如在给定时间t在其XYZ坐标上显示一个点?
I'm trying to implement it in Java (better analysis possibilities), but can only manage to make a 3D graph with ALL the points, at the same time. And there are around 45,000 of them in each curve, so... Would you have any idea of how to make it more like an animation, as in displaying a point at its XYZ coordinates at a given time t?
另一个问题是:matlab实际上是最好的选择吗?我了解了如何使这种动画在Java中运行,但是我从未使用Java进行数据管理,并且我怀疑它是否真的擅长于此。是否还有另一种软件/语言可以很好地对数据进行管理和动画处理?还是我应该只使用Java制作动画,然后使用Matlab进行分析?
The other question is: is matlab actually the best option for this? I see how to make this animation work in Java, but I've never used Java for data management, and I doubt it is really good at it.. Is there another software/language that would be good at data management AND animating it? Or should I just use Java to make the animation, and Matlab to do the analysis?
谢谢!
推荐答案
您可以执行以下操作。令pos为Nx3矩阵,其中包含N个时间实例的点的x,y,z数据。您编写一个设置vars等的主脚本,并创建一个调用绘图函数 doPlot的循环计时器t1。主要脚本是
You can do the following. Let pos be an Nx3 matrix which contains the x,y,z data of a point, for N time instances. You write a main script which sets up vars etc, and create a loop timer t1 that calls the plotting function "doPlot". The main script is,
clear all
clc
pos=rand(100,3)*10; %position matrix of random x,y,z coordinates. 100 time instances here
ax=axes;
set(ax,'NextPlot','replacechildren');
axis([0 10 0 10 0 10]); %set axis limits- fit to your needs
Dt=0.1; %sampling period in secs
k=1;
hp=plot3(pos(k,1),pos(k,2),pos(k,3),'o'); %get handle to dot object
t1=timer('TimerFcn','k=doPlot(hp,pos,t1,k)','Period', Dt,'ExecutionMode','fixedRate');
start(t1);
接下来创建绘图函数doPlot,
Next you create the plotting function doPlot,
function k=doPlot(hp,pos,t1,k)
k=k+1;
if k<length(pos)
set(hp,'XData',pos(k,1),'YData',pos(k,2),'ZData',pos(k,3));
axis([0 10 0 10 0 10]);
else
stop(t1)
end
您将看到3D在空间中随机移动的点(圆)。动画周期为Dt秒(在这种情况下为0.1秒)。您必须使其适合您的需求。这是Matlab中的基本动画。您可以做更多的事情。这取决于您的需求。
You will see a point (circle) in 3D randomly moving aroung in space. The animation period is Dt secs (0.1 secs in this case). You must fit it to your needs. This is a basic animation in Matlab. You could do much more. It depends on your needs.
这篇关于在Matlab / Java中将手部运动建模为3D曲线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!