一種のドラムを実装したい。ヒットするたびに、曲をプレイしたい。したがって、すべての「ヒット」と位置を検出する必要があります。位置を分析して「ヒット」を検出する機能の実装を開始する前に、他に解決策がないことを確認したいので、それを検出できるイベント、ジェスチャー検出はありますか?
1207 次
2 に答える
1
私の知る限り、開始するのに十分なジョイント位置や深度画像などのデータを受信したときに呼び出されるストリーム コールバック以外に、ネイティブに定義された「イベント」はありません。
これを見てみましょう: https://code.google.com/p/kineticspace/何が期待できるか、または独自のコードをどのように進めるかを知るために。
スケルトン データを取得できたら、その時点での手がどこにあるかを見つけ、その位置にしきい値を設定し、一定時間追跡を開始し、その移動パスが特定のジェスチャのパターンに適合するかどうかを確認します。 y 方向に x 秒間」。次に、非常に単純な「ヒット」ジェスチャの検出があります。これは必要に応じて複雑になる可能性がありますが、ライブラリ側から受け取るものに関しては、基本的なことはあまりありません。
幸運を。
于 2014-06-08T23:51:38.520 に答える
0
これを使用して、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;
}
}
于 2015-10-12T17:56:04.963 に答える