Ejemplo n.º 1
0
    void setup() {
        ofSetDataPathRoot("../../../../../SharedData/");
        ofSetVerticalSync(true);
//        ofSetLogLevel(OF_LOG_VERBOSE);
        
#ifdef USE_VIDEO
        video.loadMovie("videos/melica.mp4");
        video.play();
#else
        video.setup();
        #ifdef USE_EDSDK
            video.setDeviceType(EDSDK_MKII);
        #endif
#endif
        
        ofFbo::Settings settings;
        settings.width = video.getWidth();
        settings.height = video.getHeight();
        settings.useDepth = false;
        buffer.allocate(settings);
        ofSetBackgroundAuto(false);
        contours.getTracker().setPersistence(100);
        contours.getTracker().setMaximumDistance(100);
        setupGui();
        
        osc.setup("klaus.local", 7400);
    }
Ejemplo n.º 2
0
        void setup(){
            ofSetVerticalSync(false);

            w=ofGetScreenWidth();
            h=ofGetScreenHeight();

            ofDisableArbTex();
            img.load("1.jpg");
            player.load("1.mp4");
            player.play();
            player.setLoopState(OF_LOOP_NORMAL);
            gray = img;
            gray.setImageType(OF_IMAGE_GRAYSCALE);
            wc.load("wcolor.vert","wcolor.frag");

            ofFbo::Settings s;
            s.depthStencilAsTexture=true;
            s.useDepth=true;
            s.width=w;
            s.height=h;
            fboDepth.allocate(s);
            fbo.allocate(w,h);
            fbo.begin();
            ofClear(0,0,100,255);
            fbo.end();

            gui.setup();
            gui.add(stepGradient.set("step gradient",    .0015, -1., 1.));
            gui.add(advectStep.set("step advect",        .0015, -.1, .1));
            gui.add(flipHeightMap.set("flip height map",  0.7,   0.,  2.));
            gui.add(time.set("time",  0.,   0.,  1.));
            gui.add(advectMatrix.set("advect matrix",  ofVec4f(0.1),   ofVec4f(-1.),  ofVec4f(1.)));
            gui.add(switchVideo.set("switch video", false));
        }
