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

@@ -2,17 +2,24 @@

//--------------------------------------------------------------
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(){
cam.update();

}

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

//--------------------------------------------------------------
@@ -22,7 +29,12 @@ void ofApp::keyPressed(int key){

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

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

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

+ 7
- 6
ofApp.h View File

@@ -5,12 +5,12 @@
class ofApp : public ofBaseApp{

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 mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
@@ -20,5 +20,6 @@ class ofApp : public ofBaseApp{
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofVideoGrabber cam;
ofVec2f resolution;
};

Loading…
Cancel
Save