Example #1
0
//--------------------------------------------------------------
void ofApp::setup(){
	
	laserWidth = 800;
	laserHeight = 800;
	laser.setup(laserWidth, laserHeight);
	laser.connectToEtherdream();

	
	ofxGuiSetDefaultWidth(300);
	laserGui.setup();
	laserGui.add(laser.parameters);
	
	laserGui.add(laser.redParams);
	laserGui.add(laser.greenParams);
	laserGui.add(laser.blueParams);

	laserGui.loadFromFile("laserSettings.xml");

	laserGui.setPosition(laserWidth+50, 0);
	
	
	//laserGui.setWidthElements(400);
	currentLaserEffect = 0;
	numLaserEffects = 8;
	
}
Example #2
0
//--------------------------------------------------------------
void ofApp::setup(){
    ofSetLogLevel(OF_LOG_VERBOSE);
    
    // enable depth->video image calibration
    kinect.setRegistration(true);
    kinect.init();
    
    kinect.open(0);		// opens first available kinect
    //kinect.open(2);	// open a kinect by id, starting with 0 (sorted by serial # lexicographically))
    //kinect.open("A00362A08602047A");	// open a kinect using it's unique serial #
    
    colorImg.allocate(kinect.width, kinect.height);
    grayImage.allocate(kinect.width, kinect.height);
    grayThreshNear.allocate(kinect.width, kinect.height);
    grayThreshFar.allocate(kinect.width, kinect.height);
    
    bThreshWithOpenCV = true;
    
    ofSetFrameRate(60);
    
    // open an outgoing connection to HOST:PORT
    sender.setup(HOST, PORT);
    receiver.setup(RECEIVE_PORT);
    
    ofxGuiSetDefaultWidth(300);
    panel.setup("kinect settings", "settings.xml", 540, 100);
    panel.add(minDistance.setup("minDistance",500,500,12000));
    panel.add(maxDistance.setup("maxDistance",6000,500,12000));
    panel.add(nearThreshold.setup("nearThreshold",128,0,255));
    panel.add(farThreshold.setup("farThreshold",128,0,255));
    panel.add(minDetectSize.setup("minDetectSize",2,0,4000));
    panel.add(maxDetectSize.setup("maxDetectSize",1000,0,100000));
    panel.add(maxDetectNumber.setup("maxDetectNumber",10,0,300));
    panel.add(lowPassValue.setup("lowPassValue",0,0,1));
    panel.add(blurValue.setup("blurValue",0,0,40));
    panel.add(idolBlue.set("idolBlue",  false));
    panel.add(idolRed.set("idolRed",  false));
    panel.add(audBlue.set("audBlue", false));
    panel.add(audRed.set("audRed", false));
    panel.add(resetButton.setup("reset"));
    panel.loadFromFile("settings.xml");
    
    resetButton.addListener(this,&ofApp::resetButtonPressed);
    lowPassValue.addListener(this, & ofApp::onLowPassValueChanged);
    minDistance.addListener(this, &ofApp::onMinDistanceChanged );
    maxDistance.addListener(this, &ofApp::onMaxDistanceChanged );
    idolBlue.addListener(this, &ofApp::onIdolChanged );
    idolRed.addListener(this, &ofApp::onIdolChanged );
    audRed.addListener(this, &ofApp::onAudRedChanged );
    audBlue.addListener(this, &ofApp::onAudBlueChanged );
    minDetectSize.addListener(this, &ofApp::onValueChanged );
    maxDetectSize.addListener(this, &ofApp::onValueChanged );
    maxDetectNumber.addListener(this, &ofApp::onValueChanged );
    blurValue.addListener(this, &ofApp::onValueChanged );
    kinect.setDepthClipping(minDistance,maxDistance);
    
}
Example #3
0
//--------------------------------------------------------------
void ofApp::setup(){
    ofBackground(0,0,0);
    ofEnableSmoothing();
    
    ofSetFrameRate(60);
    videoWidth =  640;
    videoHeight = 480;
    
    
    setVideoSize();
    if(MOVIE_DEBUG_MODE){
        //movie
        movie.loadMovie("debugmov1.mov");
        movie.play();
    }else {
        //Setting of WebCam
        cam.setVerbose(true);
        cam.setDeviceID(USE_CAMERA_ID);
        cam.initGrabber(actVideoWidth, actVideoHeight);
    }
    
    //setup of gui
    int guiMargin = 10;
    float guiW = 300;
    float guiH = ofGetHeight() - guiMargin*2;
    ofxGuiSetDefaultWidth(guiW);
    ofxGuiSetDefaultHeight(18);
    
    gui.setup();
    gui.add(minRadius.setup("MinRadius", 1, 10, 50));
    gui.add(maxRadius.setup("MaxRadius", 100, 10, 500));
    gui.add(minArea.setup("minArea",10,0,50));
    gui.add(maxArea.setup("maxArea",5500,40,5500));
    gui.add(mThreshold.setup("Threshold", 15, 0, 255));
    gui.setPosition(guiMargin, guiMargin);
    
    
    contourFinder.setMinAreaRadius(minRadius);
    contourFinder.setMaxAreaRadius(maxRadius);
    contourFinder.setThreshold(mThreshold);
    // wait for half a frame before forgetting something
    contourFinder.getTracker().setPersistence(15);
    // an object can move up to 32 pixels per frame
    contourFinder.getTracker().setMaximumDistance(32);
    
    showLabels = true;
    
    
    //指定したIPアドレスとポート番号でサーバーに接続
    sender.setup( HOST, PORT );
}
Example #4
0
//-----------------------------------------------------------------------------------------
//
void ofApp::setup()
{
	//ofSetLogLevel( OF_LOG_VERBOSE );
	
	ofSetFrameRate( 60 );
	
	fontSmall.loadFont("Fonts/DIN.otf", 8 );
	
	ofxGuiSetDefaultWidth( 300 );

	int texSize = 128;
	particles.init( texSize ); // number of particles is (texSize * texSize)
	
	// Give us a starting point for the camera
	camera.setNearClip(0.01f);
	camera.setPosition( 0, 0.4, 1.0 );
	camera.setMovementMaxSpeed( 0.01f );

	time = 0.0f;
	timeStep = 1.0f / 60.0f;
	
	drawGui = false;
}
Example #5
0
//--------------------------------------------------------------
void ofApp::setup(){
	
	laserWidth = 800;
	laserHeight = 800;
	laser.setup(laserWidth, laserHeight);
	laser.connectToEtherdream();

	
	ofxGuiSetDefaultWidth(250);
	laserGui.setup(laser.parameters);
	laserGui.setPosition(laserWidth+50, 0);
	
	laserGui.loadFromFile("laserSettings.xml");
	
	redGui.setup("Laser Red");
	redGui.add(laser.redParams );
	greenGui.setup("Laser Green", "lasergreen.xml");
	greenGui.add(laser.greenParams );
	blueGui.setup("Laser Blue", "laserblue.xml");
	blueGui.add(laser.blueParams );
	
	redGui.loadFromFile("laserred.xml");
	greenGui.loadFromFile("lasergreen.xml");
	blueGui.loadFromFile("laserblue.xml");

	
	int panelwidth  = 260;
	redGui.setPosition(ofPoint(10 ,10));
	greenGui.setPosition(ofPoint(10 +panelwidth + 10,10));
	blueGui.setPosition(ofPoint(10 +panelwidth*2 + 20,10));

	
	//gui.setWidthElements(400);
	
	
}
Example #6
0
// ------------------------------------------------------------------------------------------------------
//
void ofApp::setup()
{
	ofBackground( ofColor::white );
	
	ofSetLogLevel(OF_LOG_VERBOSE);
	
	fontSmall.loadFont("Fonts/DIN.otf", 8 );
	
	currAppMode = APP_MODE_LIVE;

	ofxGuiSetFont( "Fonts/DIN.otf", 8 );
	ofxGuiSetDefaultWidth( 260 );

	// Set up UI
	string xmlSettingsPath = "Settings/Main.xml";
	gui.setup( "Main", xmlSettingsPath );
	
	gui.add( kinectPointCloudScale.set( "Kinect Point Cloud Scale", 0.05, 0.0, 1.0 ) );
	gui.add( kinectPointCloudOffset.set( "Kinect Point Cloud Offset", ofVec3f(0,0,0), ofVec3f(-500,-500,-500), ofVec3f(500,500,500) ) );
	
	gui.add( globalAmbient.set("Global Ambient", ofColor(50,50,50), ofColor(0,0,0,0), ofColor(255,255,255,255)) );
	gui.add( light1Position.set( "Light 1 Position", ofVec3f(-5,50,0), ofVec3f(-200,0,-200), ofVec3f(200,400,200) ) );
	gui.add( light1Diffuse.set("Light 1 Diffuse",   ofColor(50,50,50), ofColor(0,0,0,0), ofColor(255,255,255,255)) );
	gui.add( light1Ambient.set("Light 1 Ambient",   ofColor(50,50,50), ofColor(0,0,0,0), ofColor(255,255,255,255)) );
	gui.add( light1Specular.set("Light 1 Specular", ofColor(255,255,255), ofColor(0,0,0,0), ofColor(255,255,255,255)) );

	gui.add( drawPointCloud.set( "Draw Point Cloud", false ) );

	//gui.add( testPos.set( "Test Pos", ofVec3f(-5,50,0), ofVec3f(-200,0,-200), ofVec3f(200,400,200) ) );

	gui.loadFromFile( xmlSettingsPath );
	gui.minimizeAll();
	
	kinectManager.init();
	
	particles.init(); // number of particles is (texSize * texSize)
	
	ofVec2f guiPos = gui.getPosition();
	particles.gui.setPosition( guiPos + ofVec2f( gui.getWidth() + 10, 0) );
	
	// Give us a starting point for the camera
	camera.setNearClip( 0.01f );
	camera.setPosition( 0, 50, 100.0 );
	camera.setMovementMaxSpeed( 1.0f );
	
	pointCloudMesh.setMode( OF_PRIMITIVE_POINTS );
	
	time = 0.0f;
	timeStep = 1.0f / 60.0f;
	
	light[0].enable();

	opticalFlowDebugDrawer.init();
	opticalFlowDebugDrawer.getGui()->setPosition( gui.getPosition() + ofVec2f( 0, gui.getHeight() + 10) );
	
	ofSetLogLevel(OF_LOG_NOTICE);
	
	drawUI = false;
	
	//ofHideCursor();
}