Ejemplo n.º 1
0
VRCWTrackingDim::VRCWTrackingDim(QWidget *parent) :
   QWidget(parent)
{
   ui.setupUi(this);

   //GUI erstellen
   //
   //Tracking System
   trackingSystem = new VRCWSensorTrackSysDim(ui.trackSysWidget);
   ui.trackSysWidgetVLayout->addWidget(trackingSystem);
   trackingSystem->setSensTrackSysLabel("Tracking system");

   //Hand Sensors
   handSensor_1 = new VRCWSensorTrackSysDim(ui.handSensWidget_1);
   ui.handSensWidget_1VLayout->addWidget(handSensor_1);
   handSensor_1->setSensTrackSysLabel("Hand sensor 1");
   handSensor_2 = new VRCWSensorTrackSysDim(ui.handSensWidget_2);
   ui.handSensWidget_2VLayout->addWidget(handSensor_2);
   handSensor_2->setSensTrackSysLabel("Hand sensor 2");
   handSensor_3 = new VRCWSensorTrackSysDim(ui.handSensWidget_3);
   ui.handSensWidget_3VLayout->addWidget(handSensor_3);
   handSensor_3->setSensTrackSysLabel("Hand sensor 3");

   //Const Head Sensor
   headSensor_0 = new VRCWSensorTrackSysDim(ui.headSensWidget_0);
   ui.headSensWidget_0VLayout->addWidget(headSensor_0);
   headSensor_0->setSensTrackSysLabel("Head sensor 0");
   headSensor_0->setSensTrackSysDesc("(Constant head - not tracked)");

   //Head Sensors
   headSensor_1 = new VRCWSensorTrackSysDim(ui.headSensWidget_1);
   ui.headSensWidget_1VLayout->addWidget(headSensor_1);
   headSensor_1->setSensTrackSysLabel("Head sensor 1");
   headSensor_1->hideSensTrackSysDesc();
   headSensor_2 = new VRCWSensorTrackSysDim(ui.headSensWidget_2);
   ui.headSensWidget_2VLayout->addWidget(headSensor_2);
   headSensor_2->setSensTrackSysLabel("Head sensor 2");
   headSensor_2->hideSensTrackSysDesc();
   headSensor_3 = new VRCWSensorTrackSysDim(ui.headSensWidget_3);
   ui.headSensWidget_3VLayout->addWidget(headSensor_3);
   headSensor_3->setSensTrackSysLabel("Head sensor 3");
   headSensor_3->hideSensTrackSysDesc();


   //QVector<VRCWHSensBIndex*> handSensors erzeugen
   handSensors.append(handSensor_1);
   handSensors.append(handSensor_2);
   handSensors.append(handSensor_3);

   //QVector<VRCWHSensBIndex*> headSensors erzeugen
   headSensors.append(headSensor_0);
   headSensors.append(headSensor_1);
   headSensors.append(headSensor_2);
   headSensors.append(headSensor_3);


   //Set Variables
   //
   thwvdData = new trackHwValDim();
   tSysOld = ART;
   //ein Vektor mit 3 Elementen, da max 3 handSensors konfiguriert werden koennen
   bSysOld = QVector<btnSys>(3);


   //setup GUI
   setupGui();
}
Ejemplo n.º 2
0
WaveformController::WaveformController(Tools::RenderController* parent) :
    QObject(parent)
{
    setupGui ();
}
Ejemplo n.º 3
0
//--------------------------------------------------------------
void Grabber::setup() {

    gdata       = new GlobalData();
    gdata->loadCalibData("settings.xml");
    ofLogLevel(OF_LOG_VERBOSE);
    //ofLogToFile("client_log.txt", false);

    setupGui();
    downsampling = 4;
    switch(gdata->sys_data->logLevel) {
        case 0: ofSetLogLevel(OF_LOG_VERBOSE); break;
        case 1: ofSetLogLevel(OF_LOG_NOTICE); break;
        case 2: ofSetLogLevel(OF_LOG_WARNING); break;
        case 3: ofSetLogLevel(OF_LOG_ERROR); break;
        case 4: ofSetLogLevel(OF_LOG_FATAL_ERROR); break;
        case 5: ofSetLogLevel(OF_LOG_SILENT); break;
        default:ofSetLogLevel(OF_LOG_VERBOSE); break;
    }

    FrameUtils::init();

    ofSetFrameRate(gdata->sys_data->fps);

    total2D     = gdata->total2D;    //Hacer que se cargue dinámico.
    total3D     = gdata->total3D;    //Hacer que se cargue dinámico.

    //ofSetFrameRate(gdata->sys_data->fps);

    if((gdata->total2D + gdata->total3D) > 0) {
        tData = new ThreadData[gdata->total2D + gdata->total3D];
        for(int w = 0; w < (gdata->total2D + gdata->total3D); w++) {
            tData[w].cliId = gdata->sys_data->cliId;
        }
    } else {
        tData = NULL;
    }

    t_camera * camera = gdata->camera;

    if(gdata->total2D > 0) {
        t2D   = new Thread2D[gdata->total2D];
    }

    if(gdata->total3D > 0) {
        t3D   = new Thread3D[gdata->total3D];
    }

    int i2D = 0;
    int i3D = 0;

    while(camera != NULL) {
        if(camera->use3D == 1) {
            t3D[i3D].sys_data                   = gdata->sys_data;
            t3D[i3D].context                    = camera;
            t3D[i3D].startThread(true, false);
            i3D ++;
        } else {
            t2D[i2D].sys_data                   = gdata->sys_data;
            t2D[i2D].context                    = camera;
            t2D[i2D].startThread(true, true);
            i2D ++;
        }
        camera = camera->sig;
    }
    ofLogVerbose() << "[Grabber::setup] " << gdata->sys_data->goLive;
    if(gdata->sys_data->goLive == 1) { //Si desde el Calibrator se indicó que se debe trasmitir en vivo.
        transmitter.grabber     = this;
        transmitter.sys_data    = gdata->sys_data;
        transmitter.startThread(true, true);
    }
    ofVideoGrabber vid;
    vid.listDevices();
}
Ejemplo n.º 4
0
void ofApp::setup() {
	kinect.setRegistration(true);
	kinect.init();
	kinect.open();
	setupGui();
}
Ejemplo n.º 5
0
MessageWindow::MessageWindow(QWidget *parent) :
		QWidget(parent, Qt::CustomizeWindowHint|Qt::WindowTitleHint|Qt::WindowCloseButtonHint)/*, ui(new Ui::MessageWindow)*/ {
	//ui->setupUi(this);
	setupGui();
	settings( false );
}
Ejemplo n.º 6
0
TodoEditor::TodoEditor()
{
    setupGui();
}
//-----------
void AudioUnitMantaController::guiEvent(ofxUIEventArgs &e) {
    if (e.getName() == "remove effect") {
        int row = floor(selectedMantaElement.element / 8);
        int col = selectedMantaElement.element % 8;
        mantaEffectsMap.erase(selectedMantaElement);
        manta->markPad(row, col, false);
        manta->removePadFromSelection(row, col, 2);
        setupGui();
        return;
    }
    else if (e.getName() == "range") {
        float _rmin = ((ofxUIRangeSlider *) gui->getWidget("range"))->getValueLow();
        float _rmax = ((ofxUIRangeSlider *) gui->getWidget("range"))->getValueHigh();
        mantaEffectsMap[selectedMantaElement]->rmin = _rmin;
        mantaEffectsMap[selectedMantaElement]->rmax = _rmax;
        return;
    }
    else if (e.getName() == "View Selection") {
        vector<int> selection[2];
        for (map<MantaElement, int>::iterator it=mantaNoteMap.begin(); it!=mantaNoteMap.end(); ++it){
            if (it->first.type != PAD)  continue;
            selection[it->first.selection].push_back(it->first.element);
        }
        manta->setPadSelection(selection[0], 0);
        manta->setPadSelection(selection[1], 1);
        setupGui();
        return;
    }
    else if (e.getName() == "Selection -> MIDI") {
        manta->markAllPads(false);
        for (int r=0; r<6; r++) {
            for (int c=0; c<8; c++) {
                manta->removePadFromSelection(r, c, 3);
            }
        }
        mantaNoteMap.clear();
        vector<int> selectionValues = manta->getPadSelection();
        vector<int> selectionVelocities = manta->getPadVelocitySelection();
        for (int i=0; i<selectionValues.size(); i++) {
            MantaElement m(PAD, selectionValues[i], 0);
            int row = floor(selectionValues[i] / 8);
            int col = selectionValues[i] % 8;
            int degree = (2 * row - (int)(row / 2) + col) % 7;
            int octave = floor((2 * row - floor(row / 2) + col) / 7);
            mantaNoteMap[m] = theory.getNote(60+key, degree, octave);
            manta->markPad(row, col, true);
            manta->addPadToSelection(row, col, 3);
        }
        for (int i=0; i<selectionVelocities.size(); i++) {
            MantaElement m(PAD, selectionVelocities[i], 1);
            int row = floor(selectionVelocities[i] / 8);
            int col = selectionVelocities[i] % 8;
            int degree = (2 * row - (int)(row / 2) + col) % 7;
            int octave = floor((2 * row - floor(row / 2) + col) / 7);
            mantaNoteMap[m] = theory.getNote(60+key, degree, octave);
            manta->markPad(row, col, true);
            manta->addPadToSelection(row, col, 4);
        }
        return;
    }
    else if (e.getName() == "Sequencer") {
        setupSequencer();
    }

    AudioUnitPlayer::guiEvent(e);
}
Ejemplo n.º 8
0
KRenameWindow::KRenameWindow(QWidget *parent)
    : KMainWindow(parent),
      m_curPage(0), m_guiMode(nullptr),
      m_fileCount(0)
{
    QWidget     *center = new QWidget();
    QVBoxLayout *layout = new QVBoxLayout(center);

    m_delegate = new RichTextItemDelegate(this);
    m_tabBar  = new QTabBar(center);
    m_stack   = new QStackedWidget(center);
    m_buttons = new QDialogButtonBox(center);

    layout->addWidget(m_tabBar);
    layout->addWidget(m_stack);
    layout->addWidget(new KSeparator(Qt::Horizontal, center));
    layout->addWidget(m_buttons);
    layout->setStretchFactor(m_stack, 2);

    this->setCentralWidget(center);

    for (int i = 0; i < tAdvancedMode.numPages; i++) {
        const QIcon &icon = KIconLoader::global()->loadIcon(tAdvancedMode.pageIcons[i], KIconLoader::NoGroup, KIconLoader::SizeSmall);
        m_tabBar->addTab(icon, i18n(tAdvancedMode.pageTitles[i]));
    }

    m_pageFiles    = new Ui::KRenameFiles();
    m_pageDests    = new Ui::KRenameDestination();
    m_pagePlugins  = new Ui::KRenamePlugins();
    m_pageFilename = new Ui::KRenameFilename();

    // add files page
    QWidget *page = new QWidget(m_stack);
    m_pageFiles->setupUi(page);
    m_stack->addWidget(page);

    // add destination page
    page = new QWidget(m_stack);
    m_pageDests->setupUi(page);
    m_stack->addWidget(page);

    // add plugin page
    page = new QWidget(m_stack);
    m_pagePlugins->setupUi(page);
    m_stack->addWidget(page);

    // add filename page
    page = new QWidget(m_stack);
    m_pageFilename->setupUi(page);
    m_stack->addWidget(page);

    setupGui();
    setupPlugins();
    setupIcons();

    StartUpInfo *startUp = new StartUpInfo();
    connect(startUp, &StartUpInfo::addFiles, this, &KRenameWindow::addFiles);
    connect(startUp, &StartUpInfo::enterTemplate,
            this, &KRenameWindow::slotGotoTemplatesPage);

    m_pageDests->urlrequester->setMode(KFile::Directory | KFile::ExistingOnly);
    m_pageFiles->fileList->setItemDelegate(m_delegate);
    m_pageFiles->fileList->setInfoWidget(startUp);

    // Make sure that now signal occurs before setupGui was called
    connect(m_tabBar, &QTabBar::currentChanged,
            this, &KRenameWindow::showPage);
    connect(m_buttonClose, &QPushButton::clicked,
            this, &KRenameWindow::close);
    connect(m_buttons, &QDialogButtonBox::accepted,
            this, &KRenameWindow::slotFinish);

    this->setAutoSaveSettings("KRenameWindowSettings", true);

    // Show the first page in any mode
    showPage(0);
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DataContainerSelectionWidget::initializeWidget(FilterParameter* parameter, AbstractFilter* filter)
{
  setFilter(filter);
  setFilterParameter(parameter);
  setupGui();
}
Ejemplo n.º 10
0
K3b::AdvancedOptionTab::AdvancedOptionTab( QWidget* parent )
    : QWidget( parent )
{
    setupGui();
}
Ejemplo n.º 11
0
MailboxGui::MailboxGui() :
 _p_btnOpenMailbox( NULL ),
 _p_mailboxMain( NULL )
{
    setupGui();
}
Ejemplo n.º 12
0
//--------------------------------------------------------------
void testApp::setup(){
    
	midiIn.listPorts();
	
	midiIn.openPort(2);
    
    midiIn.ignoreTypes(false, false, false);
	
	midiIn.addListener(this);
	
	midiIn.setVerbose(true);


    ofSetVerticalSync(false);
    
	drawWidth = 1280;
	drawHeight = 720;
	// process all but the density on 16th resolution
    
	flowWidth = drawWidth/4;
	flowHeight = drawHeight/4;
	
	// Flow & Mask
	opticalFlow.setup(flowWidth, flowHeight);
	velocityMask.setup(drawWidth, drawHeight);
	
	// Fluid
    
#ifdef USE_FASTER_INTERNAL_FORMATS
	fluid.setup(flowWidth, flowHeight, drawWidth, drawHeight, true);
#else
	fluid.setup(flowWidth, flowHeight, drawWidth, drawHeight, false);
#endif
    
    theImage.loadImage("logo.png");
    fluid.addObstacle(theImage.getTextureReference());
	showLogo = true;
	
	// Particles
	particleFlow.setup(flowWidth, flowHeight, drawWidth, drawHeight);
	
	// Visualisation
	displayScalar.allocate(flowWidth, flowHeight);
	velocityField.allocate(flowWidth / 4, flowHeight / 4);
	temperatureField.allocate(flowWidth / 4, flowHeight / 4);
	
	// Draw Forces
	numDrawForces = 6;
	flexDrawForces = new flowTools::ftDrawForce[numDrawForces];
	flexDrawForces[0].setup(drawWidth, drawHeight, flowTools::FT_DENSITY, true);
	flexDrawForces[0].setName("draw full res");
	flexDrawForces[1].setup(flowWidth, flowHeight, flowTools::FT_VELOCITY, true);
	flexDrawForces[1].setName("draw flow res 1");
	flexDrawForces[2].setup(flowWidth, flowHeight, flowTools::FT_TEMPERATURE, true);
	flexDrawForces[2].setName("draw flow res 2");
	flexDrawForces[3].setup(drawWidth, drawHeight, flowTools::FT_DENSITY, false);
	flexDrawForces[3].setName("draw full res");
	flexDrawForces[4].setup(flowWidth, flowHeight, flowTools::FT_VELOCITY, false);
	flexDrawForces[4].setName("draw flow res 1");
	flexDrawForces[5].setup(flowWidth, flowHeight, flowTools::FT_TEMPERATURE, false);
	flexDrawForces[5].setName("draw flow res 2");
	
	// Camera
	cameraFbo.allocate(drawWidth, drawHeight);
	cameraFbo.begin(); ofClear(0); cameraFbo.end();
    
	setupGui();
	
	lastTime = ofGetElapsedTimef();
	lastMouse.set(0,0);
    
    
    //   ************* Kinect Stuff *************
    
    ofSetLogLevel(OF_LOG_VERBOSE);
	
	kinect.setRegistration(true);
    
	kinect.init();
    kinect.open();
	
	
	colorImg.allocate(kinect.width, kinect.height);
	grayImage.allocate(kinect.width, kinect.height);
	grayThreshNear.allocate(kinect.width, kinect.height);
	grayThreshFar.allocate(kinect.width, kinect.height);    
  
	nearThreshold = 230;
	farThreshold = 70;
	bThreshWithOpenCV = true;
	
	ofSetFrameRate(60);
	
	// zero the tilt on startup
	angle = 60;
	kinect.setCameraTiltAngle(angle);
	
	// start from the front
	bDrawPointCloud = false;
    
    ofEnableAlphaBlending();
    numberBlend = 4;
    

}
Ejemplo n.º 13
0
//--------------------------------------------------------------
void kinectGuiApp::setup(){
    ofSetWindowTitle("kinectGui");
    //ofSetLogLevel(OF_LOG_VERBOSE);
    ofSetFrameRate(60);
    ofEnableAlphaBlending();
    ofEnableSmoothing();

    maskFilename = "mask.png";
    bgColor1.set("bgColor1", ofColor(200,200,200),ofColor(0,0),ofColor(255,255));
    bgColor2.set("bgColor2", ofColor(23,23,23),ofColor(0,0),ofColor(255,255));

    // Video
    iCurVideo = 0;
    showVideo.set("Show Video", true);
    loadVideoDir("video");
    //playVideo();
    //pauseVideo();

    showMain.set("Show Main", true);
    mainAlpha.set("Main Alpha", 100, 0, 255);
    mainHue.set("Main Hue", 255, 0, 255);
    mainSaturation.set("Main Saturation", 255, 0, 255);
    imgMain.allocate(kinect.kinect.width, kinect.kinect.height, OF_IMAGE_COLOR_ALPHA);
    mainRotation.set("Rotation", 0, 0, 360);
    pointMode.set("Point Mode",6,0,6);
    bPointColor.set("Point Color", true);
    // enum ofPrimitiveMode{
    //OF_PRIMITIVE_TRIANGLES
    //OF_PRIMITIVE_TRIANGLE_STRIP
    //OF_PRIMITIVE_TRIANGLE_FAN
    //OF_PRIMITIVE_LINES
    //OF_PRIMITIVE_LINE_STRIP
    //OF_PRIMITIVE_LINE_LOOP
    //OF_PRIMITIVE_POINTS

    // Midi
    // print ports to console
	midiIn.listPorts(); // via instance
	//ofxMidiIn::listPorts(); // via static as well

	// open port by number (you may need to change this)
	midiIn.openPort(1);
	//midiIn.openPort("IAC Pure Data In");	// by name
	//midiIn.openVirtualPort("ofxMidiIn Input");	// open a virtual port

	// don't ignore sysex, timing, & active sense messages,
	// these are ignored by default
	midiIn.ignoreTypes(false, false, false);

	// add app as a listener
	midiIn.addListener(this);

	// print received messages to the console
	midiIn.setVerbose(true);

    joyAxisLeftX  = 0.0;
    joyAxisLeftY  = 0.0;
    joyAxisRightX = 0.0;
    joyAxisRightY = 0.0;
    showJoystick.set("Show Joystick", false);
    joyDeadzone.set("Joystick Deadzone", 0.1, 0.0, 1.0);
	ofxGamepadHandler::get()->enableHotplug();
	//CHECK IF THERE EVEN IS A GAMEPAD CONNECTED
	if(ofxGamepadHandler::get()->getNumPads()>0){
        ofxGamepad* pad = ofxGamepadHandler::get()->getGamepad(0);
        ofAddListener(pad->onAxisChanged, this, &kinectGuiApp::axisChanged);
        ofAddListener(pad->onButtonPressed, this, &kinectGuiApp::buttonPressed);
        ofAddListener(pad->onButtonReleased, this, &kinectGuiApp::buttonReleased);
	}

    kinect.setup();
    setupGui();
    loadSettings();
    kinect.connect();

    cueVideo(0);
}
Ejemplo n.º 14
0
//--------------------------------------------------------------
void gamuzaMain::setup(){

	flagSystemLoaded	= false; // first line of gamuza setup

	//////////////////////////////////////////////
	// load settings from xml
	loadGamuzaSettings();
	if(START_WITH_FULLSCREEN){
		isFullscreen = true;
	}else{
		isFullscreen = false;
	}
	// automation
	if(autoPilot){
		gamuzaFullscreen();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// init general openframeworks settings
	ofSetFrameRate(FPS);
	ofEnableSmoothing();
	ofSetLogLevel(OF_LOG_VERBOSE);
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// AUDIO
	if(audioActivated){
		gamuzaSetup.lock();
		setupAudio();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// OPENNI
	if(openniActivated){
		gamuzaSetup.lock();
		sensorKinect.setupDevice(workingW,workingH,useKinectInfrared,sensorKinectLedState);
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// FBO second screen output texture
	gamuzaSetup.lock();
	setupFBO();
	gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// OSC data sending @ host_number(IP),host_port
	if(oscActivated){
		gamuzaSetup.lock();
		setupOSC();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// ARDUINO
	if(arduinoActivated){
		gamuzaSetup.lock();
		setupArduino();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// GUI
	// include setup of webcams & audio inputs
	gamuzaSetup.lock();
	setupGui();
	gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// SYSTEM
	currentSavedFrame = 0;
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// set log level to error only
	ofSetLogLevel(OF_LOG_ERROR);
	//////////////////////////////////////////////

}
Ejemplo n.º 15
0
Settings::Settings() {
    setupGui();

    checkFirstRun();
    lastOpenedDirectory = QDir::homePath();
}
//-----------
void AudioUnitMantaController::mantaClickEvent(MantaElement & evt) {
    selectedMantaElement = evt;
    setupGui();
}
Ejemplo n.º 17
0
//--------------------------------------------------------------
void gamuzaMain::setup(){

	flagSystemLoaded	= false; // first line of gamuza setup

	//////////////////////////////////////////////
	// load settings from xml
	loadGamuzaSettings();
	// automation
    isFullscreen = false;
	if(autoPilot){
		gamuzaFullscreen();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// init general openframeworks settings
    ofSetEscapeQuitsApp(false);
	ofSetFrameRate(200);
	ofEnableSmoothing();
	ofSetLogLevel(OF_LOG_VERBOSE);
	//////////////////////////////////////////////

    //////////////////////////////////////////////
	// OSC data sending @ host_number(IP),host_port
    gamuzaSetup.lock();
    setupOSC();
    gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// AUDIO
	if(audioActivated){
		gamuzaSetup.lock();
		setupAudio();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

    //////////////////////////////////////////////
	// MIDI
    gamuzaSetup.lock();
    setupMidi();
    gamuzaSetup.unlock();
    //////////////////////////////////////////////

	//////////////////////////////////////////////
	// OPENNI
	if(openniActivated){
		gamuzaSetup.lock();
		sensorKinect.setupDevice(workingW,workingH,useKinectInfrared,sensorKinectLedState);
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// FBO second screen output texture
	gamuzaSetup.lock();
	setupFBO();
	gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// ARDUINO
	if(arduinoActivated){
		gamuzaSetup.lock();
		setupArduino();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// GUI
	// include setup of webcams & audio inputs
	gamuzaSetup.lock();
    setupSettingPanel();
	setupGui();
	gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// SYSTEM
	currentSavedFrame   = 0;
    gaFrameCounter      = 0;
    //////////////////////////////////////////////

	//////////////////////////////////////////////
	// set log level to error only
	ofSetLogLevel(OF_LOG_ERROR);
    sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
	//////////////////////////////////////////////

}
Ejemplo n.º 18
0
//--------------------------------------------------------------
void ofApp::setup(){
    
    ofSetVerticalSync(false);
    ofSetLogLevel(OF_LOG_NOTICE);
    
    drawWidth = 1280;
    drawHeight = 720;
    // process all but the density on 16th resolution
    flowWidth = drawWidth / 4;
    flowHeight = drawHeight / 4;
    
    // FLOW & MASK
    opticalFlow.setup(flowWidth, flowHeight);
    velocityMask.setup(drawWidth, drawHeight);
    
    // enable depth->video image calibration
    kinect.setRegistration(true);
    
    kinect.init();
    //kinect.init(true); // shows infrared instead of RGB video image
    //kinect.init(false, false); // disable video image (faster fps)
    
    kinect.open();		// opens first available kinect
    //kinect.open(1);	// open a kinect by id, starting with 0 (sorted by serial # lexicographically))
    //kinect.open("A00362A08602047A");	// open a kinect using it's unique serial #

    // print the intrinsic IR sensor values
    if(kinect.isConnected()) {
        ofLogNotice() << "sensor-emitter dist: " << kinect.getSensorEmitterDistance() << "cm";
        ofLogNotice() << "sensor-camera dist:  " << kinect.getSensorCameraDistance() << "cm";
        ofLogNotice() << "zero plane pixel size: " << kinect.getZeroPlanePixelSize() << "mm";
        ofLogNotice() << "zero plane dist: " << kinect.getZeroPlaneDistance() << "mm";
    }
    didCamUpdate = false;
    cameraFbo.allocate(kinect.getWidth(), kinect.getHeight());
    cameraFbo.clear();
    
    // Allocate images
    colorImg.allocate(kinect.width, kinect.height, OF_IMAGE_COLOR);
    grayImage.allocate(kinect.width, kinect.height, OF_IMAGE_GRAYSCALE);
    grayThreshNear.allocate(kinect.width, kinect.height, OF_IMAGE_GRAYSCALE);
    grayThreshFar.allocate(kinect.width, kinect.height, OF_IMAGE_GRAYSCALE);
    grayPreprocImage.allocate(kinect.width, kinect.height, OF_IMAGE_GRAYSCALE);
    
    // Configure contour finder
    contourFinder.setMinAreaRadius(10);
    contourFinder.setMaxAreaRadius(200);
    contourFinder.setFindHoles(false);
    

    
    // FLUID & PARTICLES
#ifdef USE_FASTER_INTERNAL_FORMATS
    fluidSimulation.setup(flowWidth, flowHeight, drawWidth, drawHeight, true);
    particleFlow.setup(flowWidth, flowHeight, drawWidth, drawHeight, true);
#else
    fluidSimulation.setup(flowWidth, flowHeight, drawWidth, drawHeight, false);
    particleFlow.setup(flowWidth, flowHeight, drawWidth, drawHeight, false);
#endif
    
    obstacleImage.load("obstacle.png");
    fluidSimulation.addObstacle(obstacleImage.getTexture());
    
    // VISUALIZATION
    displayScalar.setup(flowWidth, flowHeight);
    velocityField.setup(flowWidth / 4, flowHeight / 4);
    temperatureField.setup(flowWidth / 4, flowHeight / 4);
    pressureField.setup(flowWidth / 4, flowHeight / 4);
    velocityTemperatureField.setup(flowWidth / 4, flowHeight / 4);
    
    // MOUSE DRAW
    mouseForces.setup(flowWidth, flowHeight, drawWidth, drawHeight);
    
    // GUI
    setupGui();
    
    lastTime = ofGetElapsedTimef();
    
}