3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Give Your Cat Twitter Powers

Step 7Capture an image when the cat gets into bed

Capture an image when the cat gets into bed
To get started with image capture, look at the Processing example File->Example->Libraries->Video (Capture)->GettingStartedCapture. Make sure you install the WinVDIG component mentioned in step 4 if you're on a Windows PC.

Here's a Processing example that, on Mouseclick, captures a video frame and saves it to file in your sketch's data directory.

// Capture an image from an attached webcam and save it to a unique filenameimport processing.video.*;import java.text.SimpleDateFormat;import java.util.Date;Capture cam;void setup() { size(320,240);  // use the default camera  cam = new Capture(this, 320, 240);   }void draw(){}void mousePressed() {  captureImage(makeFilename());}// Capture an image and save it under the passed in filename// in the sketch data directoryString captureImage(String filename) {    if (cam.available() == true) {      cam.read();      image(cam,0,0);      save(dataPath(filename));      println("Captured "+filename);      return filename;    } else {      println("Camera not (yet?) ready.");      return null;    }}  // Create a unique filename based on date & time// @see http://javatechniques.com/blog/dateformat-and-simpledateformat-examples/String makeFilename() {   Date now = new Date();  SimpleDateFormat format =            new SimpleDateFormat("yyyyMMdd-HHmmss");  return (format.format(now)+".jpg");}
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
6
Followers
2
Author:bpunkt