【问题标题】:kinect Gesture recognition in SimpleOpenNISimpleOpenNI 中的 kinect 手势识别
【发布时间】:2014-06-07 15:50:23
【问题描述】:

我想实现一种鼓。对于每首歌曲,我都想播放一首歌。所以我需要检测每一个“命中”和位置。在我开始实现将分析位置并检测“命中”的功能之前,我想确定没有其他解决方案,那么是否有任何事件,手势检测可以让我检测到这一点?

【问题讨论】:

    标签: java kinect simple-openni


    【解决方案1】:

    据我所知,除了流回调之外,没有本地定义的“事件”,当您接收到关节位置和深度图像等数据时会调用它,这应该足以让您开始。

    我会看看这个:https://code.google.com/p/kineticspace/ 以了解会发生什么或如何处理您自己的代码。

    一旦您设法获取骨架数据,只需找到手当时的位置,为其位置设置一个阈值并开始跟踪一段时间,看看它的移动路径是否适合您的特定手势模式,例如“在 y 方向平移 x 秒”。然后你就有了非常简单的“击中”手势检测。这可以根据您的需要变得复杂,但就您从图书馆方面收到的内容而言,它的基本内容并不多。

    祝你好运。

    【讨论】:

      【解决方案2】:

      我使用 Kinect 制作了一个架子鼓,这是一个在 Kinect 中放置和使用盒子的精彩课程。 导入库:

      import processing.opengl.*;
      import SimpleOpenNI.*;
      

      在你的 Setup() 中使用类似这样的代码

      myTrigger = new Hotpoint(200, 10, 800, size); 
      

      使用 draw() 中的方法

      if(myTrigger.currentlyHit()) { 
                myTrigger.play();
                println("trigger hit");
            }
      

      在这个类中使用以下方法!

      class Hotpoint {
      
        PVector center;
        color fillColor;
        color strokeColor;
        int size;
        int pointsIncluded;
        int maxPoints;
        boolean wasJustHit;
        int threshold;
      
        Hotpoint(float centerX, float centerY, float centerZ, int boxSize) { 
          center = new PVector(centerX, centerY, centerZ);
          size = boxSize;
          pointsIncluded = 0;
          maxPoints = 1000;
          threshold = 0;
          fillColor = strokeColor = color(random(255), random(255), random(255));
        }
      
        void setThreshold( int newThreshold ){
          threshold = newThreshold;
        }
      
        void setMaxPoints(int newMaxPoints) {
          maxPoints = newMaxPoints;
        }
      
        void setColor(float red, float blue, float green){
          fillColor = strokeColor = color(red, blue, green);
        }
      
        boolean check(PVector point) { 
          boolean result = false;
          if (point.x > center.x - size/2 && point.x < center.x + size/2) {
            if (point.y > center.y - size/2 && point.y < center.y + size/2) {
              if (point.z > center.z - size/2 && point.z < center.z + size/2) {
                result = true;
                pointsIncluded++;
              }
            }
          }
      
          return result;
        }
      
        void draw() { 
          pushMatrix(); 
            translate(center.x, center.y, center.z);
      
              fill(red(fillColor), blue(fillColor), green(fillColor), 
                255 * percentIncluded());
              stroke(red(strokeColor), blue(strokeColor), green(strokeColor), 255);
              box(size);
          popMatrix();
        }
      
        float percentIncluded() {
          return map(pointsIncluded, 0, maxPoints, 0, 1);
        }
      
        boolean currentlyHit() { 
          return (pointsIncluded > threshold);
        }
      
        boolean isHit() { 
          return currentlyHit() && !wasJustHit;
        }
      
        void clear() { 
          wasJustHit = currentlyHit();
          pointsIncluded = 0;
        }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-08-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-03-13
        • 1970-01-01
        相关资源
        最近更新 更多