Ejemplo n.º 3
0
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
  ofLogVerbose() << "ON : key " << key;

  // [space]: toggle pause and resume
  if(key == 32){
    if(video.isPlaying()){
      bool paused = video.isPaused();

      const char* status = (!paused)? "[pause]": "[resume]";
      ofLogNotice() << "Video: " << status;

      video.setPaused(!paused);
    }else{
      ofLogNotice() << "Video: [play]";
      video.play();
    }
  // [e] or [s]: save frame
  }else if(key == 101 || key == 115){
    string path = currentDateWithCount() + ".png";
    ofPixels* pix = new ofPixels();

    video.setPaused(true);
    pix->setFromPixels(video.getPixels(), vw, vh, OF_IMAGE_COLOR);
    ofSaveImage(*pix, path, OF_IMAGE_QUALITY_MEDIUM);

    ofLogWarning() << "\nSaved frame to \"" << path << "\"" << endl;

  // left key: forward
  }else if(key == 356){
    vVector = 1.0;
    applyVideoMatrix();
  // right key: backward
  }else if(key == 358){
    vVector = -1.0;
    applyVideoMatrix();

  // [0]: very slow speed
  }else if(key == 48){
    vSpeed = 0.25;
    applyVideoMatrix();
  // [1]: normal speed
  }else if(key == 49){
    vSpeed = 1.0;
    applyVideoMatrix();
  // [2]: fast speed
  }else if(key == 50){
    vSpeed = 2.0;
    applyVideoMatrix();
  // [9]: slow speed
}else if(key == 57){
    vSpeed = 0.5;
    applyVideoMatrix();
  }
}
Ejemplo n.º 4
0
void nextVideo(){
	if( whichVideo < thumbs.size() ){
		
		vid.loadMovie(thumbs[whichVideo].video);
		vid.play();
		vid.update();
		vid.setPosition(thumbs[whichVideo].pos);
		
		if( mode == "play" ){
			vid.setSpeed(0.25);
		}
		
		whichVideo++;
		framecounter = 0;
	}else{
		std::exit(0);
	}
}
Ejemplo n.º 5
0
//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){
	if(mode == "full" && bDown){
		thumbs[selected].pos = ofMap(x, 0, ofGetWidth(), 0, 0.9999, true);
		thumbs[selected].savePos();
		fullVid.setPosition(thumbs[selected].pos);
		fullVid.update();
		fullVid.setPaused(false);		
		fullVid.play();
		timer = ofGetElapsedTimef() + NUM_SECS;		
	}
	
	if( mode == "move" ){
		if( bDown ){
			reorganizeThumbs();
		}
	}
	bDown = false;
}
Ejemplo n.º 6
0
//--------------------------------------------------------------
void ofApp::setup(){
  ofSetLogLevel(OF_LOG_NOTICE);

  ofFileDialogResult result = ofSystemLoadDialog("Select movie file...");
  if(result.bSuccess == false){
    ofLogWarning() << "SystemDialog canceled";
    ofExit(1);
  }

  ofSleepMillis(300);
  video.load(result.getPath());
  video.setVolume(0);
  video.setLoopState(OF_LOOP_NONE);

  // WORKAROUND
  video.play();
  video.stop();

  windowRefresh(ofGetWindowWidth(), ofGetWindowHeight());
}
Ejemplo n.º 7
0
//--------------------------------------------------------------
void ofApp::setup(){
//-------------------------
    
    int num = 1500;
    p.assign(num, demoParticle());
    currentMode = PARTICLE_MODE_NEAREST_POINTS;
    
    resetParticles();
    
    ofBackground(100, 100, 100);
    
    vidGrabber.setVerbose(true);
    vidGrabber.setup(vidX,vidY);  // setup live video grabbing
    colorImg.allocate(vidX,vidY);  // color image display
    grayImage.allocate(vidX,vidY); // grayscale display
    grayBg.allocate(vidX,vidY);	   // contour image
    grayDiff.allocate(vidX,vidY);  // b/w differencing image
    bLearnBakground = true;
    threshold = 80;
    
    ofSetVerticalSync(true);
    bSendSerialMessage = false;
    ofSetLogLevel(OF_LOG_VERBOSE);
    
    int baud = 9600;
    serial.setup("/dev/cu.usbmodem1411", baud);
    
    nTimesRead = 0;
    nBytesRead = 0;
    readTime = 0;
    
    memset(bytesReadString, 0, 4);
    
    font.load("NADISN__.TTF", 12);
    font2.load("NADISN__.TTF", 24);
    _i = ofClamp(i, 0, 14);
    
    mov1.load("hel-0world.mp4");
    mov1.setLoopState(OF_LOOP_NORMAL);
    mov1.play();
    
    music1.load("1.wav");
    music2.load("2.wav");
    music3.load("3.wav");
    music4.load("4.wav");
    music5.load("5.wav");
    music6.load("6.wav");
    music7.load("7.wav");
    music8.load("8.wav");
    music9.load("9.wav");
    music10.load("10.wav");
    music11.load("11.wav");
    music12.load("12.wav");
    music13.load("11.wav");
    music14.load("12.wav");
    music15.load("13.wav");
    
    music1.play();
    music2.play();
    music3.play();
    music4.play();
    music5.play();
    music6.play();
    music7.play();
    music8.play();
    music9.play();
    music10.play();
    music11.play();
    music12.play();
    music13.play();
    music14.play();
    music15.play();
    
    music1.setPaused(true);
    music2.setPaused(true);
    music3.setPaused(true);
    music4.setPaused(true);
    music5.setPaused(true);
    music6.setPaused(true);
    music7.setPaused(true);
    music8.setPaused(true);
    music9.setPaused(true);
    music10.setPaused(true);
    music11.setPaused(true);
    music12.setPaused(true);
    music13.setPaused(true);
    music14.setPaused(true);
    music15.setPaused(true);
    
    img1.load("01.png");
    img2.load("02.png");
    img3.load("03.png");
    img4.load("04.png");
    img5.load("05.png");
    img6.load("06.png");
    img7.load("07.png");
    img8.load("08.png");
    img9.load("09.png");
    img10.load("10.png");
    img11.load("11.png");
    img12.load("12.png");
    img13.load("13.png");
    
}