Lab 6: Software Mirrors (part 2)
Bard College – Computer Science – Object-Oriented Programming

This lab asks you to create a series of image effects: a software photo-booth. You can work by yourself or in pairs for this lab. You will build upon last week’s lab in three ways:

  1. This software mirror will be in Java but should do all the effects from last week;
  1. NOTE: Last week’s filtering functions took a PImage and input and returned a PImage.
  1. The sketch should read images from a Movie or Capture and provide the effects live;
  1. NOTE: since the image will be constantly changing, considering using draw this week (with a conditional) to trigger the effects & draw the image rather than a keyPressed function.
  1. Add a couple of new functions that manipulate the image, feel free to do whatever you’d like—be creative—but, some suggestions:
  1. blur the image (use the convolution example in the pixels tutorial);
  1. place a static image (from a .png or .jpg file) on top of the live image (using image is discouraged, try and do it with the pixels arrays).
  1. place a static image (from a .png or .jpg file) behind the live image using a green screen effect.
  1. use past images in some interesting way (e.g. averaging the pixels over time, or do frame-differencing).

Bonus: Use bit-shifting to make your program super fast!


Warm-Up: Capture with the Webcam

Get the Capture or Movie example working on your computer:

 /**
 * Getting Started with Capture.
 * 
 * Reading and displaying an image from an attached Capture device. 
 */

import processing.video.*;

Capture cam;

void setup() {
  size(640, 480);

  String[] cameras = Capture.list();

  if (cameras == null) {
    println("Failed to retrieve the list of available cameras, will try the default...");
    cam = new Capture(this, width, height);
  } else if (cameras.length == 0) {
    println("There are no cameras available for capture.");
    exit();
  } else {
    println("Available cameras:");
    printArray(cameras);

    // The camera can be initialized directly using an element
    // from the array returned by list():
    cam = new Capture(this, cameras[0]);
    // Or, the settings can be defined based on the text in the list