We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I'm currently writing a program that begins with taking a still image with the program, and then loads the still image in the same program for a sketch utilizing the still image as a background.
As a better overview, the concept is similar to the one in this program: https://www.openprocessing.org/sketch/117624 but instead of using a loaded image, the program will take a new image with the webcam each time it is run to use as the base.
Currently my method does so with a continuous live image as listed below, but I need it to work from a single still frame taken at the beginning of the program. Any help would be greatly appreciated!
import processing.video.*;
Capture myCam;
void setup() { myCam = new Capture(this); //Creating class, "this" uses live camera feed myCam.start(); fullScreen(); }
void draw() { //Draw when dragging if(myCam.available()){ myCam.read(); } }
Answers
Check the examples that come with the Video library. Under the Capture folder, there should be an example called backgroundSubtraction. Study the code and if you have any other question, write it down here. Also, please ensure you format your code in the forum. It is easy. Select the code block, then hit ctrl+o and don't forget to have add an empty line above and below your code block.
Kf
Kf,
Thanks for the reply. I've studied the example and I'm pretty sure I understand how it works, but I'm still struggling to adapt it to my project. The example seems to work based on creating a copied array at the press of a button and freezing the previous frame to the background, then tracking the live camera based on the color difference between what's now the background and the live feed.
However, from what I understand this operates entirely by creating a new array that is layered over the frame saved as the background. With the code I've modified from the example, I'm not sure how to isolate just that background layer to draw on top of, based on the drawing method I have for sketching. I'll attach the code I'm working from right now (the drawing method still is gonna be modified, but that part can come later.
I apologize for my lack of understanding, I'm a graduate architecture major taking a processing design class as a media elective, and I have no background in coding whatsoever. If you could please clear up how to utilize the techniques in the example I would appreciate it. Thanks
Notice I modified the program to be able to observe the effect. I did:
Kf