Ejemplo n.º 1
0
//--------------------------------------------------------------
void fluid001::keyPressed  (int key){ 
    switch(key) {
#ifdef USE_GUI
		case ' ':
			
			gui.toggleDraw();	
			glClear(GL_COLOR_BUFFER_BIT);
			break;
#endif			
		case 'f':
			ofToggleFullscreen();
			break;
			
		case 'r':
			fluidSolver.reset();
			break;
			
		case 's':
			static char fileNameStr[255];
			sprintf(fileNameStr, "output_%0.4i.png", ofGetFrameNum());
			static ofImage imgScreen;
			imgScreen.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
			printf("Saving file: %s\n", fileNameStr);
			imgScreen.saveImage(fileNameStr);
			break;
			
    }
}
Ejemplo n.º 2
0
void ofApp::save_image(ofImage img) {
    char buf[1];
    sprintf(buf, "%d", rec_cnt);
    string file_name = "/users/yui/desktop/yellow_imgs/teacher/";
    file_name += buf;
    file_name += ".png";
    img.saveImage(file_name);
}
Ejemplo n.º 3
0
void scanner_faces::saveScanImg2HaarViz(ofImage &imgScan, int nPers) {
	
	string nmImgScan = "images/scan_2_haarViz/";
	string nmImgScan1 = ofToString( getenv("HOME") ) + "/fotosHaarViz/";
	string chorraco = ofToString(ofGetYear())+ofToString(ofGetMonth(),2,'0')+ofToString(ofGetDay(),2,'0')+
	ofToString(ofGetHours(),2,'0')+ofToString(ofGetMinutes(),2,'0');
	chorraco += "_cara_"+ofToString(nPers,3,'0')+".png";
    
    nmImgScan += chorraco;
	ofLogNotice("grabar:_"+nmImgScan);
	imgScan.saveImage(nmImgScan);
    
    nmImgScan1 += chorraco;
	imgScan.saveImage(nmImgScan1);
	
	snd_click.play();
	
}
Ejemplo n.º 4
0
void makeThumb(string vidPath, string thumb){
	ofVideoPlayer tmp;
	tmp.loadMovie(vidPath);
	tmp.play();
	tmp.setPosition(0.3);
	ofImage img;
	img.setFromPixels( tmp.getPixelsRef() );
	img.resize(120, 120.0f * (img.getHeight() / img.getWidth()) );
	img.saveImage(thumb);
}
Ejemplo n.º 5
0
void scanner_faces::saveScanImg(ofImage &imgScan, int nPers, int nImg) {
	
	string nmImgScan = "images/scan/";
	nmImgScan += ofToString(ofGetYear())+ofToString(ofGetMonth(),2,'0')+ofToString(ofGetDay(),2,'0')+
	ofToString(ofGetHours(),2,'0')+ofToString(ofGetMinutes(),2,'0');
	nmImgScan += "_cara_"+ofToString(nPers,3,'0')+"_"+ofToString(nImg,2,'0')+".png";
	ofLogNotice("grabar:_"+nmImgScan);
	
	// redimensionar
	imgScan.resize(WSCAN, HSCAN);
	imgScan.saveImage(nmImgScan);
	
	snd_click.play();
	
}
Ejemplo n.º 6
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();
			}		

		}
	}
}
Ejemplo n.º 7
0
//--------------------------------------------------------------
void testApp::keyPressed  (int key){ 
    switch(key) {
		case ' ':
			gui.toggleDraw();	
			glClear(GL_COLOR_BUFFER_BIT);
			break;			
		case 'f':
			ofToggleFullscreen();
			break;
		case 'p':
			static char fileNameStr[255];
			sprintf(fileNameStr, "output_%0.4i.png", ofGetFrameNum());
			static ofImage imgScreen;
			imgScreen.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
			printf("Saving file: %s\n", fileNameStr);
			imgScreen.saveImage(fileNameStr);
			break;
		case 'q':
			if (smurfFloor->getBPM() <= 295) {
				// really quicken the beat
				// In my case just got the griffin knob linked to this
				smurfFloor->setBPM(smurfFloor->getBPM()+5);
			}
			break;
		case 's':
			if (smurfFloor->getBPM() > 5 ) {
				// really slow down the beat
				// In my case just got the griffin knob linked to this
				smurfFloor->setBPM(smurfFloor->getBPM()-5);
			}
			break;
		case 'a':
			if (smurfFloor->getBPM() <= 299) {
				// quicken the beat
				// In my case just got the griffin knob linked to this
				smurfFloor->setBPM(smurfFloor->getBPM()+1);
			}
			break;
		case 'z':
			if (smurfFloor->getBPM() > 1) {
				// slow down the beat
				// In my case just got the griffin knob linked to this
				smurfFloor->setBPM(smurfFloor->getBPM()-1);
			}
			break;
		case 'h': // help
			smurfFloor->setVerbose(smurfFloor->isVerbose()?false:true);
			break;
#ifdef TARGET_OS_MAC
		case 'g': // gesture
			smurfFloor->toggleGesture();
			break;
#endif
		case 'c': // gesture
			smurfFloor->toggleConnectionMode();
			break;
		case 'w': // wave
			if (smurfFloor->getWaveSpeed() > 1) {
				smurfFloor->setWaveSpeed(smurfFloor->getWaveSpeed()-1);
			}
			break;
		case 'x': // wave
			if (smurfFloor->getWaveSpeed() <= 20) {
				smurfFloor->setWaveSpeed(smurfFloor->getWaveSpeed()+1);
			}
			break;
    }
}