Ejemplo n.º 1
0
OscPath::OscPath( QWidget* p ) : QWidget( p ), _client( 0 ) {
	setupUi( this );

	if ( ! _client ) {
		_client = new QOscClient( QHostAddress::LocalHost, port->value(), this );
		connect( hostName, SIGNAL( editingFinished() ), this, SLOT( updateOsc() ) );
		connect( port, SIGNAL( valueChanged( int ) ), this, SLOT( updateOsc() ) );
	}
Ejemplo n.º 2
0
 void update() {
     float cpsToCpf = 1. / 60.;
     local.nwLength += local.nwSpeed * cpsToCpf;
     local.neLength += local.neSpeed * cpsToCpf;
     local.seLength += local.seSpeed * cpsToCpf;
     local.swLength += local.swSpeed * cpsToCpf;
     clamp(local.nwLength);
     clamp(local.neLength);
     clamp(local.seLength);
     clamp(local.swLength);
     updateOsc();
     ofSetWindowTitle(ofToString(roundf(ofGetFrameRate())));
 }
Ejemplo n.º 3
0
//--------------------------------------------------------------
void testApp::update() {
	cam.setMaxLen(panel.getValueF("maxLen"));
	cam.setStepSize(panel.getValueF("stepSize"));
	cam.setClipping(panel.getValueF("nearClipping"), panel.getValueF("farClipping"));
	cam.setOrthoScale(panel.getValueF("orthoScale"));
	cam.setPosition(ofxVec3f(panel.getValueF("camx"), panel.getValueF("camy"), panel.getValueF("camz")));
	cam.setRotation(ofxVec3f(panel.getValueF("camrx"), panel.getValueF("camry"), panel.getValueF("camrz")));
 
	int blurAmount = panel.getValueI("blurAmount");
	int threshLevel = panel.getValueI("threshLevel");
	int minArea = panel.getValueI("minArea");
	int maxArea = panel.getValueI("maxArea");
	int nConsidered = panel.getValueI("nConsidered");
 
	cam.update();
	if(cam.isFrameNew()) {
		float alpha = panel.getValueF("alpha");
		float beta = 1 - alpha;
		IplImage* camIpl = toCv(cam.getPixels(), cam.getWidth(), cam.getHeight(), OF_IMAGE_GRAYSCALE);
		cvAddWeighted(camIpl, alpha, blur.getCvImage(), beta, 0, blur.getCvImage());
		blur.flagImageChanged();
		blur.blur(blurAmount * 2 + 1);
 
		thresh = blur;
		thresh.threshold(threshLevel);
		finder.findContours(thresh, minArea, maxArea, nConsidered, false, false);
 
		// make the average the centroid
		// should be more stable than the moments
		vector<ofxCvBlob>& blobs = finder.blobs;
		for(int i = 0; i < blobs.size(); i++) {
			ofxCvBlob& cur = blobs[i];
			vector<ofPoint>& pts = cur.pts;
			
			pts = ofGetSmoothed(pts, 8);
			
			ofPoint& centroid = cur.centroid;
			centroid.set(0, 0);
			for(int j = 0; j < pts.size(); j++) {
				centroid += pts[j];
			}
			centroid /= pts.size();
		}
 
		updateOsc();
	}
}
Ejemplo n.º 4
0
//--------------------------------------------------------------
void testApp::update(){
  for (int i = 0; i < simSpeed; i++){
    for (int i = 0; i < nbLedProjector; i++){
      spots[i].set(0);
    }
    //updatePerlinNoise();
    updateMovers();
    updateSpotFromMoversGaussian();
  }

  float hue = ofMap(temperature, -5, 32, 0, 260/360.);
  for (int i = 0; i < nbLedProjector; i++){
    spots[i].setHsb(hue,colorSaturation/100.,spots[i].getBrightness());
  }
  #ifdef SHADER_RENDERING
  display.update(spots);
  #endif

  updateDmx();
  updateOsc();
  
  ofSetWindowTitle(ofToString(ofGetFrameRate()));
}