Andre_V._P.
YaBB Newbies
Offline
Posts: 14
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 }