Kinect gesture recognition in SimpleOpenNI

I want to realize some kind of drums. For every hit, I want to play a song. Therefore, I need to identify each β€œhit” and position. Before I begin to implement a function that will analyze positions and detect "hits", I want to be sure that there is no other solution, is there also some kind of event, gesture detection, that allows me to detect this?

+4
source share
2 answers

As far as I know, there is no β€œevent” that is initially defined differently than stream callbacks that are called when data is received, such as the joint position and depth image, which should be sufficient to get started.

I would take a look at this: https://code.google.com/p/kineticspace/ to find out what to expect or how to continue your own code.

, , , , , " y x ". "". , , , .

.

+1

Kinect, Kinect. :

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

- ()

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

()

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;
  }
}
0

Source: https://habr.com/ru/post/1543683/


All Articles