Exemplo n.º 1
0
//--------------------------------------------------------------
void testApp::draw(){
	ofBackgroundGradient(ofColor(0,0,0), ofColor(50, 50, 50), OF_GRADIENT_CIRCULAR);

	ofSetColor(255);
	if( mode == "edit" || mode == "move" ){
		if( mode == "move" ){
			ofSetColor(20, 90, 30);
			ofRect(0,0,3000,3000);
			ofSetColor(255);
		}
		
		for(int i = 0; i < thumbs.size(); i++){
			thumbs[i].draw();
		}
		
		if( mode == "move" && bDown ){
			ofSetColor(255, 190, 50);
			ofRect(thumbs[placedIndex].r.x - 5, thumbs[placedIndex].r.y, 4, 80);
		}
		
		ofSetColor(255);
		
	}else if( mode == "full" ){
		fullVid.draw(0,0);
		ofRect(thumbs[selected].pos * ofGetWidth(), ofGetHeight()-10, 4, 10);
	}else{
		
		vid.setAnchorPercent(0.5, 0.5);
		vid.draw(ofGetWidth()/2, ofGetHeight()/2, ofGetWidth(), ofGetWidth() * ( vid.getHeight() / vid.getWidth() ));
		
		if( vid.isFrameNew() ){
		
			if( mode == "play" ){
				img.grabScreen(0,0,ofGetWidth(),ofGetHeight());
				img.saveImage("frames/" + ofToString(totalFrames) + ".jpg");
			}
			totalFrames++;
			
			framecounter++;
			if( framecounter > NUM_FRAMES ){
				nextVideo();
			}		

		}
	}
}
Exemplo n.º 2
0
//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
	if(mode == "full" && bDown){
		thumbs[selected].pos = ofMap(x, 0, ofGetWidth(), 0, 0.9999, true);
		fullVid.setPosition(thumbs[selected].pos);
		fullVid.update();		
	}
	else if( mode == "move" && bDown ){

		for(int i = 0; i < thumbs.size(); i++){
			ofRectangle tr = thumbs[i].r;
			if( tr.inside(x,y) ){
				placedIndex = i;
				cout << "placedIndex " << placedIndex <<endl;
			}
		}

	}
}
Exemplo n.º 3
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;
}
Exemplo 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);
	}
}
ofRange ofxRGBDVideoDepthSequence::getStartAndEndTimes(ofVideoPlayer& player, ofxDepthImageSequence& sequence){
    if(!ready()){
        ofLogError("ofxRGBDVideoDepthSequence::getStartAndEndTimes -- video sequence not ready");
        return ofRange();
    }
    ofRange output;
    output.min = MAX(0, getVideoMillisForDepthMillis(0))/1000.;
    output.max = MIN(player.getDuration(), getVideoMillisForDepthMillis(sequence.getDurationInMillis()) / 1000. );
	return output;
}
Exemplo n.º 6
0
//--------------------------------------------------------------
void ofApp::update(){
//-------------------------
    
    bool bNewFrame = false;
    vidGrabber.update();
    bNewFrame = vidGrabber.isFrameNew();
    if (bNewFrame){  // if we have a new frame
        colorImg.setFromPixels(vidGrabber.getPixels());
        grayImage = colorImg;
        if (bLearnBakground == true){  // if we hit space, this grabs a "control" image
            grayBg = grayImage;		// copys the pixels from grayImage into grayBg
            bLearnBakground = false;
        }
        grayDiff.absDiff(grayBg, grayImage);
        grayDiff.threshold(threshold);
        // find contours which are between the size of 20 pixels and 1/3 the w*h pixels.
        // find max 10 blobs with no holes in them
        contourFinder.findContours(grayDiff, 20, (vidX*vidY)/3, 10, false);	// false == dont find holes in our blobs
    }
    
    if (bSendSerialMessage){
        serial.writeByte('a');
        nTimesRead = 0;
        nBytesRead = 0;
        int nRead;
        
        unsigned char bytesReturned[3];
        
        memset(bytesReadString, 0, 4);
        memset(bytesReturned, 0, 3);
        
        while( (nRead = serial.readBytes( bytesReturned, 3)) > 0){
            nTimesRead++;
            nBytesRead = nRead;
        };
        
        memcpy(bytesReadString, bytesReturned, 3);
        
        bSendSerialMessage = false;
        readTime = ofGetElapsedTimef();
    }
    
    mov1.update();
    
    for(unsigned int i = 0; i < p.size(); i++){
        p[i].setMode(currentMode);
        p[i].update();
    }
    for(unsigned int i = 0; i < attractPointsWithMovement.size(); i++){
        attractPointsWithMovement[i].x = attractPoints[i].x + ofSignedNoise(i * 10, ofGetElapsedTimef() * 0.7) * 12.0;
        attractPointsWithMovement[i].y = attractPoints[i].y + ofSignedNoise(i * -10, ofGetElapsedTimef() * 0.7) * 12.0;
    }
    
}
Exemplo n.º 7
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());
}
Exemplo n.º 8
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);
    }
