Last active
December 24, 2015 10:49
-
-
Save nataliefreed/6786669 to your computer and use it in GitHub Desktop.
Small change to GettingStartedCapture, a Processing example from the Video library, to switch camera to external camera (a PS3 Eye). Intended as a project starting point for students of Building and Programming Intelligent Machines at LWHS, Fall 2013.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Getting Started with Capture. | |
* | |
* Reading and displaying an image from an attached Capture device. | |
* | |
* Edit 10-1-13 by nataliefreed: uses external camera (PS3 Eye) | |
* | |
*/ | |
import processing.video.*; | |
Capture cam; | |
void setup() { | |
size(640, 480); | |
// If no device is specified, will just use the default. | |
// cam = new Capture(this, 320, 240); | |
// To use another device (i.e. if the default device causes an error), | |
// list all available capture devices to the console to find your camera. | |
String[] devices = Capture.list(); | |
println(devices); | |
// Change name in quotes to the proper name for your camera (see list printed to bottom of window in previous line). | |
cam = new Capture(this, width, height, "Sony HD Eye for PS3 (SLEH 00201)"); | |
// Opens the settings page for this capture device. | |
//camera.settings(); | |
} | |
void draw() { | |
if (cam.available() == true) { | |
cam.read(); | |
image(cam, 0, 0); //display camera image, placed at top left corner | |
// The following does the same, and is faster when just drawing the image | |
// without any additional resizing, transformations, or tint. | |
//set(160, 100, cam); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment