Loading src/SkeletonFinder.cpp +16 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ void SkeletonFinder::initGUI(ofxGui& gui) { sensorBoxBottom.addListener(this, &SkeletonFinder::updateSensorBox); sensorBoxGuiGroup = panel->addGroup("SensorBox"); sensorBoxGuiGroup->add(filtering.set("Filtering", true)); sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxLeft.set("left", 1000)); sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxRight.set("right", -1000)); sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxFront.set("front", 1000)); Loading Loading @@ -50,7 +51,11 @@ void SkeletonFinder::update(nuitrack::SkeletonData::Ptr data) { joints.push_back(Joint(joint.type, joint.confidence, pos)); } skeletons.push_back(Skeleton(skel.id, joints)); Skeleton skeleton(skel.id, joints); if (!filtering.get() || isSkeletonInBounds(skeleton)) { skeletons.push_back(skeleton); } } } Loading Loading @@ -168,3 +173,13 @@ void SkeletonFinder::updateSensorBox(int& value) { //captureCam.setPosition(5, 5, 0); //captureCam. } bool SkeletonFinder::isSkeletonInBounds(const Skeleton& skel) { glm::vec3 headPos = skel.joints[nuitrack::JOINT_HEAD].pos; return headPos.x < sensorBoxLeft.get() * SCALE && headPos.x > sensorBoxRight.get() * SCALE && headPos.y < sensorBoxFront.get()* SCALE && headPos.y > sensorBoxBack.get() * SCALE && headPos.z < sensorBoxTop.get()* SCALE && headPos.z > sensorBoxBottom.get() * SCALE; } src/SkeletonFinder.h +3 −2 Original line number Diff line number Diff line Loading @@ -62,8 +62,6 @@ public: void setTransformMatrix(ofMatrix4x4* mat); void update(nuitrack::SkeletonData::Ptr data); void updateSensorBox(int & value); void drawSensorBox(); void drawSkeletons2d(ofRectangle _rect); void drawSkeletons(); Loading @@ -73,6 +71,8 @@ public: vector<Skeleton> getSkeletons(); private: void updateSensorBox(int & value); bool isSkeletonInBounds(const Skeleton& skel); ofxnui::TrackerRef tracker; vector<Skeleton> skeletons; Loading @@ -83,6 +83,7 @@ public: ofxGuiPanel *panel; ofxGuiGroup *sensorBoxGuiGroup; ofParameter<bool> filtering; ofParameter<int> sensorBoxLeft; ofParameter<int> sensorBoxRight; ofParameter<int> sensorBoxTop; Loading Loading
src/SkeletonFinder.cpp +16 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ void SkeletonFinder::initGUI(ofxGui& gui) { sensorBoxBottom.addListener(this, &SkeletonFinder::updateSensorBox); sensorBoxGuiGroup = panel->addGroup("SensorBox"); sensorBoxGuiGroup->add(filtering.set("Filtering", true)); sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxLeft.set("left", 1000)); sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxRight.set("right", -1000)); sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxFront.set("front", 1000)); Loading Loading @@ -50,7 +51,11 @@ void SkeletonFinder::update(nuitrack::SkeletonData::Ptr data) { joints.push_back(Joint(joint.type, joint.confidence, pos)); } skeletons.push_back(Skeleton(skel.id, joints)); Skeleton skeleton(skel.id, joints); if (!filtering.get() || isSkeletonInBounds(skeleton)) { skeletons.push_back(skeleton); } } } Loading Loading @@ -168,3 +173,13 @@ void SkeletonFinder::updateSensorBox(int& value) { //captureCam.setPosition(5, 5, 0); //captureCam. } bool SkeletonFinder::isSkeletonInBounds(const Skeleton& skel) { glm::vec3 headPos = skel.joints[nuitrack::JOINT_HEAD].pos; return headPos.x < sensorBoxLeft.get() * SCALE && headPos.x > sensorBoxRight.get() * SCALE && headPos.y < sensorBoxFront.get()* SCALE && headPos.y > sensorBoxBack.get() * SCALE && headPos.z < sensorBoxTop.get()* SCALE && headPos.z > sensorBoxBottom.get() * SCALE; }
src/SkeletonFinder.h +3 −2 Original line number Diff line number Diff line Loading @@ -62,8 +62,6 @@ public: void setTransformMatrix(ofMatrix4x4* mat); void update(nuitrack::SkeletonData::Ptr data); void updateSensorBox(int & value); void drawSensorBox(); void drawSkeletons2d(ofRectangle _rect); void drawSkeletons(); Loading @@ -73,6 +71,8 @@ public: vector<Skeleton> getSkeletons(); private: void updateSensorBox(int & value); bool isSkeletonInBounds(const Skeleton& skel); ofxnui::TrackerRef tracker; vector<Skeleton> skeletons; Loading @@ -83,6 +83,7 @@ public: ofxGuiPanel *panel; ofxGuiGroup *sensorBoxGuiGroup; ofParameter<bool> filtering; ofParameter<int> sensorBoxLeft; ofParameter<int> sensorBoxRight; ofParameter<int> sensorBoxTop; Loading