Exemplo n.º 9
0
//--------------------------
//void ofxQuad::draw(ofTexture image,int sx,int sy,int sw,int sh){
  void ofxQuad::draw(ofVideoPlayer image,int sx,int sy,int sw,int sh,int num){
      
   //   ofSetColor(255, 255, 255);
    if(moveall == 1){
      if(quadMesh.getNumVertices() < 4){
          quadMesh.draw();
        }
            }
      ofTexture bb;
      bb = image.getTextureReference();
      ofPushMatrix();

    // find transformation matrix
    findHomography(src, dst, matrix);
    
    //finally lets multiply our matrix
   glMultMatrixf(matrix);
      

    bb.drawSubsection(0,0,w,h,sx,sy,sw,sh);
    if(debug){
      
        if(active){
              ofSetColor(redColour, 255, 0,255);
        }
        else{
            ofSetColor(255, 255, 255,255); 
        }
   // ofDrawBitmapString(ofToString(num), sw,sy);
    ofRect(0,0,w,h);
        

 //   verdana30.drawString(ofToString(num), sx,sh+sh);
    
         ofSetColor(0, 0, 0);
    }

    ofPopMatrix();

      if(debug){
          ofPushStyle();
          ofSetColor(255, 255, 255);
          ofSetLineWidth(4);
          ofLine(0, ofGetMouseY(), ofGetWidth(), ofGetMouseY());
          ofLine(ofGetMouseX(), 0, ofGetMouseX(), ofGetHeight());
          ofPopStyle();
      }
}
Exemplo n.º 10
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();
  }
}
Exemplo n.º 11
0
 void update(){
     ofSetWindowTitle(ofToString(ofGetFrameRate()));
     player.update();
 }
Exemplo n.º 12
0
//--------------------------------------------------------------
void ofApp::draw(){
  ofPushMatrix();
  ofScale(vsr,vsr);
  video.draw(0,0);
  ofPopMatrix();
}
Exemplo n.º 13
0
    void exit() {
#ifdef USE_EDSDK
        video.close();
#endif
    }
