Commit 57372eef authored by Pierre Bürki's avatar Pierre Bürki
Browse files

Merge branch 'automation-modifications' into 'develop'

Modifications for automation

Closes #24, #23, and #22

See merge request !13
parents 2334d8fb d22c1642
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@ void BlobFinder::initGUI(ofxGui &gui){
    blobGuiGroup->add(eyeInset.set("EyeInset", .8, 0, 1));
    
	panel->loadFromFile("trackings.xml");

	bool visible = false;
	panel->setVisible(visible);
}

void BlobFinder::allocate(int &value){
+5 −2
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ void SkeletonFinder::initGUI(ofxGui& gui) {
	panel = gui.addPanel();

	panel->loadTheme("theme/theme_light.json");
	panel->setName("Tracking...");
	panel->setName("Tracking");

	sensorBoxLeft.addListener(this, &SkeletonFinder::updateSensorBox);
	sensorBoxRight.addListener(this, &SkeletonFinder::updateSensorBox);
@@ -22,7 +22,7 @@ void SkeletonFinder::initGUI(ofxGui& gui) {
	sensorBoxBottom.addListener(this, &SkeletonFinder::updateSensorBox);

	sensorBoxGuiGroup = panel->addGroup("SensorBox");
	sensorBoxGuiGroup->add(filtering.set("Filtering", true));
	sensorBoxGuiGroup->add(filtering.set("Filtering", false));
	sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxLeft.set("left", 1000));
	sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxRight.set("right", -1000));
	sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxFront.set("front", 1000));
@@ -31,6 +31,9 @@ void SkeletonFinder::initGUI(ofxGui& gui) {
	sensorBoxGuiGroup->add<ofxGuiIntInputField>(sensorBoxBottom.set("bottom", 1000));

	panel->loadFromFile("trackings.xml");

	bool visible = false;
	panel->setVisible(visible);
}

void SkeletonFinder::setTransformMatrix(ofMatrix4x4* mat) {
+4 −34
Original line number Diff line number Diff line
@@ -169,8 +169,6 @@ void ofApp::setup(){
	nuitracker->run();
#endif
    
	bPreviewPointCloud = false;
    
	ofLog(OF_LOG_NOTICE) << "MainAPP: setting up networking...";
	networkMng.setup(gui);

@@ -179,8 +177,6 @@ void ofApp::setup(){
    capMesh.reSize(4);
    
	ofLog(OF_LOG_NOTICE) << "Setup over";

	lastSettingsWriteTime = boost::filesystem::last_write_time(networkSettingsPath);
}

//--------------------------------------------------------------
@@ -192,9 +188,6 @@ void ofApp::setupViewports(){
	device->setWidth(MENU_WIDTH / 2);
	device->setPosition(ofGetWidth() - MENU_WIDTH / 2, ofGetHeight() / 2);
#endif

	networkMng.panel->setWidth(MENU_WIDTH / 2);
	networkMng.panel->setPosition(ofGetWidth() - MENU_WIDTH / 2, 20);
}

#ifdef BLOB
@@ -249,15 +242,15 @@ void ofApp::update(){

	ofBackground(100, 100, 100);

	checkSettingsUpdate();

#ifdef BLOB
	if(realSense->update(ofxRealSenseTwo::PointCloud::VIDEO)) {

		if (bUpdateImageMask) {
		if (maskUpdatesCounter < MASK_UPDATE_CYCLES) {
			tracker.captureMaskBegin();
			drawCapturePointCloud(true);
			tracker.captureMaskEnd();

			maskUpdatesCounter++;
		} else {
			// Cature captureCloud to FBO
			tracker.captureBegin();
@@ -302,16 +295,6 @@ void ofApp::loadSettings()
#endif
}

void ofApp::checkSettingsUpdate() {
	std::time_t newLastWriteTime = boost::filesystem::last_write_time(networkSettingsPath);

	if (newLastWriteTime > lastSettingsWriteTime) {
		lastSettingsWriteTime = newLastWriteTime;

		loadSettings();
	}
}

void ofApp::draw() {
	ofSetColor(255, 255, 255);

@@ -460,13 +443,9 @@ void ofApp::createHelp(){
    helpStream << "press v -> to show visualizations\n";
	helpStream << "press 1 - 3 -> to change the viewport\n";
	helpStream << "press p -> to show pointcloud\n";
	helpStream << "\n";
    helpStream << "press h -> to show help \n";
    helpStream << "press s -> to save current settings.\n";
	helpStream << "press l -> to load last saved settings\n";
#ifdef BLOB
	helpStream << "press m -> to update mask image (currently" <<
		(bUpdateImageMask ? " " : " not ") << "updating)\n";
#endif

	help = helpStream.str();
}
@@ -500,15 +479,6 @@ void ofApp::keyPressed(int key){
            }
			break;
            
		case 'm':
#ifdef BLOB
			bUpdateImageMask = !bUpdateImageMask;
			if (bUpdateImageMask) {
				tracker.clearMask();
			}
#endif
			break;	
            
		case '1':
            iMainCamera = 0;
			break;
+5 −8
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#define REALSENSE_VIDEO_WIDTH   848
#define REALSENSE_VIDEO_HEIGHT  480

#define MASK_UPDATE_CYCLES 100
#define N_MEASURMENT_CYCLES 10

using namespace std;
@@ -77,7 +78,7 @@ public:
	ofTrueTypeFont  monosm;
	vector<ofPoint> stroke;

    bool bShowVisuals = true;
    bool bShowVisuals = false;

    //////////////////
    //    NETWORK   //
@@ -113,7 +114,7 @@ public:

    ofShader shader;
    BlobFinder tracker;
    bool bUpdateImageMask = false;
    int maskUpdatesCounter = 0;

#else

@@ -129,7 +130,7 @@ public:

    bool dispRaw;

    bool bPreviewPointCloud;
    bool bPreviewPointCloud = false;
        
    CaptureMeshArray capMesh;
	
@@ -170,10 +171,6 @@ public:
    void saveSettings();
    void loadSettings();  

    void checkSettingsUpdate();
    const boost::filesystem::path networkSettingsPath = ofFilePath::getAbsolutePath("broadcast.xml");
    std::time_t lastSettingsWriteTime;    

    //////////
    // HELP //
    //////////