示例#1
0
void nebulaEye::update()
{
  parameterSync.update();
  updateOSC();
  video.update();
  if(video.isFrameNew() || mouseTest){
    if ( mouseTest ){
      ofxCv::toOf(testimg,img);
      zone.unregister();
    } else {
      img = video.getPixels();
      zone._register();
    }
    zone.update(img);
    cv::Mat cvimg = ofxCv::toCv(img);
    cv::Mat maskedImg;
    cvimg.copyTo(maskedImg,~zone.mask[0]);
    bgSub.update(maskedImg);
    flow.update(img);

    if (pix_share.getSource() == nebulaPix_share::SOURCE_FLOW) pix_share.setPixels(flow.getUCFlow());

    if ( bgSub.enabled ){
      contour.update(bgSub.m_fgmask);
      if (pix_share.getSource() == nebulaPix_share::SOURCE_FGMASK) pix_share.setPixels(bgSub.m_fgmask);
    } else {
      contour.update(ofxCv::toCv(img));
    }

    sendOSC();
    recordCSVData();
  }
}
void MagicLightCircle::update()
{
  if(activePixelMappingFunction)
  {
    usePixelMapping = true;
    pixelMapping.startNewFunction(pixelMappingPerno);
    activePixelMappingFunction = false;
  }
  if(lightLife < 1)
    lightLife = 1;
  timerNoPoints++;
  if(timerNoPoints > 100 && blobs.size() > 0)
    blobs.clear();
  updateOSC();
  if(!useOSC)
    update(blobs);
  if(useSound)
    updateSound();
  if(usePixelMapping)
  {
    pixelMapping.update();
    for(int a = 0; a < totMagicPoints; a++)
    {
      magicPoints[a]->intensity = float(pixelMapping.values[a]/255.0);
    }
  }
  sendDMX();
  checkLightInputControllerChanged();
}
示例#3
0
///*****************************************************************
///                            UPDATE
///*****************************************************************
void testApp::update(){
    // update the IP cameras
    updateIpImages();
    // update the OSC-dependant data
    updateOSC();
    //
    if (bLoadDefaults) {
        bLoadDefaults = false;
        settings.setDefaults();
    }
    if (bLiveVideo) {
        if (bIsVideoGrabbing) {
            vidGrabber.update();
            bNewFrame = vidGrabber.isFrameNew();
        }
        else bNewFrame = false;
    }
    else {
      if (!vidPlayer.isLoaded()) return;
      vidPlayer.idleMovie();
      bNewFrame = vidPlayer.isFrameNew();
    }
	if (bNewFrame) {
	    updateCvCinema();

	    updateBlendImage();
	}
}
示例#4
0
//--------------------------------------------------------------
void gamuzaMain::update(){

    char temp_message[512];

	//////////////////////////////////////////////
	// INIT PROGRAM | splash image control
	if(ofGetElapsedTimeMillis() > splashWait){
		splashFinish = true;
		if(flagSystemLoaded){
			flagSystemLoaded = false;
            sprintf(temp_message,"OpenGL version: %s", glGetString (GL_VERSION));
            sendPrivateMessage(GAMUZA_CONSOLE_LOG, temp_message);
            sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
            if(GL_ARB_shader_objects){
                sprintf(temp_message,"GL_ARB_shader SUPPORTED by your Graphic Card: %s", glGetString (GL_RENDERER));
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, temp_message);
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
            }else{
                sprintf(temp_message,"GL_ARB_shader NOT SUPPORTED by your Graphic Card: %s", glGetString (GL_RENDERER));
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, temp_message);
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, "switching to SHADER OFF MODE");
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
            }

			if(audioActivated){
				soundStream.start();
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, "soundStream STARTED");
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
				for(unsigned int i = 0; i < audioInputChannels; i++){
					inputAudioCH[i].computeChannel = true;
				}
				computeAudioInput	= true;
				computeAudioOutput	= true;

			}
            if(arduinoActivated){
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, "ARDUINO connection established");
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
            }
		}
		//////////////////////////////////////////////
		// Main settings control
		ofSetVerticalSync(useVSync);
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// GUI update
		updateGui();
		gui.update();
		//////////////////////////////////////////////

        //////////////////////////////////////////////
		// FBO Output Texture update
        updateFBO();
        //////////////////////////////////////////////

		//////////////////////////////////////////////
		// OPENNI
		if(openniActivated && sensorKinect.useKinect && sensorKinect.isOniConnected){
			sensorKinect.updateDevice();
		}
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// WEBCAM input devices update
		if(trackingActivated){
			for(unsigned int i=0;i<numCamInputs;i++){
				if(inputCam[i].captureVideo){
					inputCam[i].update();
				}
			}
		}
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// ARDUINO update
		if(arduinoActivated && useArduino){
			updateArduino();
		}
		//////////////////////////////////////////////

	}
	//////////////////////////////////////////////

    //////////////////////////////////////////////
    // OSC update
    updateOSC();
    // OSC messages receiving
    receiveOSC();
    //////////////////////////////////////////////

	//////////////////////////////////////////////
	// SYSTEM
	gamuzaRealFPS = ofGetFrameRate();
    gaFrameCounter++;
	//////////////////////////////////////////////

}
示例#5
0
//--------------------------------------------------------------
void gamuzaMain::update(){

	//////////////////////////////////////////////
	// INIT PROGRAM | splash image control
	if(ofGetElapsedTimeMillis() > splashWait){
		splashFinish = true;
		if(flagSystemLoaded){
			flagSystemLoaded = false;
			if(audioActivated){
				soundStream.start();
				printf("\nsoundStream STARTED\n\n");
				logger.log(99, " soundStream STARTED");
				for(unsigned int i = 0; i < audioInputChannels; i++){
					inputAudioCH[i].computeChannel = true;
				}
				computeAudioInput	= true;
				computeAudioOutput	= true;

			}
		}
		//////////////////////////////////////////////
		// Main settings control
		ofSetVerticalSync(useVSync);
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// GUI update
		updateGui();
		gui.update();
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// OPENNI
		if(openniActivated && sensorKinect.useKinect){
			sensorKinect.updateDevice();
		}
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// WEBCAM input devices update
		if(trackingActivated){
			for(unsigned int i=0;i<numCamInputs;i++){
				if(inputCam[i].captureVideo){
					inputCam[i].update();
				}
			}
		}
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// ARDUINO update
		if(arduinoActivated && useArduino){
			updateArduino();
		}
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// OSC update
		if(oscActivated && useOsc){
			updateOSC();
		}
		//////////////////////////////////////////////
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// Various reference var
	gamuzaRealFPS = ofGetFrameRate();
	//////////////////////////////////////////////

}