Browse Source

webcam

master
Pia Korndoerfer 4 years ago
parent
commit
c8bc4dffd0
2 changed files with 21 additions and 8 deletions
  1. 14
    2
      ofApp.cpp
  2. 7
    6
      ofApp.h

+ 14
- 2
ofApp.cpp View File



//-------------------------------------------------------------- //--------------------------------------------------------------
void ofApp::setup(){ void ofApp::setup(){
cout <<"setup methode()" <<endl;
cam.listDevices(); //listet alle kameras auf
cam.setDeviceID(0); //wählt eine Kamera aus der Liste aus
resolution.x=640;
resolution.y=480;
cam.setup(resolution.x,resolution.y); // int h und int w werden übergeben


} }


//-------------------------------------------------------------- //--------------------------------------------------------------
void ofApp::update(){ void ofApp::update(){
cam.update();


} }


//-------------------------------------------------------------- //--------------------------------------------------------------
void ofApp::draw(){ void ofApp::draw(){
cam.draw(0,0, resolution.x, resolution.y);
} }


//-------------------------------------------------------------- //--------------------------------------------------------------


//-------------------------------------------------------------- //--------------------------------------------------------------
void ofApp::keyReleased(int key){ void ofApp::keyReleased(int key){

switch(key){
case 'f':
ofToggleFullscreen();
default:
break;
}
} }


//-------------------------------------------------------------- //--------------------------------------------------------------

+ 7
- 6
ofApp.h View File

class ofApp : public ofBaseApp{ class ofApp : public ofBaseApp{


public: public:
void setup();
void update();
void draw();
void setup(); //alles ab einstieg des programms wird einmal am anfang
void update(); // verarbeitung der daten
void draw(); //darstellung der informationen


void keyPressed(int key);
void keyReleased(int key);
void keyPressed(int key); // integer liefer gedrückt taste beim drücken
void keyReleased(int key); // key released wenn taste los gelassen wird
void mouseMoved(int x, int y ); void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button); void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button); void mousePressed(int x, int y, int button);
void windowResized(int w, int h); void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo); void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg); void gotMessage(ofMessage msg);
ofVideoGrabber cam;
ofVec2f resolution;
}; };

Loading…
Cancel
Save