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:
NOTE: Last week’s filtering functions took a PImage and input and returned a PImage.
The sketch should read images from a Movie or Capture and provide the effects live;
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.
Add a couple of new functions that manipulate the image, feel free to do whatever you’d like—be creative—but, some suggestions:
blur the image(use the convolution example in the pixels tutorial);
place a static image(from a .png or .jpg file) on top of the live image(usingimage is discouraged, try and do it with the pixels arrays).
place a static image(from a .png or .jpg file) behind the live image using a green screen effect.
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;
voidsetup(){
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);
} elseif (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
Warm-Up: Capture with the Webcam
/**
* 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