We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › Suppress camera from display but still capture
Page Index Toggle Pages: 1
Suppress camera from display but still capture? (Read 673 times)
Suppress camera from display but still capture?
Sep 16th, 2009, 4:20pm
 
Hi everyone,

I'm really, really new at this.  Wondering if someone could point me in the right direction...

I'd like to capture video from a camera and create a movie file, but only display an occasional still frame from the input stream to the display.

Any suggestions?

Thanks a million, in advance!!
Sarah
Re: Suppress camera from display but still capture?
Reply #1 - Sep 17th, 2009, 11:32pm
 
Hi Sarah

If you look at the example Video(Capture) in Processing you get this:
Code:

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

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 devices[0] to the proper index for your camera.
 //cam = new Capture(this, width, height, devices[0]);

 // Opens the settings page for this capture device.
 //camera.settings();
}


void draw() {
 if (cam.available() == true) {
   cam.read();
   image(cam, 160, 100);
   // The following does the same, and is faster when just drawing the image
   // without any additional resizing, transformations, or tint.
   //set(160, 100, cam);
 }
}


Notice that only when "image(cam, 160, 100)" is called does Processing display anything on the screen. So one solution could be to just show every 10. or so frame:

Code:

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

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 devices[0] to the proper index for your camera.
 //cam = new Capture(this, width, height, devices[0]);

 // Opens the settings page for this capture device.
 //camera.settings();
}


void draw() {
 if (cam.available() == true && frameCount % 10 == 0 ) //here!
{
   cam.read();
   image(cam, 160, 100);
   // The following does the same, and is faster when just drawing the image
   // without any additional resizing, transformations, or tint.
   //set(160, 100, cam);
 }
}


Hope this helps Smiley
Page Index Toggle Pages: 1