To simplify the use of a dynamic mask with image, I try to use the PGraphics class as an off screen buffer to store the image for a subsequent mask operation. The foreground image is the live video input from the webcam. The mouse drag operation will draw a dynamic mask to reveal the webcam image. It makes use of the fact that the PGraphics class is a subclass of PImage. The mask function can directly take the PGraphics instance as input. Here is a sample screen shot.
Continue reading