Last active
August 29, 2015 14:14
-
-
Save yumu19/d25b9da057d52cc72383 to your computer and use it in GitHub Desktop.
Save Camera Image
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
import processing.video.*; | |
Capture cam; | |
PImage img; | |
String path; | |
String command; | |
int i; | |
void setup(){ | |
size(640,384); | |
cam = new Capture(this, width, height, 10); | |
cam.start(); | |
img = new PImage(width,height); | |
i = 0; | |
} | |
void draw() { | |
path = "/Users/yumu/Desktop/img/img"+str(i)+".png"; | |
command = "/usr/bin/osascript -e \'tell application \"Finder\" to set desktop picture to POSIX file \""+path+"\"\'"; | |
image(cam,0,0); | |
save(path); | |
i++; | |
} | |
void captureEvent(Capture camera) { | |
camera.read(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment