2017-01-12 8 views
1

でビデオを再生我々は、スケルトントラッキング(ヘッドトラッキング)を行うため、同時にビデオを再生するには、次のコードを使用しましたファイル我々は、上記のコードの実行に関連付けられたとき:スケルトントラッキング&処理

のJavaフレーム(J =コンパイルされたJavaコード、J =解釈、VV = VMコード) J 1472 SimpleOpenNI.SimpleOpenNIJNI.IntVector_size(JLSimpleOpenNI/IntVectorを;)J (0バイト)@ 0x0000000002 0x0000000002ebe314 [0x0000000002ebe280 + 0x94] jはSimpleOpenNI.SimpleOpenNI.getUsers()[I 15 J 1777 C1 skeleton_track_simpleopen_video.drawを(+ @ ebe695 [0x0000000002ebe640 +は0x55] J 1471 C1 SimpleOpenNI.IntVector.size()J(8バイト) )V(159バイト)@ 0x0000000003004ca4 [0x0000000003004600 + 0x6a4] j processing.core.PApplet.handleDraw()V + 161 J 1769 C1 processing.awt.PSurfaceAWT $ 12.callDraw()V(18バイト)@ 0x000000000300009c [0x0000000002ffff80 + 0x11c] J processing.core.PSurfaceNone $ AnimationThread.run()V + 30 V〜StubRoutines :: call_stub

上記のコードは、エラーなしで実行していることは注目に値しますビデオを再生していない場合(processing.videoライブラリ)。

上記のコードで問題を見つけるのを助けることはできますか?

答えて

0

これは実際には奇妙な動作ですが、この部分の下に到達するには、ソースからSimpleOpenNIライブラリをコンパイルする必要があるかもしれません。getUsers()メソッドが無効なメモリ参照を行っています。

これは、単にいくつかのテストをして物事を進めたい場合には実用的ではないかもしれません。 getUsers()メソッドを使用しないことをお勧めします。おそらくgetNumberOfUsers()を使用して逃げることができます:

import processing.video.*; 
import SimpleOpenNI.*; 
import java.util.*; 

SimpleOpenNI kinect; 
PImage kinectDepth; 
int[] userID; 

color[] userColor = new color[]{ color(255,0,0), color(0,255,0), color(0,0,255), 
           color(255,255,0), color(255,0,255), color(0,255,255)}; 
PVector headPosition = new PVector(); 
float headSize = 200; 
float confidenceLevel = 0.5; 
float confidence; 
PVector confidenceVector = new PVector(); 
Movie movie1; 

void setup() 
{ 
    size(640, 480); 
    movie1 = new Movie(this, "moon.mP4"); 
    kinect = new SimpleOpenNI(this,"/Users/George/Downloads/gaf/as/CityWall/oni/test2.oni"); 
    kinect.enableDepth(); 
    kinect.enableUser(); 
    movie1.loop(); 
} 

void draw(){ 
    kinect.update(); 
    kinectDepth = kinect.depthImage(); 
    image(kinectDepth,0,0); 
    //userID = kinect.getUsers(); 

    for(int i=0;i<kinect.getNumberOfUsers();i++) 
    { 
    if(kinect.isTrackingSkeleton(i+1)) 
    { 
     confidence = kinect.getJointPositionSkeleton(i+1,SimpleOpenNI.SKEL_HEAD,confidenceVector); 

     if(confidence > confidenceLevel) 
     { 
     // change draw color based on hand id# 
     stroke(userColor[(i)]); 
     // fill the ellipse with the same color 
     fill(userColor[(i)]); 
     // draw the rest of the body 
     drawSkeleton(i+1); 

     } 
    } 
    } 
    image(movie1, 0, 0, movie1.width/4, movie1.height/4); 
} 

/*--------------------------------------------------------------- 
Draw the skeleton of a tracked user. Input is userID 
----------------------------------------------------------------*/ 
void drawSkeleton(int userId){ 
    kinect.getJointPositionSkeleton(userId, SimpleOpenNI.SKEL_HEAD,headPosition); 
    kinect.convertRealWorldToProjective(headPosition,headPosition); 
    ellipse(headPosition.x,headPosition.y,30,30); 
} 

void onNewUser(SimpleOpenNI curContext, int userId){ 
    println("New User Detected - userId: " + userId); 
    curContext.startTrackingSkeleton(userId); 
} 


void onLostUser(SimpleOpenNI curContext, int userId){ 
    println("User Lost - userId: " + userId); 
} 

void onVisibleUser(SimpleOpenNI curContext, int userId){ 
} //void onVisibleUser(SimpleOpenNI curContext, int userId) 


void movieEvent(Movie m) { 
    m.read(); 
} 

demo

心の中で裸これは、そのIDが何であるかを追跡されていませんが、どのように多くのユーザーを教えてくれます。 getNumberOfUsers()の代わりに、intを使用することもできます.15にしようとすると、OpenNIがサポートする最大数のユーザーになる可能性があります。これは、あなたが常にkinect.isTrackingSkeletonかどうかをチェックしているので機能します。

+0

明るい解決策をありがとうございました。はい! getUser()メソッドにバグがあるようです。 –

関連する問題