Пример #1
0
void ofApp::callApi() {
    video.setPaused(true);
    
    visionImage.grabScreen(10, 10, 1280, 720);
    visionImage.save("visionImage.png");
    
    cout << "API CALL" << endl;
    string json = ofSystem("php /Users/shma/work/vision/vision.php " + ofFilePath::getAbsolutePath("visionImage.png") + " LABEL_DETECTION");
    vision.parse(json);
    loading = true;
    
    words.clear();
    for(int i = 0; i < vision["responses"][0]["labelAnnotations"][0].size(); i++) {
        words.push_back(vision["responses"][0]["labelAnnotations"][i]["description"].asString());
    }
    
    string word = ofJoinString(words, ",");
    string fileName = "abc.txt";
    int frame = video.getCurrentFrame();
    
    b =  b + ("[" + ofToString(frame) + "," + word + "]\r\n,");
    ofBuffer buffer = ofBuffer( b );
    ofBufferToFile( fileName, buffer );
    
    video.setPaused(false);
}
Пример #2
0
void KinectV2Classifier::eventLoad(ofxControlButtonEventArgs & evt)
{
    if (!foundUser) {
        ofSystem("Error! You must have a skeleton detected first before loading the preset.");
        return;
    }
    ofFileDialogResult result = ofSystemLoadDialog("Select preset", false, ofToDataPath(""));
    if (result.bSuccess) {
        loadPreset(result.filePath);
    }
}
Пример #3
0
//--------------------------------------------------------------
void ofApp::videoSaved(ofVideoSavedEventArgs& e){
	// the ofQTKitGrabber sends a message with the file name and any errors when the video is done recording
	if(e.error.empty()){
	    recordedVideoPlayback.load(e.videoPath);
	    recordedVideoPlayback.play();
        
        if(bLaunchInQuicktime) {
            ofSystem("open " + e.videoPath);
        }
	}
	else {
		ofLogError("videoSavedEvent") << "Video save error: " << e.error;
	}
}
Пример #4
0
string ofxEyeTribe::startServer()
{
    string res;
    // TODO: support multi platform
    switch (ofGetTargetPlatform())
    {
        case OF_TARGET_OSX:
            res = ofSystem("open -n /Applications/EyeTribe/EyeTribe");
            break;
            
        default:
            ofLogError("ofxEyeTribe", "sorry, this addon is not supported your platform...");
            break;
    }
    ofLogNotice("ofxEyeTribe", res);
    return res;
}
Boolean systemVolume::readMute() {
    
    // check to see if the system is muted 10 times per second
    // note: significantly reduces speed of system.
    // question: how do we run this in a different thread?
    
    refTime = floor(ofGetElapsedTimeMillis() % 1000);
    
    // if it's been 100 ms, update the system state
    if (refTime != prevRefTime) {
        
        string argument;
        
        argument = ofToString(ofSystem("osascript -e 'output muted of (get volume settings)'"));
        
        char muteChar = ofToChar(argument);
        
        if (muteChar == 't') muteState = true;
        if (muteChar == 'f') muteState = false;
    }
    
//    cout << ofToString(prevRefTime) + "  " + ofToString(refTime) << endl;
    
    // updated muted and unmuted flags:
    
    // transition from muted to not muted indicates start of recording
    if (!muteState && prevMuteState) {
        bUnmuted = true;
    }
    
    // transition to muted signals end of recording
    else if (muteState && !prevMuteState) {
        bMuted = true;
    }
    
    // set previous mute state
    prevMuteState = muteState;
    
    // set previous time
    prevRefTime = refTime;
    
    return muteState;
}
Пример #6
0
Application::Application(){
	_surfaceManager.setMediaServer(&_mediaServer);
	_gui.setMediaServer(&_mediaServer);
	_gui.setCmdManager(&_cmdManager);
	_gui.setSurfaceManager(&_surfaceManager);
	
	setState(PresentationState::instance());
	ofAddListener(ofEvents().keyPressed, this, &Application::onKeyPressed);
	ofAddListener(ofEvents().keyReleased, this, &Application::onKeyReleased);
	ofAddListener(ofEvents().mousePressed, this, &Application::onMousePressed);
	
	ofAddListener(Gui::instance()->jointPressedEvent, this, &Application::onJointPressed);
	ofAddListener(Gui::instance()->surfacePressedEvent, this, &Application::onSurfacePressed);
	ofAddListener(Gui::instance()->backgroundPressedEvent, this, &Application::onBackgroundPressed);
    
    string SSHConnection = ofSystem("if [ -z $SSH_CONNECTION ]; then echo no; else echo yes; fi");
    if(SSHConnection == "yes"){
        _isSSHConnection = true;
    }else{
        _isSSHConnection = false;
    }
}
void SuperColliderLooper::guiEvent(ofxUIEventArgs &evt) {
    if (evt.getName() == "Bpm") {
        setBpm(bpm);
    }
    else if (evt.getName() == "Record") {
        string filename = ofSystem("Filename");
    }
    else if (evt.getName() == "+1" && ((ofxUILabelButton *) gui->getWidget("+1"))->getValue()) {
        addNewElement(1, elements.size());
    }
    else if (evt.getName() == "+2" && ((ofxUILabelButton *) gui->getWidget("+2"))->getValue()) {
        addNewElement(2, elements.size());
    }
    else if (evt.getName() == "+4" && ((ofxUILabelButton *) gui->getWidget("+4"))->getValue()) {
        addNewElement(4, elements.size());
    }
    else if (evt.getName() == "+8" && ((ofxUILabelButton *) gui->getWidget("+8"))->getValue()) {
        addNewElement(8, elements.size());
    }
    else if (evt.getName() == "+16" && ((ofxUILabelButton *) gui->getWidget("+16"))->getValue()) {
        addNewElement(16, elements.size());
    }
}
Пример #8
0
//--------------------------------------------------------------
void BYBGui::arduinoButtonPressed(){
    ofSystem("open " + ofToDataPath("arduino/HackerHand_v2.3/") );
}