@@ -15,9 +15,15 @@ Capture video;
1515
1616void setup () {
1717 size (640 , 480 , P2D );
18- // Uses the default video input, see the reference if this causes an error
18+
19+ // This the default video input, see the GettingStartedCapture
20+ // example if it creates an error
21+ video = new Capture (this , 160 , 120 );
1922 video = new Capture (this , width , height );
23+
24+ // Start capturing the images from the camera
2025 video. start();
26+
2127 numPixels = video. width * video. height ;
2228 // Create array to store the background image
2329 backgroundPixels = new int [numPixels];
@@ -36,11 +42,11 @@ void draw() {
3642 // of the background in that spot
3743 color currColor = video. pixels [i];
3844 color bkgdColor = backgroundPixels[i];
39- // Extract the red, green, and blue components of the current pixel� s color
45+ // Extract the red, green, and blue components of the current pixel' s color
4046 int currR = (currColor >> 16 ) & 0xFF ;
4147 int currG = (currColor >> 8 ) & 0xFF ;
4248 int currB = currColor & 0xFF ;
43- // Extract the red, green, and blue components of the background pixel� s color
49+ // Extract the red, green, and blue components of the background pixel' s color
4450 int bkgdR = (bkgdColor >> 16 ) & 0xFF ;
4551 int bkgdG = (bkgdColor >> 8 ) & 0xFF ;
4652 int bkgdB = bkgdColor & 0xFF ;
@@ -61,7 +67,7 @@ void draw() {
6167}
6268
6369// When a key is pressed, capture the background image into the backgroundPixels
64- // buffer, by copying each of the current frame� s pixels into it.
70+ // buffer, by copying each of the current frame' s pixels into it.
6571void keyPressed () {
6672 video. loadPixels();
6773 arraycopy(video. pixels , backgroundPixels);
0 commit comments