Quantcast
Channel: Kinect - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 530

How can i declare Pvector?

$
0
0

import SimpleOpenNI.*;

SimpleOpenNI context;

void setup() { size(640,480); background(255); context = new SimpleOpenNI(this); if(context.isInit() == false) { exit(); return; } context.enableDepth();

context.enableUser(); }

void draw() { context.update();

int[] userList = context.getUsers();

for(int i=0;i<userList.length;i++) { if(context.isTrackingSkeleton(userList[i])) {

Pvector jointPos_lefthand = new PVector(); Pvector jointPos_lefthand2d = new PVector();

Pvector jointPos_leftshoulder = new PVector(); Pvector jointPos_leftshoulder2d = new PVector();

Pvector jointPos_leftelbow = new PVector(); Pvector jointPos_leftelbow2d = new PVector();

Pvector jointPos_rightshoulder = new PVector(); Pvector jointPos_rightshoulder2d = new PVector();

Pvector jointPos_rightelbow = new PVector(); Pvector jointPos_rightelbow2d = new PVector();

Pvector jointPos_righthand = new PVector(); Pvector jointPos_righthand2d = new PVector();

context.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_LEFT_SHOULDER,jointPos_leftshoulder); context.drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER, SimpleOpenNI.SKEL_LEFT_ELBOW,jointPos_leftelbow); context.getJointPositionSkeleton(userId,SimpleOpenNI.SKEL_LEFT_HAND,jointPos_lefthand);

context.drawLimb(userId, SimpleOpenNI.SKEL_NECK, SimpleOpenNI.SKEL_RIGHT_SHOULDER,jointPos_rightshoulder); context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER, SimpleOpenNI.SKEL_RIGHT_ELBOW,jointPos_rightelbow); context.drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_ELBOW, SimpleOpenNI.SKEL_RIGHT_HAND,jointPos_righthand);

context.convertRealWorldToProjective(jointPos_lefthand,jointPos_lefthand2d); context.convertRealWorldToProjective(jointPos_leftshoulder,jointPos_leftshoulder2d); context.convertRealWorldToProjective(jointPos_leftelbow,jointPos_leftelbow2d);

context.convertRealWorldToProjective(jointPos_rightshoulder,jointPos_rightshoulder2d); context.convertRealWorldToProjective(jointPos_rightelbow,jointPos_rightelbow2d); context.convertRealWorldToProjective(jointPos_righthand,jointPos_righthand2d);

ellipse(jointPos_lefthand2d.x,jointPos_lefthand2d.y,30,30); ellipse(jointPos_leftshoulder2d.x,jointPos_leftshoulder2d.y,30,30); ellipse(jointPos_leftelbow2d.x,jointPos_leftelbow2d.y,30,30);

ellipse(jointPos_rightshoulder2d.x,jointPos_rightshoulder2d.y,30,30); ellipse(jointPos_rightelbow2d.x,jointPos_rightelbow2d.y,30,30); ellipse(jointPos_righthand2d.x,jointPos_righthand2d.y,30,30); } } }


Viewing all articles
Browse latest Browse all 530

Trending Articles