topical media & game development

talk show tell print

graphic-processing-learning-16-example-16-1-example-16-1.pde / pde



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 16-1: Display video
  
  // Step 1. Import the video library
  import processing.video.*;
  
  // Step 2. Declare a Capture object
  Capture video;
  
  void setup() {
    size(320,240);
    
    // Step 3. Initialize Capture object via Constructor
    // video is 320 x 240, @15 fps
    video = new Capture(this,320,240,15);
  }
  
  void draw() {
    
    // Check to see if a new frame is available
    if (video.available()) {
      // If so, Step 4. Read the image from the camera.
      video.read();
    }
    
   // Step 5. Display the video image.
   image(video,0,0);
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.