Make a image trace on a capture cam

edited December 2014 in Questions about Code

Hello, I just started to use Processing and i'm not familiar with programming, but i gotta create a multimedia installation for the university, where we see image trace when i click on my mouse over the capture of my webcam (so with a rather low opacity).

This my code for the moment :

 import processing.video.*;

Capture cam;

void setup() {

  Motion.setup(this);
  size(640, 480);


  String[] cameras = Capture.list();


  if (cameras.length == 0) {
    println("There are no cameras available for capture.");
    exit();
  } else {
    println("Available cameras:");
    for (int i = 0; i < cameras.length; i++) {
      println(cameras[i]);
    }

    // The camera can be initialized directly using an 
    // element from the array returned by list():
    cam = new Capture(this, cameras[0]);
    cam.start();     
  }      
}

void draw() {
  if (cam.available() == true) {
    cam.read();
  }
  image(cam, 0, 0);
  tint(255,56);
  image(cam,50,0);

  }

Thank you in advance !

Answers

  • What is the line 7? I don't understand where this Motion comes from.
    Remember that size() should be the first call of setup().
    And, well, I don't understand what is your question.

  • edited December 2014

    I'm not sure what you're trying to accomplish. Do you want a small section of your camera's feed to appear when you click? Please try to give a better description of your goal. Draw a before/after image of what clicking does?

  • Fine, i don't know what is this line 7, i'll delete it.

    Sorry, i don't speak English very well. I get webcam, and I want captured a precise moment/instant of what camera record, when i click on my mouse, and this image, i want to superpose this image (with low opacity), over live webcam. Is it clearer ?

    Thank's you !

Sign In or Register to comment.