diff --git a/src/ofxKinect2.cpp b/src/ofxKinect2.cpp index 9d16292..633ca55 100644 --- a/src/ofxKinect2.cpp +++ b/src/ofxKinect2.cpp @@ -1165,6 +1165,8 @@ void Body::update(IBody* body) HRESULT hr = body->get_HandLeftState(&left_hand_state); hr = body->get_HandRightState(&right_hand_state); + hr = body->get_HandLeftConfidence(&left_hand_confidence); + hr = body->get_HandRightConfidence(&right_hand_confidence); body->get_LeanTrackingState(&lean_state); PointF pnt; @@ -1389,6 +1391,15 @@ bool BodyStream::readFrame() if (SUCCEEDED(hr)) { + Vector4 floor; + hr = p_frame->get_FloorClipPlane(&floor); + if (SUCCEEDED(hr)) { + floor_clip_plane.x = floor.x; + floor_clip_plane.y = floor.y; + floor_clip_plane.z = floor.z; + floor_clip_plane.w = floor.w; + } + hr = p_frame->get_RelativeTime((INT64*)&frame.timestamp); IBody* ppBodies[BODY_COUNT] = {0}; diff --git a/src/ofxKinect2.h b/src/ofxKinect2.h index ab28532..464d923 100644 --- a/src/ofxKinect2.h +++ b/src/ofxKinect2.h @@ -338,7 +338,7 @@ class ofxKinect2::Body public: typedef ofPtr Ref; - Body():left_hand_state(HandState_Unknown), right_hand_state(HandState_Unknown), is_tracked(false), is_update_scale(false) { + Body():left_hand_state(HandState_Unknown), right_hand_state(HandState_Unknown), left_hand_confidence(TrackingConfidence_Low), right_hand_confidence(TrackingConfidence_Low), is_tracked(false), is_update_scale(false) { joints.resize(JointType_Count); joint_points.resize(JointType_Count); } @@ -367,6 +367,9 @@ class ofxKinect2::Body inline HandState getLeftHandState() const { return left_hand_state; } inline HandState getRightHandState() const { return left_hand_state; } + inline TrackingConfidence getLeftHandConfidence() const { return left_hand_confidence; } + inline TrackingConfidence getRightHandConfidence() const { return left_hand_confidence; } + inline size_t getNumJoints() { return JointType_Count; } const Joint& getJoint(size_t idx) { return joints[idx]; } @@ -388,6 +391,8 @@ class ofxKinect2::Body HandState left_hand_state; HandState right_hand_state; + TrackingConfidence left_hand_confidence, right_hand_confidence; + ofPoint jointToScreen(const JointType jointType, int x = 0, int y = 0, int w = ofGetWidth(), int h = ofGetHeight()); ofPoint bodyPointToScreen(const CameraSpacePoint& bodyPoint, int x = 0, int y = 0, int w = ofGetWidth(), int h = ofGetHeight()); }; @@ -422,6 +427,7 @@ class ofxKinect2::BodyStream : public Stream void drawHandRight(int x = 0, int y = 0, int w = ofGetWidth(), int h = ofGetHeight(), size_t idx = BODY_COUNT); void drawLean(int x = 0, int y = 0, int w = ofGetWidth(), int h = ofGetHeight(), size_t idx = BODY_COUNT); + ofVec4f getFloorClipPlane() const { return floor_clip_plane; } inline size_t getNumBodies() { return bodies.size(); } const vector getBodies() { return bodies; } @@ -449,6 +455,7 @@ class ofxKinect2::BodyStream : public Stream protected: DoubleBuffer pix; vector bodies; + ofVec4f floor_clip_plane; bool readFrame(); void setPixels(Frame frame);