【问题标题】:How to get the x position of SKEL_HEAD kinect?如何获得 SKEL_HEAD kinect 的 x 位置?
【发布时间】:2015-06-04 20:27:58
【问题描述】:

我正在使用 Arduino、Processing 和 Kinect 编写安装程序。 我想要的是从处理 Kinect 用户的示例代码中获取 SKEL_HEAD 的 x-as。

稍后我想将我头部的 x-as 映射到 180 度伺服电机。

我现在拥有的是,当 Kinect 处于活动状态时,我在头上画了一个红色圆圈。

void drawSkeleton(int userId) {
  // to get the 3d joint data
  /*
  PVector jointPos = new PVector();
  context.getJointPositionSkeleton(userId,SimpleOpenNI.SKEL_NECK,jointPos);
  println(jointPos);
  */

  // Get X position of HEAD
  PVector jointPos = new PVector();
  context.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_HEAD, jointPos);
  println("jointPos " + jointPos);

  PVector jointPos2d = new PVector();
  context.convertRealWorldToProjective(jointPos,jointPos2d);  


  fill(255,0,0); // Fill the shape
  ellipse(jointPos2d.x, jointPos2d.y, 40,40); // Create the shape

【问题讨论】:

    标签: arduino processing kinect


    【解决方案1】:

    您的代码应该可以工作。调用 convertRealWorldToProjective 应该将 3d 坐标转换为 2d 坐标。我想知道这是否是您想要的映射:头部的 2d 位置而不是头部在 Y 轴上的旋转?

    如果你想映射头部的旋转,你应该能够分解头部关节的 3D 变换矩阵,尽管我不确定它有多准确。如果这不起作用,有other ways 获取头部方向。

    如果映射到伺服位置的 2D 位置是您所追求的,只要跟踪您所追求的骨架,只需调用 map() 函数来对齐位置范围(可能0-640px 取决于您的 kinect 设置到 0-180 取决于您的伺服设置 - 这些值可能会有所偏移。

    绘制一个自上而下的视图可能会很方便,您可以将平面中的头部位置映射到伺服旋转。这听起来有点像观察场景,其中伺服器需要转动以使物体面向头部 2d 位置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-24
      • 2011-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-21
      • 1970-01-01
      相关资源
      最近更新 更多