Ejemplo n.º 1
0
//--------------------------------------------------------------
void testApp::draw(){

    img.draw(imgPos.x, imgPos.y, w,h);
    img.setAnchorPercent(0.5, 0.5);



}
Ejemplo n.º 2
0
//--------------------------------------------------------------
void testApp::setup(){
    vidGrabber.setVerbose(true);
    vidGrabber.initGrabber(640, 480);
    
    colorImg.allocate(vidGrabber.getWidth(), vidGrabber.getHeight());
    greyImage.allocate(vidGrabber.getWidth(), vidGrabber.getHeight());
    greyImageSmall.allocate(120, 90);

    haarFinder.setup("haarcascade_frontalface_alt2.xml");
    
    img.loadImage("stevejobs.png");
    img.setAnchorPercent(0.5, 0.5);
                    
    ofEnableAlphaBlending();
}
Ejemplo n.º 3
0
//--------------------------------------------------------------
void testApp::setup(){
	site.loadImage("site.png");
	site.setAnchorPercent(0.5, 0.5);
	//	zg.load("patches/mouth1.pd", 0, 2, 44100, 256);
	
	
	ofSetVerticalSync(true);
	ofSetFrameRate(60.f);
	play = false;
	WIDTH = 320;
	HEIGHT = 240;
	useLiveVideo = false;
	int sourceWidth = 320;
	int sourceHeight = 240;

	vidGrabber.setVerbose(true);

	sourceWidth = WIDTH;
	sourceHeight = HEIGHT;

	vidGrabber.initGrabber(WIDTH, HEIGHT);
	/*
	
	vidPlayer.loadMovie("mouth0.mov");
	vidPlayer.play();
	vidPlayer.setLoopState(OF_LOOP_NORMAL);
	
	sourceWidth = vidPlayer.width;
	sourceHeight = vidPlayer.height;
	*/
    colorImg.allocate(sourceWidth, sourceHeight);
	bigGrayImage.allocate(sourceWidth, sourceHeight);
		
	grayImage.allocate(WIDTH, HEIGHT);
	grayBg.allocate(WIDTH, HEIGHT);
	grayDiff.allocate(WIDTH, HEIGHT);
	mouths.setup();

	threshold = 80;
	gui.addButton("rewind", rewind);
	gui.addButton("pause", paused);
	gui.addButton("play", play);
	gui.addToggle("Use Camera", useLiveVideo);
	gui.addContent("Source Image", colorImg);
	gui.loadFromXML();
	gui.setAutoSave(true);
	ofSoundStreamSetup(2,0,this, 44100,256, 1);
}
Ejemplo n.º 4
0
/*
 Draw area with image
 */
void CenterContainer::draw(ofImage img_){
    ofPushStyle();

    if(ofGetElapsedTimeMillis() - clickTime < 1000){
        float difr = 255-color.r;
        float difg = 255-color.g;
        float difb = 255-color.b;
        
        float newr = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difr);
        float newg = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difg);
        float newb = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difb);
        
        path.setColor(ofColor(ofClamp(255-newr, 0, 255),ofClamp(255-newg, 0, 255),ofClamp(255-newb, 0, 255),color.a));//white to color
    }else {
        path.setColor(color);
    }
    path.draw();
    
    LineSegment line1 = LineSegment(nw,se);
    LineSegment line2 = LineSegment(ne,sw);
    ofVec2f intersection;
    line1.Intersect(line2, intersection);
    if(ofGetElapsedTimeMillis() - clickTime < 1000){
        float difr = 255-color.r;
        float difg = 255-color.g;
        float difb = 255-color.b;
        float newr = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difr);
        float newg = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difg);
        float newb = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difb);
        
        ofSetColor(ofColor(ofClamp(color.r+newr, 0, 255), ofClamp(color.g+newg, 0, 255),ofClamp(color.b+newb, 0, 255),color.a));
        //color to white
    }else { 
        ofSetColor(ofColor::white,color.a);
        
    }
    
    img_.setAnchorPercent(0.5, 0.5); 
    img_.draw(intersection.x, intersection.y,30,30);
    
    ofPopStyle();
    
}