//--------------------------------------------------------------
void testApp::setup(){

	ofBackground(0,0,0);
    ofEnableSmoothing();
    ofSetWindowTitle("fromProcessing");
    ofSetFrameRate(50);


    //Ball Size
xBall = 50;
yBall = 50;

//Initial Position of BallA
xPosA = 25;
yPosA = 25;

//Initial Position of BallB
xPosB = 400;
yPosB = 25;

//Initial Position of Ball C
xPosC = 775;
yPosC = 50;

//Velocity of the Balls
xVelA = 10;
yVelA = 5;
xVelB = 5;
yVelB = 10;
xVelC = 10;
yVelC = 5;

//Verrazano Bridge Bounding Box
xVrrznPos = 300;
yVrrznPos = 350;
xVrrzn = 200;
yVrrzn = 450;


ofTrueTypeFont::setGlobalDpi(72);
verdana14.loadFont("verdana.ttf", 14, true, true);
	verdana14.setLineHeight(18.0f);
	verdana14.setLetterSpacing(1.037);

}
Пример #2
0
//--------------------------------------------------------------
void ofApp::setup(){

    ofSetWindowTitle("NebulaLEDs");
    
    
    std::vector<ofx::IO::SerialDeviceInfo> devicesInfo = ofx::IO::SerialDeviceUtils::listDevices();
    
    ofLogNotice("ofApp::setup") << "Connected Devices: ";
    
    for (std::size_t i = 0; i < devicesInfo.size(); ++i)
    {
        ofLogNotice("ofApp::setup") << "\t" << devicesInfo[i];
    }
    
    if (!devicesInfo.empty())
    {
        // Connect to the first matching device.
        bool success = device.setup(devicesInfo[0], 115200);
        
        if(success)
        {
            device.registerAllEvents(this);
            
            ofLogNotice("ofApp::setup") << "Successfully setup " << devicesInfo[0];
        }
        else
        {
            ofLogNotice("ofApp::setup") << "Unable to setup " << devicesInfo[0];
        }
    }
    else
    {
        ofLogNotice("ofApp::setup") << "No devices connected.";
    }
    
    // open an outgoing connection to HOST:PORT
    sender.setup(HOST, PORT);
    
    mClient.setup();
    
    mClient.set("Fond","Max");

    ofSetFrameRate(60); // if vertical sync is off, we can go a bit fast... this caps the framerate at 60fps.
    
}
Пример #3
0
//--------------------------------------------------------------
void testApp::keyReleased(int key) {
    //press any key to move through all available Syphon servers
    dirIdx++;
    if(dirIdx > dir.size() - 1)
        dirIdx = 0;

    client.set(dir.getDescription(dirIdx));
    string serverName = client.getServerName();
    string appName = client.getApplicationName();

    if(serverName == "") {
        serverName = "null";
    }
    if(appName == "") {
        appName = "null";
    }
    ofSetWindowTitle(serverName + ":" + appName);
}
Пример #4
0
//--------------------------------------------------------------
void testApp::setup() {
    ofSetWindowTitle("ofxSyphonServerDirectoryExample");
    ofSetWindowShape(800, 600);
    ofSetFrameRate(60);

    //setup our directory
    dir.setup();
    //setup our client
    client.setup();

    //register for our directory's callbacks
    ofAddListener(dir.events.serverAnnounced, this, &testApp::serverAnnounced);
    // not yet implemented
    //ofAddListener(dir.events.serverUpdated, this, &testApp::serverUpdated);
    ofAddListener(dir.events.serverRetired, this, &testApp::serverRetired);

    dirIdx = -1;
}
Пример #5
0
//--------------------------------------------------------------
void ofApp::setup(){

	ofBackground(255,255,255);
	ofSetVerticalSync(true);

    // SPOUT
	bInitialized = false; // Spout sender initialization
	strcpy(sendername, "OF Spout Webcam Sender"); // Set the sender name
	ofSetWindowTitle(sendername); // show it on the title bar

    // Webcam setup for a sender
	vidGrabber.setDeviceID(0);
	vidGrabber.setDesiredFrameRate(30); // try to set this frame rate
	vidGrabber.initGrabber(640, 480); // try to grab at this size. 
	ofSetWindowShape(vidGrabber.getWidth(), vidGrabber.getHeight());
	cout << "Initialized webcam (" << vidGrabber.getWidth() << " x " << vidGrabber.getHeight() << ")" << endl;

}
Пример #6
0
//--------------------------------------------------------------
void testApp::setup(){
    ofSetDataPathRoot("./");
	ofSetCircleResolution(50);
	ofBackground(0, 0, 0);
	ofSetWindowTitle("ofxOP1 example");

	ofSetFrameRate(60); // if vertical sync is off, we can go a bit fast... this caps the framerate at 60fps.
    
//    ofHideCursor();
    op1.setDimensions(ofGetWidth()/2, ofGetHeight()/2, ofGetWidth()-200);
    
    
//    cout << "cwd is "<<getcwd()<<"\n";
    
//    verdana.loadFont("verdana.ttf",80, true, true);
    ofAddListener(op1.midiEvent, this, &testApp::op1Event);
    
}
Пример #7
0
//--------------------------------------------------------------
void testApp::setup(){
    
    // Syphon init
    ofSetWindowTitle("Generic IO");
    mainOutput.setName("GenericIO_Output");
    
    //render reset
    ofBackground(0);
    ofSetVerticalSync( TRUE );
    ofEnableAlphaBlending();
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    ofSetBackgroundAuto(TRUE);
    ofSetFrameRate(60);

    //debug and beta
    counter = 0;
	ofSetCircleResolution(50);
}
Пример #8
0
//--------------------------------------------------------------
void testApp::update(){
    
    Tweenzor::update( ofGetElapsedTimeMillis() ) ;
	//lets scale the vol up to a 0-1 range 
	
    Tweenzor::add( &scaledVol , scaledVol , ofMap(smoothedVol, 0.0, 0.17, 0.0, 1.0, true ) , 0.0f , 0.02f , EASE_LINEAR ) ; 
    //scaledVol = ofMap(smoothedVol, 0.0, 0.17, 0.0, 1.0, true );
    
	//lets record the volume into an array
	volHistory.push_back( scaledVol );
	
	//if we are bigger the the size we want to record - lets drop the oldest value
	if( volHistory.size() >= 400 ){
		volHistory.erase(volHistory.begin(), volHistory.begin()+1);
	}
    
    ofSetWindowTitle( "FPS: " + ofToString( ofGetFrameRate() ) ) ; 
}
Пример #9
0
//--------------------------------------------------------------
void testApp::update(){
    ofSetWindowTitle(ofToString(ofGetFrameRate()));

    //  Do the FFT
    //
    float avg_power = 0.0f;
	myFft.powerSpectrum(0,(int)bufferSize/2, left, bufferSize, magnitude, phase, power, &avg_power);
	for (int i = 0; i < (int)(bufferSize/2); i++){
		freq[i] = magnitude[i];
	}
    FFTanalyzer.calculate(freq);
    
    for (int i = 0; i < storedLines.size(); i++){
        storedLines[i].updateBox();
    }
    
    player.update();
}
Пример #10
0
//--------------------------------------------------------------
void ofApp::update(){
    
    std::stringstream strm;
    strm << "fps: " << ofGetFrameRate();
    ofSetWindowTitle(strm.str());
    
    //
    
    static bool bTrackerInit = false;

    kinect.update();

    
    // there is a new frame and we are connected
    if(kinect.isFrameNew()) {
        
        if (!bTrackerInit) {
            bTrackerInit = true;
            tracker.init(&kinect, false);
            tracker.setScale(ofVec3f(0.001));
        }
        
        // load grayscale depth image from the kinect source
        depthImg.setFromPixels(kinect.getDepthPixels());
        
        // or we do it ourselves - show people how they can work with the pixels
        ofPixels & pix = depthImg.getPixels();
        int numPixels = pix.size();
        for(int i = 0; i < numPixels; i++) {
            if(pix[i] < thresholdNear && pix[i] > thresholdFar) {
                pix[i] = 255;
            } else {
                pix[i] = 0;
            }
        }
        
    }
    
    if (tracker.isInited()) {
        tracker.findBlobs(&depthImg, boxMin, boxMax, thresh3D, thresh2D, minVol, maxVol, minPoints, maxBlobs);
        trackedBlobs = tracker.nBlobs;
    }

}
Пример #11
0
//--------------------------------------------------------------
void ofApp::setup(){
    ofSetLogLevel(OF_LOG_VERBOSE);
    ofSetVerticalSync(true);
    ofSetFrameRate(60);
    ofSetWindowTitle("Atiko7 Kinect Particles");
    ofDisableArbTex();
    spriteImg.load("sprite.png");
    
    mesh.setMode(OF_PRIMITIVE_POINTS);
    
    gui.setup();
    gui.add(guiLife1.setup("Life1", 18, 0, 50));
    gui.add(guiSize1.setup("Size1", 7, 1, 30));
//    gui.add(guiLife2.setup("Life2", 18, 0, 50));
//    gui.add(guiSize2.setup("Size2", 7, 1, 30));
    
    for(int i=0; i<maxPS; i++){
        ps.push_back(ParticleSystem(1, lifeDec1));
    }
    indices.assign(maxPS, 0);
    
    int a = 0;
    for (int i = 0; i < indices.size(); i++) {
        a +=steps+ ofRandom(0, 10);
        indices[i]=a;
        mesh.addColor(gColor);
        mesh.addVertex(ofVec3f(ps[i].particles[0].pos.x, ps[i].particles[0].pos.y, 0));
    }

    if (useKinect){
        niContext.setup();
        niDepthGenerator.setup( &niContext );
        niImageGenerator.setup( &niContext );
        niUserGenerator.setup( &niContext );
        niUserGenerator.setUseMaskPixels(true);
        niUserGenerator.setUseCloudPoints(true);
        niContext.setMirror(true);
        niContext.registerViewport();
    }
    userpixels.allocate(640, 480, 1);
    myImage.allocate(640, 480, OF_IMAGE_GRAYSCALE);
    myImage2.allocate(640, 480, OF_IMAGE_COLOR);

}
Пример #12
0
//--------------------------------------------------------------
void TuioKinect::setup()
{
	ofSetWindowTitle("TuioKinect");
	
	kinect.init();
	kinect.setVerbose(true);
	kinect.open();
	
	depthImage.allocate(kinect.width, kinect.height);
	grayImage.allocate(kinect.width, kinect.height);
	colorImage.allocate(kinect.width, kinect.height);
	redImage.allocate(kinect.width, kinect.height);

	nearThreshold = 160;
	farThreshold  = 180;
	//farThreshold  = 100;

	TuioTime::initSession();	
	tuioServer = new TuioServer();
	tuioServer->setSourceName("TuioKinect");
	tuioServer->enableObjectProfile(false);
	tuioServer->enableBlobProfile(false);
	
	for (int i=0;i<32;i++)
		tuioPointSmoothed[i] = NULL;
	
	kCursors[0] = ofPoint() ; 
	kCursors[1] = ofPoint() ; 
	
	//box2D setup
	box2d.init();
	box2d.setGravity(0, 10);
	box2d.doSleep = true ; 
	box2d.bCheckBounds = true ; 
	box2d.createFloor();
	box2d.checkBounds(true);
	box2d.createBounds(0, 0, ofGetWidth(), ofGetHeight() ) ; 
	box2d.getWorld()->SetContactListener( &contacts );		// register contact class.
	box2d.setFPS(30.0);
	holdingLength = 0 ; 
	curToReplace = 0 ; 
	ofSetFrameRate(30);

}
Пример #13
0
//--------------------------------------------------------------
void ofApp::setup() {
    ofSetWindowTitle("Port of 12301");
    ofBackground(0);
    
    tileCountX = 50;
    tileCountY = 10;
    hue.resize(tileCountX);
    sat.resize(tileCountX);
    bri.resize(tileCountX);
    
    W = ofGetWidth();
    H = ofGetHeight();
    
    for (int i = 0; i < tileCountX; i++) {
        hue[i] = ofRandom(0, 255);
        sat[i] = ofRandom(0, 255);
        bri[i] = ofRandom(0, 255);
    }
}
Пример #14
0
//--------------------------------------------------------------
void mainApp::setup(){
  // Load data from the specified
  load_emotions(this->data_path);
  load_expressions(this->data_path);

  // Set the window properties
  ofSetWindowTitle("upload");
  ofSetFrameRate(60);
  ofSetFullscreen(true);
  ofHideCursor();

  // Set the background colour
  ofColor col;
  background_colour(col);
  ofBackground(col.r, col.g, col.b);

  // Start the twitter search thread to drive the emotion state
  start_twitter_search();
} 
Пример #15
0
//--------------------------------------------------------------
void ofApp::setup(){

	ofSetVerticalSync(true);
	ofBackground(ofColor::darkGray);
	ofSetWindowTitle("Millis");
	ofSetCircleResolution(50);
	
	// red circle
	redX = ofGetWidth()/2;
	redY = ofGetHeight()/2;
	redMillis = 0; // init timestamp
	showRed = false; // don't show yet
	
	// green circle
	greenX = ofRandom(20, ofGetWidth()-20);
	greenY = ofRandom(20, ofGetHeight()-20);
	greenMillis = 0;
	moveGreen = true;
}
Пример #16
0
void ofApp::update()
{
  ofSetWindowTitle(ofToString(ofGetFrameRate(),2));

  kinect.update(); 
  rgb_cam.update();

  if ( !kinect.isFrameNew() && !rgb_cam.isFrameNew() ) return;

  if ( kinect.isFrameNew() )
    pix_kinect_rgb = kinect.getPixelsRef(); //copy

  if ( rgb_cam.isFrameNew() )
  {
    pix_rgb = rgb_cam.getPixelsRef(); //copy
  }

  calibration.update( pix_kinect_rgb, pix_rgb );
}
Пример #17
0
//--------------------------------------------------------------
void ofApp::update()
{
    
    // Adding temporal Force
    //
    /*
    ofPoint m = ofPoint(mouseX,mouseY);
    ofPoint d = (m - oldM) * 10.0;
    oldM = m;
    ofPoint c = ofPoint(640 * 0.5, 480 * 0.5) - m;
    c.normalize();
    */
    
    dir.x = ofRandomf() * 1.57;
    pos.x = (width / 2.0) + (ofRandomf() * 0.5);
    
    rad += ofRandomf() * 0.004;
    temp += ofRandomf() * 0.0046;
    den += ofRandomf() * 0.48;
    
    if(isDrawS && !isPaused)
        fluid.addTemporalForce(pos, dir, ofFloatColor(0.12, 0.09, 0.09), rad, temp, den);
    
    if(isPaused)
        pCount += ofGetFrameRate() / 60;
    if(pCount >= pTime)
    {
        pCount = 0;
        isPaused = false;
    }
    
    if(!isStatA)
        ofSetWindowShape(width, height - 58.0);
    else
        ofSetWindowShape(width + 58.0, height - 58.0);
    
    //  Update
    //
    fluid.update();
    
    ofSetWindowTitle(ofToString(ofGetFrameRate()));
    
}
Пример #18
0
//--------------------------------------------------------------
void ofApp::update()
{
    ofSetWindowTitle("ofxOPC:NeoPixelStick: FPS: " +ofToString((int)(ofGetFrameRate())));
    
    stick.grabImageData(ofPoint(ofGetWidth()/2,ofGetHeight()/2-(4*5)));
    
    stick.update();
    
    // If the client is not connected do not try and send information
    if (!opcClient.isConnected())
    {
        // Will continue to try and reconnect to the Pixel Server
    }
    else
    {
        // Write out the first set of data
        opcClient.writeChannelOne(stick.colorData());
    }
}
Пример #19
0
//--------------------------------------------------------------
void testApp::update(){
    
    //create some test data
    int length = 512;
    unsigned char data[length];
    activeValue = ofClamp(( (float)ofGetMouseX()/ofGetWidth() ) *255, 0, 255);
    for (int i=0; i<length; i++) data[i] = activeValue;
    
    ofBackground(activeValue);
    
    //update universe data - can be unsigned char * of pixels
    node.updateDataByIndex(activeIndex, data, length);
    //node.updateData(data, length);//can be called if only using one universe
    
    //send
    node.send();

    ofSetWindowTitle(ofToString(ofGetFrameRate(),2));
}
Пример #20
0
void ofApp::update()
{
	ofSetWindowTitle("shader: " + renderer->shaderName + " (" + renderer->shaderVersion + ") [uplr, 1-4, f, r, v]");

	timeCurrent = ofGetElapsedTimef();
	timeElapsed = timeCurrent - timeLast;
	timeLast = timeCurrent;

	if(isKeyPressUp)
		renderer->zOffset += renderer->zDelta * timeElapsed;
	if(isKeyPressDown)
		renderer->zOffset -= renderer->zDelta * timeElapsed;
	if(isKeyPressLeft)
		renderer->xOffset += renderer->xDelta * timeElapsed;
	if(isKeyPressRight)
		renderer->xOffset -= renderer->xDelta * timeElapsed;

	renderer->update();
}
Пример #21
0
//--------------------------------------------------------------
void ofApp::setup(){
    
    ofBackground(0,0,0);
    ofEnableSmoothing();
    ofSetVerticalSync(true);
    ofEnableDepthTest();
    
    mesh.setMode(OF_PRIMITIVE_POINTS);
    //mesh.setMode(OF_PRIMITIVE_LINE_LOOP);
    //mesh.setMode(OF_PRIMITIVE_LINES);
    glPointSize(0.1);
    
    ofSetWindowTitle("sketch_20150924");
    
    count = 0;
    mesh.clear();
    
    float scale = 0.01;
    float _pow0 = 50;
    float _pow1 = 100;
    for( int i = 0; i < 500000; i++ )
    {
        float _rad0 = ofRandom( 0, TWO_PI );
        float _rad1 = ofRandom( 0, TWO_PI );
        
        float _r = cos( _rad0 ) * _pow0;
        
        float y = sin( _rad0 ) * _pow0;
        float x = cos( _rad1 ) * _r;
        float z = sin( _rad1 ) * _r;
        
        mesh.addVertex(ofVec3f(x,y,z));
        
        _r = cos( _rad0 ) * _pow1;
        
        y = sin( _rad0 ) * _pow1;
        x = cos( _rad1 ) * _r;
        z = sin( _rad1 ) * _r;
        mesh.addVertex(ofVec3f(x,y,z));
    }
    
    
}
Пример #22
0
//--------------------------------------------------------------
void ofApp::update(){
	ofSetWindowTitle("oF Application: " + ofToString(ofGetFrameRate(), 1));
	uDeltaTime = ofGetElapsedTimef() - uElapsedTime;
	uElapsedTime = ofGetElapsedTimef();
	
	for (auto& b : bundles)
		b.receiver.receive(b.texture);

	mFbo->begin();
	auto viewport = ofGetCurrentViewport();
	ofClear(0);
	for (int i = 0; i < bundles.size(); i++)
	{
		auto& b = bundles[i];
		if (b.texture.isAllocated())
			b.texture.draw(screen_width * i, 0, screen_width, screen_height);
	}
	mFbo->end();
}
Пример #23
0
//--------------------------------------------------------------
void imageLoader::setup(){
    ofSetWindowTitle("OpenFrameworks Slideshow");
    ofSetVerticalSync(true);
    ofSetFrameRate(60.0);
    dir.allowExt("jpg");
    dir.allowExt("png");
    dir.allowExt("gif");
	img01   = 0;
    img02   = 0;
    alpha01 = 255;
    alpha02 = 0;
    ofEnableAlphaBlending();
    help = true;
    anim = false;
    goingUp = true;
    reload = false;
    timeline = 0;
    path = "";
}
Пример #24
0
// ========================================================== Setup
void Argos::setup(){	
	
	ofSetWindowTitle("Argos Interface Builder " + version); 

	WindowWidth = ofGetWidth();
	WindowHeight = ofGetHeight();
	ofSetVerticalSync(false);
	ofSetFrameRate(30);

	ofSetBackgroundAuto(true); 

	ofBackground(40, 40, 40);
	
	tuio.start(3333);
	oschandler.start(3335);

	gui.addFPSCounter((WindowWidth - 100), (WindowHeight - 20), 100, 20);

}
Пример #25
0
void ofApp::setup() {
    ofSetWindowTitle("DEX UI");
    ofBackground(COLOR_15);
    
    ofSetFrameRate(60);
    
    layout = Layout();
    
    left = Left();
    //    left.setPos(165,165);
    left.setDelay(-50);
    
    right = Right();
    right.setPos(68*GRID_SIZE,0);
    right.setDelay(-50);
    
    term = Term();
    //    term.setPos(29*GRID_SIZE, 11*GRID_SIZE);
    term.setPos(255, 0);
    
    keyboard.setPos(16*GRID_SIZE, 43*GRID_SIZE);
    keyboard.setDelay(-100);
    
    // Other
    isDrawing = true;
    
    isRecording = false;
    recordFrameCounter = 0;
    recordMaxFrames = 1; //60*5;
    testInt = 0;
    
    
    console = new ofxConsole();
    console->setPos(255, 0);
    
    console->setToggleKey('#');
    
    console->print("===================Welcome dodola ================", CTEXT_ERROR);
    
    console->addFunction("me", this, &ofApp::drawDodola);
    
}
Пример #26
0
//--------------------------------------------------------------
void ofApp::setup(){

  // used for sorting through Z
  // glEnable(GL_DEPTH);

  ofSetWindowTitle("Floating Bichos v0.1-alpha");

  // parameters gui
  gui.setup("main","settings.xml",30,30);
  gui.add(helper.set("helper", 0.0, 0.0, 1.0));
  gui.add(positionX.set("posX", .2, 0.0, 1.0));
  gui.add(positionY.set("posY", .3, 0.0, 1.0));
  gui.add(bOffset.set("offset", 8.0, 0, 50.0));
  gui.add(bSpeed.set("speed", .2, 0, 1.0));
  gui.add(safezone.set("safezone", ofGetHeight()/3, 100, 500));
  gui.add(scalemin.set("scaleMin", .5, .1, 1));
  gui.add(scalemax.set("scaleMax", 1, 1, 2.0));

  // create an fbo for display of bicho
  fbo.allocate(ofGetHeight()/3,ofGetHeight()/3);
  fbo.begin();
    ofClear(0);
  fbo.end();

  // search for all 'bichos' (subfolders inside bichos folder)
  ofDirectory bichosDir(bichosBasePath);
  bichosDir.listDir();
  bichosDir.sort();
  bichosTotal = bichosDir.size();

  // setup found bichos (load its layers)
  for(int thisBicho = 0; thisBicho < bichosTotal; thisBicho++) {
    myBicho[thisBicho].setup(thisBicho, bichosDir.getPath(thisBicho));
  }

  // init bicho 0
  bichoActive = 0;

  // popit:


}
Пример #27
0
void ofApp::setup(){
	
	ofSetWindowTitle( "ofxGpuPerlinSample" );
	ofSetFrameRate( 60 );
	
	w = 256;
	h = 256;
	
	noise1.setup();
	noise1.setOctaves( 1 );
	noise1.setShaderType( ofxGpuNoise::SHADER_TYPE_Perlin );
	noise1.setShaderDerivType( ofxGpuNoise::SHADER_DERIV_TYPE_YES );
	noise1.setSendSamplingPoints( false );
	noise1.setSamplingPointsScale( 0.001 );
	noise1.create( w, h );
	mesh1.clear();
	vector<ofVec3f> ps1;
	ps1.assign(w*h*3, ofVec3f(0,0,0) );
	vector<ofFloatColor> cs1;
	cs1.assign(w*h*3, ofFloatColor(0.5, 1) );
	mesh1.addVertices( ps1 );
	mesh1.addColors( cs1 );
	mesh1.setMode( OF_PRIMITIVE_POINTS );
	mesh1.setUsage( GL_DYNAMIC_DRAW );

	noise2.setup();
	noise2.setOctaves( 8 );
	noise2.setShaderType( ofxGpuNoise::SHADER_TYPE_Perlin );
	noise2.setShaderDerivType( ofxGpuNoise::SHADER_DERIV_TYPE_YES );
	noise2.setSendSamplingPoints( false );
	noise2.setSamplingPointsScale( 0.001 );
	noise2.create( w, h );
	mesh2.clear();
	vector<ofVec3f> ps2;
	ps2.assign(w*h*3, ofVec3f(0,0,0) );
	vector<ofFloatColor> cs2;
	cs2.assign(w*h*3, ofFloatColor(0.5, 1) );
	mesh2.addVertices( ps2 );
	mesh2.addColors( cs2 );
	mesh2.setMode( OF_PRIMITIVE_POINTS );
	mesh2.setUsage( GL_DYNAMIC_DRAW );
}
//--------------------------------------------------------------
void ofApp::setup(){
    
    ofSetWindowTitle("Blob Detection Motion");
    ofBackground(33);
    
    // Set params
    
    threshold = 30;
    dilate = false;
    erode = false;
    blur = false;
    breathe = false;

    // Initialize grabber and
    // allocate OpenCv images
    
    grabber.initGrabber(320, 240);
    
    rgb.allocate(grabber.getWidth(), grabber.getHeight());
    grayscale.allocate(grabber.getWidth(), grabber.getHeight());
    background.allocate(grabber.getWidth(), grabber.getHeight());
    difference.allocate(grabber.getWidth(), grabber.getHeight());
    
    // Add some particles and
    // attractors to our flock
    
    for(int i=0; i<1000; i++){
        
        float mass = ofRandom(1, 7);
        float x = ofRandom(-5, 5);
        float y = ofRandom(-5, 5);
        float z = 0;
        
        flock.addParticle(Particle(ofVec3f(x,y,z), mass));
        
    }
    
    flock.addAttractor(Particle(ofVec3f(0,0,0), 75));
    flock.addAttractor(Particle(ofVec3f(0,0,0), 75));
    flock.addAttractor(Particle(ofVec3f(0,0,0), 75));
    
}
Пример #29
0
//--------------------------------------------------------------
void ofApp::setup() {

	this->gui.init();
	auto strip = this->gui.addStrip();
	auto senderPanels = ofxCvGui::makeGrid();
	auto receiverPanels = ofxCvGui::makeGrid();
	strip->add(senderPanels);
	strip->add(receiverPanels);

	//initialise sender
	{
		auto port = 4444;
		string ipAddress = "127.0.0.1";
		
		this->sender.init(ipAddress, port);
		ofSetWindowTitle("Sending to : " + ipAddress + ":" + ofToString(port));

		auto sources = this->sender.getKinect().getSources();
		for (auto source : sources) {
			auto imageSource = dynamic_pointer_cast<ofBaseHasTexture>(source);
			if (imageSource) {
				senderPanels->add(ofxCvGui::makePanel(imageSource->getTexture(), source->getTypeName()));
			}
		}
	}

	//initialise receiver
	{
		auto port = 4444;
		string ipAddress = "127.0.0.1";

		this->receiver.init(port);

		receiverPanels->add(ofxCvGui::makePanel(this->previewColor, "Color"));
		receiverPanels->add(ofxCvGui::makePanel(this->previewDepth, "Depth"));
		receiverPanels->add(ofxCvGui::makePanel(this->previewInfrared, "Infrared"));
		receiverPanels->add(ofxCvGui::makePanel(this->previewBodyIndex, "BodyIndex"));
		receiverPanels->add(ofxCvGui::makePanel(this->previewColorCoordInDepthFrame, "ColorCoordInDepthView"));
	}

	ofSetFrameRate(60);
}
Пример #30
0
//--------------------------------------------------------------
void testApp::setup(){
	counter = 0;
	//ofSetCircleResolution(50);
	ofBackground(100,100,100);
	bSmooth = false;
	ofSetWindowTitle("Control Points Example By C. Anderson Miller");

	ofSetFrameRate(60); // if vertical sync is off, we can go a bit fast... this caps the framerate at 60fps.
	//testPoint = point(200,200);
	//testLine = line();
	
	
	
	
	float x1,y1;
	float radius = 200;
	
	x1 = (float)radius * cos(99 * PI/5.0f);
	y1 = (float)radius * sin(99 * PI/5.0f);
	for(int j = 0; j < 10; j++)
	{
		points.push_back(point(500 + x1,450 + y1));
		x1 = (float)radius * cos(j * PI/5.0f);
		y1 = (float)radius * sin(j * PI/5.0f);
		points.push_back(point(500+x1,450+y1));
	}
	
	
	
	
	
	
	int pointSize = points.size();
	
	for(int i = 0; i < pointSize; i++){
		for(int j = 0; j < pointSize; j++){
			lines.push_back(line( points[i], points[j] ) );
		}
	}
	
	
}