Search processing.org:

Reference for Processing version 1.0.1+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name

### captureEvent()

Examples

    import processing.video.*;
    Capture myCapture;

    void setup()
    {
      size(200, 200);
      // The name of the device is dependent on what's
      // plugged into the computer. To get a list of the
      // choices, uncomment the following line
      // println(Capture.list());
      String s = "Logitech QuickCam Messenger-WDM";
      myCapture = new Capture(this, s, width, height, 30);
    }

    void captureEvent(Capture myCapture) {
      myCapture.read();
    }

    void draw() {
      image(myCapture, 0, 0);
    }

    import processing.video.*;
    Capture myCapture;
    String[] caps;

    void setup()
    {
      size(200, 200);
      caps = Capture.list()
      myCapture = new Capture(this, caps[0], width, height, 30);
      myCapture = new Capture(this, caps[1], width, height, 30);
    }

    void captureEvent(Capture c) {
      if(c == caps[0]) {
        myCapture.read();
      } else if (c == caps[1]) {
        myCapture.read();
      }
    }

    void draw() {
      image(myCapture, 0, 0);
    }

Description | Called when a new camera frame is available. Use the read() method to capture this frame. If there is more than one capture device in the program, captureEvent() is called each time any of the devices has a new frame available. Use an if() to determine which device is triggering the event. See the above example for implementation details.

Syntax

    void captureEvent(Capture which) {
      statements
    }

Parameters

statements | any valid statements
which | the camera with the event

Usage | Web & Application
Related | Capture

Updated on November 22, 2008 08:39:22pm PST