User Tools

Site Tools


cs276:spc.video

CSci 276 Video Lab

The purpose of this lab is to practice using video capture from a webcam. You'll need a computer with a builtin or external webcam for these to work.

Start by ensuring that the latest Video libraries are installed in Processing:

  1. Go to Sketch → Import Library… → Manage Libraries
  2. Scroll down to Video. If there is a green check mark next to the name, it is installed
  3. Select Video and check the version number. It should be at least 2.0. If not, select Update.
  4. If you had to install or update, restart Processing

Lab Exercises

  • Copy the sketch 16-01 from Learning Processing and run it. Be sure to wave at your image. Note: some versions of macOS are picky about granting access to the camera. If you get an error, try it again, or just try the next sketch and come back to this one, see if that helps. If nothing works, record the errors you get and send to me.
  • Copy the sketch 16-02 from Learning Processing and run it. To see the effects, move the mouse across and up and down in the window. Be sure to save the sketch before continuing.
  • Add a function keyPressed to the sketch:
    void keyPressed() {
      save("capture.png");
    }

    Now when you press the space bar (or any other key) the contents of the drawing window will be saved to a file in your sketch folder.

  • Copy the sketch 16-03 from Learning Processing and run it. The position of the mouse changes the brightness of the video.

Feel free to experiment with these, adding keyPressed to the others if you want to save more samples, etc. Demonstrate one of these sketches to the instructor, or send a capture.png file in an email.

Errors

As of Processing 4.0, the following errors have been seen in the wild:

Processing video library using bundled GStreamer 1.20.3
Scanning GStreamer plugins... Done.
BaseSrc: [avfvideosrc0] : Internal data stream error.

We'll need to investigate these since they occur on macOS Catalina, the system run on the classroom computers.

cs276/spc.video.txt · Last modified: 2022/10/05 20:59 by scarl