We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
beginVideo(int, int, int) error (Read 1632 times)
beginVideo(int, int, int) error
Aug 1st, 2007, 12:54am
 
Hi, I'm trying to run Golin Levin's code and I'm getting this error:

/tmp/build1116.tmp/Temporary_6480_1818.java:22:3:22:43: Semantic Error: No accessible method with signature "beginVideo(int, int, int)" was found in type "Temporary_6480_1818".

/tmp/build1116.tmp/Temporary_6480_1818.java:36:18:36:22: Semantic Error: No field named "video" was found in type "Temporary_6480_1818". However, there is an accessible field "video_width" whose name closely matches the name "video".



Can anyone help me ?

Thanks.


Here is the code I'm talking about:

// Processing code for detecting and quantifying  
// the amount of movement in the video frame
// using a simple Frame-Differencing technique.

import processing.video.*;

int video_width  = 320;
int video_height = 240;
int num_pixels = (video_width * video_height);
int previous_frame[];

//-------------------------------------------
void setup(){
 size(320, 240);

 previous_frame = new int [num_pixels];    // Allocate memory for storing the previous
 for (int i=0; i<num_pixels; i++){    // frame of video, and initialize this buffer
   previous_frame[i] = 0;   // with blank values.
 }

 beginVideo(video_width, video_height, 30);
}

//-------------------------------------------
void loop(){

 int curr_color, prev_color;      // Declare variables to store a pixel's color.
 float curr_r, curr_g, curr_b;    // Declare variables to hold current color values.
 float prev_r, prev_g, prev_b;    // Declare variables to hold previous color values.
 float diff_r, diff_g, diff_b;    // Declare variables to hold computed differences.
 float movement_sum = 0;     // This stores the amount of movement in this frame.


 for (int i=0; i<num_pixels; i++){     // For each pixel in the video frame,
   curr_color = video.pixels[i];  // Fetch the current color in that location,
   prev_color = previous_frame[i];     // and also the previous color from that spot.

   curr_r = red   (curr_color);   // Extract the red, green, and blue components
   curr_g = green (curr_color);   // of the current pixel's color.
   curr_b = blue  (curr_color);

   prev_r = red   (prev_color);   // Extract the red, green, and blue components
   prev_g = green (prev_color);   // of the previous pixel's color.
   prev_b = blue  (prev_color);

   diff_r = abs (curr_r - prev_r);     // Compute the difference of the red values.
   diff_g = abs (curr_g - prev_g);     // Compute the difference of the green values.
   diff_b = abs (curr_b - prev_b);     // Compute the difference of the blue values.

   movement_sum += diff_r+diff_g+diff_b;    // Add these differences to the running tally.
   pixels[i] = color(diff_r,diff_g,diff_b); // Render the difference image to the screen.
   previous_frame[i] = curr_color;     // Swap the current information into the previous.  
   
 }
 
 println(movement_sum);      // Print out the total amount of movement
}
Re: beginVideo(int, int, int) error
Reply #1 - Aug 1st, 2007, 1:16am
 
Hi, I found that tere is a working version of this code without the beginVideo(int, int, int) function.

Well, it doesn't solve the problem but it works.

thanks
Re: beginVideo(int, int, int) error
Reply #2 - Aug 1st, 2007, 1:16am
 
Forgot to mention that the working code is in the examples folder of processing.
Re: beginVideo(int, int, int) error
Reply #3 - Aug 1st, 2007, 3:13am
 
Hi Andre,

Processing syntax has been changed many time since its evolution.
You should check the update history and the video library reference.

This is the working/modified code for .125

Quote:
// Processing code for detecting and quantifying  
// the amount of movement in the video frame
// using a simple Frame-Differencing technique.
 
import processing.video.*;
 
int video_width  = 320;
int video_height = 240;
int num_pixels = (video_width * video_height);
int previous_frame[];

Capture video;
 
//-------------------------------------------
void setup(){
 size(320, 240);
 frameRate(60);
 loadPixels();
 previous_frame = new int [num_pixels];    // Allocate memory for storing the previous
 for (int i=0; i<num_pixels; i++){    // frame of video, and initialize this buffer
   previous_frame[i] = 0;   // with blank values.
 }
video = new Capture(this,video_width, video_height, 30);  
}
 

void captureEvent(Capture video){
 video.read();
}

//-------------------------------------------
void draw(){
 
 int curr_color, prev_color; // Declare variables to store a pixel's color.
 float curr_r, curr_g, curr_b;    // Declare variables to hold current color values.
 float prev_r, prev_g, prev_b;    // Declare variables to hold previous color values.
 float diff_r, diff_g, diff_b;    // Declare variables to hold computed differences.
 float movement_sum = 0;     // This stores the amount of movement in this frame.
 
 
 for (int i=0; i<num_pixels; i++){     // For each pixel in the video frame,
   curr_color = video.pixels[i];  // Fetch the current color in that location,
   prev_color = previous_frame[i];     // and also the previous color from that spot.
 
   curr_r = red   (curr_color);   // Extract the red, green, and blue components
   curr_g = green (curr_color);   // of the current pixel's color.
   curr_b = blue  (curr_color);
 
   prev_r = red   (prev_color);   // Extract the red, green, and blue components
   prev_g = green (prev_color);   // of the previous pixel's color.
   prev_b = blue  (prev_color);
 
   diff_r = abs (curr_r - prev_r);     // Compute the difference of the red values.
   diff_g = abs (curr_g - prev_g);     // Compute the difference of the green values.
   diff_b = abs (curr_b - prev_b);     // Compute the difference of the blue values.
 
   movement_sum += diff_r+diff_g+diff_b;    // Add these differences to the running tally.
   pixels[i] = color(diff_r,diff_g,diff_b); // Render the difference image to the screen.
   previous_frame[i] = curr_color;     // Swap the current information into the previous.  
     
 }
 updatePixels();  
 println(movement_sum); // Print out the total amount of movement
}
Page Index Toggle Pages: 1