@Gallo wrote:
Hello,
I am stuck in my project. A bit hard to explain but i will try to make it clear.
I am using a kinect to detect blobs.
I have two classes.one that handles the kinect sensor :
class kinectTracker { public: kinectTracker(); ~kinectTracker(); void setup(); void update(); void draw(); void draw(float _x, float _y, float _w, float _h); void drawDepth(); void drawDepth(float _x, float _y, float _w, float _h); int getNbBlobs(); ROI roi; //---------- Parameters ----------// ofParameterGroup parameters; ofParameter<float> nearThreshValue; ofParameter<float> farThreshValue; ofParameter<float> minBlobSize; ofParameter<bool> bDilate; ofParameter<bool> bErode; ofParameter<int> nbDilate; ofParameter<int> nbErode; ofParameter<ofVec3f> pos; // x, y and z position of blob private: ofxKinect kinect; //---------- blob tracking with ofxKinect and ofxOpenCV ----------// ofxCvGrayscaleImage depthImage; // grayscale depth image ofxCvGrayscaleImage nearThresholdImage; ofxCvGrayscaleImage farThresholdImage; ofxCvContourFinder contourFinder; // blob detection };
and one to handle the ROI :
class ROI : public ofBaseDraws, public ofRectangle { public: void draw(float _x,float _y) { draw(_x, _y, getWidth(), getHeight()); } void draw(float _x,float _y,float w, float h) { ofPushMatrix(); ofTranslate(_x, _y); ofScale(w/CAM_WIDTH, h/CAM_HEIGHT); ofPushStyle(); ofSetColor(255, 0, 0); ofNoFill(); ofSetLineWidth(1); ofRect(*this); ofPopStyle(); ofPopMatrix(); } float getWidth() { return CAM_WIDTH; } float getHeight() { return CAM_HEIGHT; } };
Class ROI handles and draw region of interest in order to select a detection area.
As you can see this ROI integrates an ofRect to set and draw this area.In ofApp i use a kinectTracker object
kinectTracker cvKinect;
I would like to be able to change the values of the ofRect from the ofApp with ofxGui using ofParameter if possible.
I was able to use the GUI to change kinect parameters using ofParameterGroup but i don't know how to "publish" ROI parameters to access them from the ofApp GUI...
I had a previous version of this app using ofxUI instead of ofxGui and i was able to change ROI coordinates using
configUI1->addSlider("ROI - position X", 0.f, CAM_WIDTH, &cvKinect.roi.x); configUI1->addSlider("ROI - position Y", 0.f, CAM_HEIGHT, &cvKinect.roi.y); configUI1->addSlider("ROI - width", 0.f, CAM_WIDTH, &cvKinect.roi.width); configUI1->addSlider("ROI - height", 0.f, CAM_HEIGHT, &cvKinect.roi.height);
Hope i made myself clear.
any contribution appreciated.
thanks a lot
Posts: 3
Participants: 2