規劃期末作品
將驅動安裝完成
建置環境
程式碼:
import SimpleOpenNI.*;
SimpleOpenNI openni;
void setup(){
size(600,400);
openni = new SimpleOpenNI(this);
openni.enableRGB();
openni.enableDepth();
openni.enableUser();
}
void draw(){
openni.update();
image(openni.userImage(), 0,0 ,600,400);
}
--------------------------------------------------------------------------------------------------------------------------
上週範例找到右手位置
程式碼:
import SimpleOpenNI.*;
SimpleOpenNI openni;
void setup(){
size(600,400);
openni = new SimpleOpenNI(this);
openni.enableRGB();
openni.enableDepth();
openni.enableUser();
}
void draw(){
openni.update();
background(255);
image(openni.userImage(), 0,0 ,300,200);
int [] userList = openni.getUsers();
PVector pos = new PVector(0,0,0);
for(int userID : userList){
openni.getJointPositionSkeleton(userID,SimpleOpenNI.SKEL_LEFT_HAND, pos);
}
ellipse(pos.x, pos.y, 50,50);
println(pos);
}
void onNewUser(SimpleOpenNI openni,int userId)
{
openni.startTrackingSkeleton(userId);
}
----------------------------------------
打巴掌遊戲
沒有留言:
張貼留言