using a webcam as an eraser

edited May 2015 in Library Questions

hello,

i'm trying to launch the webcam with a rendered video as two different layers but it's not starting my webcam... can you please help me fix this code?

and also, i've been working with the erase function and i wish to embed it into this webcam/video code. so that the webcam is the "eraser" layer. how can one do that?

import processing.video.*;  
 
Capture inputCam01; 

Movie topLayer; 

void setup()  
{  
 size(1640, 1280);  
 frameRate(25);
 

 inputCam01 = new Capture(this, 640, 480);
 

 topLayer = new Movie(this, "3D.avi");
 topLayer.loop(); 
 topLayer.mask(topLayer); 
}  
 
 
void movieEvent(Movie topLayer)  
{  
topLayer.read(); 
} 
 
void draw()  
{   
 if (inputCam01.available() == true) {
   inputCam01.read();
   image(inputCam01, 0, 0); 
 }
 
 image(topLayer, 0, 0); 
 topLayer.mask(topLayer);
}


thanks a lot

Answers

    • AFAIK, mask() doesn't affect things which were already "drawn" to the canvas.
    • Take notice that both Movie & Capture are always changing for each frame.
    • Therefore, mask() needs to be re-applied for each frame! :-\"
    • Is a video considered "drawn"? even though it will be "drawing" itself anew with every frame change?
    • So, can I reapply mask() for, let's say, 25 frames? (Giving that I will be playing a 25f long video)
  • edited May 2015
    • By "drawn" I've meant things like image(), rect(), ellipse(), etc.
    • The same way we can't change the fill() of an already "drawn" rect(), we can't mask() an already "stamped" image().
Sign In or Register to comment.