Exemplo n.º 14
0
//--------------------------------------------------------------
void ofApp::update(){
  video.update();
}
Exemplo n.º 15
0
void ofxOpticalFlowLK :: update ( ofVideoPlayer& source )
{
	update( source.getPixels(), source.width, source.height, OF_IMAGE_COLOR );	// assume colour image type.
}
Exemplo n.º 16
0
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
  ofLogNotice() << "Position: " << x/w << "";
  video.setPosition(x / w);
}
Exemplo n.º 17
0
//--------------------------------------------------------------
void ofApp::draw(){
//-------------------------
    
    int  limit = contourFinder.nBlobs;
    int maxArea = 0;
    int elementNum = -1;
    ofColor yellow(255, 255, 171);
    ofColor white(255, 1);
    
//-------------------------
    
    // loop pages, back and forth
    if (_i < 0) {
        _i = 14;
    }
    if (_i > 14){
        _i = 0;
    }
    
    switch (_i) {
    
        case 0: // blink eyes - ellipse, fill black when clicked DONE
            img1.draw(30, 60);
            ofSetColor(255, 180, 0, alpha);
            ofDrawCircle(265, 225, 45);
            ofDrawCircle(440, 230, 45);
            if (ofGetMousePressed() == true){
                alpha = 0;
            } else {
                alpha = 255;
            }
            music1.setPaused(false);
            ofSetColor(255);
            font.drawString("Omphalotus wasnt like all the other mushrooms.", 40, 40);
            font.drawString("He had eyes. ...and could walk.", 40, 55);
            break;
            
        case 1: // cap sensor DONE
            img2.draw(30, 60);
            music2.setPaused(false);
            bSendSerialMessage = true;
            if (nBytesRead != 1){
                ofSetColor(220);
            } else {
                ofSetColor(0);
            }
            font.drawString("...and talk. He glowed in the dark too.", 40, 40);
            break;
            
        case 2: // earth video speed, mouse move DONE
            bSendSerialMessage = false;
            ofClearAlpha();
            img3.draw(30, 60);
            mov1.draw(215, 480);
            mov1.setSpeed(vidSpeed);
            music3.setPaused(false);
            font.drawString("He didnt know what to do with the days, he felt lost and lonely.", 40, 40);
            font.drawString("Like the world was too big, and he was too small.", 40, 55);
            break;
            
        case 3: // ketchup DONE
            ofEnableAlphaBlending();
            bSendSerialMessage = false;
            img4.draw(30, 60);
            music4.setPaused(false);
            font.drawString("He thought of turning himself in to the omelet factory,", 40, 40);
            font.drawString("but even then, theyd turn him away because he is too poisonous.", 40, 55);
            ofSetColor(250, 58, 20);
            line.draw();
            ofSetColor(255);
            break;
            
        case 4:
            bSendSerialMessage = false;
            ofClearAlpha();
            img5.draw(30, 60);
            music5.setPaused(false);
            font.drawString("It was late one evening he squished sadly past a slime mold on a rock.", 40, 40);
            break;
            
        case 5: // stars in eyes
            bSendSerialMessage = false;
            ofClearAlpha();
            img6.draw(30, 60);
            music6.setPaused(false);
            font.drawString("Hello, what a lovely evening!", 40, 40);
            font.drawString("...squeaked the slime mold.", 40, 55);
            break;
            
        case 6: // drops in eyes
            bSendSerialMessage = false;
            ofClearAlpha();
            img8.draw(30, 60);
            music7.setPaused(false);
            font.drawString("Hello.", 40, 40);
            font.drawString("...replied Omphalotus gloomily.", 40, 55);
            break;
            
        case 7: // more stars
            bSendSerialMessage = false;
            ofClearAlpha();
            img9.draw(30, 60);
            music8.setPaused(false);
            font.drawString("Come, sit upon this rock with me, the lunar eclipse is coming!", 40, 40);
            font.drawString("...the slime mold squeaked.", 40, 55);
            break;
            
        case 8:
            bSendSerialMessage = false;
            img7.draw(30, 60);
            ofClearAlpha();
            music9.setPaused(false);
            font.drawString("Omphalotus did not know what the slime mold was talking about ", 40, 40);
            font.drawString("but he slowly glided over to the rock and joined his new companion.", 40, 55);
            break;
            
        case 9: // throw sum leds DONE
                // touch cap sensor to alternate functions?
            bSendSerialMessage = true;
            ofClearAlpha();
            img10.draw(30, 60);
            music10.setPaused(false);
            font.drawString("They waited in silence, staring at the full moon glowing in the night sky.", 40, 40);
            font.drawString("A snake slithered past in the grass. Three crickets chirped an evening chorus, and a group of fireflies danced.", 40, 55);
            break;
            
        case 10: // moon ellipse, covered by black ellipse with openCV DONE
            bSendSerialMessage = false;
            img11.draw(30, 60);
            
            for (int i = 0; i < limit; i++) {
                if (contourFinder.blobs[i].area > maxArea){
                    maxArea = contourFinder.blobs[i].area;
                    elementNum = i;
                }
            }
            if (elementNum >= 0) {
                pointerX = ofMap(contourFinder.blobs[elementNum].boundingRect.x, vidX, 0, 0, ofGetWidth(), true);
                ofSetColor(255);
                ofDrawCircle(ofGetWidth()/2, 400, 160);
                ofSetColor(0);
                ofDrawCircle(pointerX/2 + 200, 400, 150);
            }
            ofSetColor(255, 255, 255, 150);
            music11.setPaused(false);
            font.drawString("Soon the world grew quiet all around and Omphalotus gazed into the sky.", 40, 40);
            font.drawString("He watched in wonder as the once luminous moon was covered in a veil of magic shadow.", 40, 55);
            break;
            
        case 11: // 'glowing' eclipse
            bSendSerialMessage = false;
            ofClearAlpha();
            img12.draw(30, 60);
            music12.setPaused(false);
            font.drawString("A small smile crept onto his cap, a satisfying chill rushed up his stalk.", 40, 40);
            font.drawString("He had never seen something so spectacular, so unequivocally beautiful.", 40, 55);
            ofSetColor(255);
            ofDrawCircle(300, 300, 110);
            ofSetColor(0);
            ofDrawCircle(300, 300, 100);
            ofSetColor(255, 150);
            break;
            
        case 12: // particle eyes
            bSendSerialMessage = false;
            img13.draw(30, 60);
            music13.setPaused(false);
            
            for(unsigned int i = 0; i < p.size(); i++){
                p[i].draw();
            }
            currentMode == PARTICLE_MODE_ATTRACT;
            
            ofSetColor(255);
            font.drawString("For the first time he was filled with wonder, and he no longer felt so small.", 40, 40);
            
            break;
            
        case 13: // radial gradient fills screen
            ofSetColor(255);
            ofBackgroundGradient(yellow, white, OF_GRADIENT_CIRCULAR);
            bSendSerialMessage = false;
            music14.setPaused(false);
            font.drawString("He started glowing brighter than the moon.", 250, ofGetHeight()/1.3);
            break;
            
        case 14:
            bSendSerialMessage = false;
            music15.setPaused(false);
            ofSetColor(255);
            font2.drawString("After the Eclipse", 40, 300);
            font.drawString("story by: Amber Glassman", 40, 80);
            font.drawString("illustrated by: Jessica Herzog", 40, 100);
            break;
    }
    
}
Exemplo n.º 18
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");
    
}
Exemplo n.º 19
0
    void draw() {
        ofBackground(0);
        
        ofPushMatrix();
        ofPushStyle();
        
        float scaleFactor = ofGetHeight() / (float) MAX(1, video.getHeight());
        ofScale(scaleFactor, scaleFactor);
        ofTranslate(0, -verticalOffset);
        
        float totalStability = ofClamp(ofMap(smoothedMotionValue, motionMin, motionMax, 0, stability), 0, 1);
        
        int n = contours.size();
        
        for(int i = 0; i < n; i++) {
            cv::Rect cur = contours.getBoundingRect(i);
            float w = cur.width, h = cur.height;
            float sx = cur.x, sy = cur.y;
            
            buffer.begin();
            ofDisableBlendMode();
            
            // clear buffer area
            ofClear(0, 0);
            
            // draw filled shape (could blur here)
            ofPushMatrix();
            ofSetColor(255);
            ofFill();
            ofBeginShape();
            vector<cv::Point>& vertices = contours.getContour(i);
            for(int j = 0; j < vertices.size(); j++) {
                ofVertex(vertices[j].x, vertices[j].y);
            }
            ofEndShape();
            ofPopMatrix();
            
            // draw body image
            ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
            ofSetColor(255);
            video.getTexture().drawSubsection(sx, sy, w, h, sx, sy);
            buffer.end();
            
            ofEnableBlendMode(OF_BLENDMODE_ALPHA);
            ofPushMatrix();
            
            ofVec2f center = toOf(contours.getCenter(i));
            ofVec2f offset = center - bodyCenter;
            float orientation = atan2f(offset.y, offset.x);
            float spread = totalStability * spreadAmplitude;
            ofVec2f position = bodyCenter + offset + ofVec2f(offset.x, 0) * spread;
            
            float id = orientation; //contours.getLabel(i) % 3;
            
            float baseRotation = rotationRate * ofGetElapsedTimef() + id;
            float rotation = ofLerp(sin(baseRotation), ofSignedNoise(baseRotation), rotationNoise);
            rotation *= rotationAmplitude * totalStability;
            
            float baseScale = scaleRate * ofGetElapsedTimef() + id;
            float scale = 1 + scaleAmplitude * ofLerp(sin(baseScale), ofSignedNoise(baseScale), scaleNoise) * totalStability;
            
            ofPushStyle();
            ofSetColor(tintRed, tintGreen, tintBlue);
            ofTranslate(position);
            for(int j = 0; j < repetitionSteps; j++) {
                ofPushMatrix();
                float rotationAmount = ofMap(j, -1, repetitionSteps, 0, rotation);
                ofRotate(rotationAmount);
//                ofVec3f axis(0, 0, 1);
//                ofRotate(rotationAmount, axis.x, axis.y, axis.z);
                float curScale = ofMap(j, -1, repetitionSteps, 1, scale);
                ofScale(curScale, curScale, curScale);
                buffer.getTextureReference().drawSubsection(-w / 2, -h / 2, 0, w, h, sx, sy);
                ofPopMatrix();
            }
            ofPopStyle();
            
            if(debug) {
                ofDrawBitmapStringHighlight(ofToString(contours.getLabel(i)), 0, 0);
            }
            ofPopMatrix();
        }
            
        ofPopStyle();
        ofPopMatrix();
        
        ofEnableAlphaBlending();
        
        if(debug) {
            ofPushStyle();
            ofSetColor(255);
            ofNoFill();
            ofSetLineWidth(2);
            ofDrawRectangle(0, 0, video.getWidth(), video.getHeight());
            video.draw(0, 0);
            ofPopStyle();
            
            ofPushStyle();
            ofEnableBlendMode(OF_BLENDMODE_ADD);
            
            ofPushMatrix();
            ofScale(1 / rescale, 1 / rescale);
            drawMat(thresholdedRunning, 0, 0);
            ofPopMatrix();
            
            ofSetColor(magentaPrint, 10);
            drawMat(thresholded, 0, 0);
            
            ofSetLineWidth(3);
            for(int i = 0; i < n; i++) {
                ofSetColor(255);
                contours.getPolyline(i).draw();
            }
            ofNoFill();
            ofSetColor(cyanPrint);
            ofCircle(bodyCenter, 10);
            ofPopStyle();
            
#ifndef USE_VIDEO
            if(video.isLiveDataReady()) {
                stringstream status;
                status << video.getWidth() << "x" << video.getHeight() << " @ " <<
                (int) ofGetFrameRate() << " app-fps " << " / " <<
                (int) video.getFrameRate() << " cam-fps";
                ofDrawBitmapString(status.str(), 10, ofGetHeight() - 40);
            }
#endif
        }
    }
Exemplo n.º 20
0
void ofxImageTS::pixelate(ofVideoPlayer video, int pixelRatio) {
    ofPixels R,G,B, copy;
    copy.allocate(video.getWidth(), video.getHeight(), OF_PIXELS_RGB);
    copy = video.getPixels();
    pixelate(copy,pixelRatio);
}
Exemplo n.º 21
0
//--------------------------------------------------------------
void VisualRingBuffer::setTexture(ofVideoPlayer player){
    begin();
    player.draw(0, 0, width, height);
    end();
}
Exemplo n.º 22
0
void ofxOpticalFlowFarneback::update(ofVideoPlayer& source) {
    update(source.getPixels().getData(), source.getWidth(), source.getHeight(), OF_IMAGE_COLOR); // assume colour image type.
}
Exemplo n.º 23
0
void TTimbre::update(ofVideoPlayer input){
	originalImage.setFromPixels(input.getPixels(), input.getWidth(),  input.getHeight(), OF_IMAGE_COLOR);
	internalUpdate();
}