Try an array[]

Posted on Tuesday 25 October 2005

I am working on a primitive type of motion tracking in Processing, I am having some trouble working out an implementation of an array in the code to store some of the positions of the object being tracked and storing 10 past positions in processing and drawing them as a line on the screen.

Here is the code, it doesn’t work presently… the error that I am getting is: “Perhaps you wanted the overloaded version “void line (float$1, float$2, float$3, float$4); instead?

++++++++++++++++++++++++++++++++++++++++

import processing.video.*;

Capture video;
int xPoses [];
int yPoses [];
//int xPoses [] = new xPoses [10];
//int yPoses [] = new yPoses [10];
int whereToInsert = 0;

float targetRed = 255.0; //set some numbers for the target you are chasing
float targetGreen =255.0;
float targetBlue = 0.0;

void setup(){
video = new Capture(this, 320, 240, 12); //initiate the video, resolution and frame rate
size(320, 240); //give you Processingwindow a size
}

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

void draw(){

float worldRecord = 1000.0; //intialize the worldrecord
int xFound = 0; // initialize the location of the yellow tracking ball
int yFound = 0;

xPoses[whereToInsert] = mouseX; //Newest addition
yPoses[whereToInsert] = mouseY; //Newest addition

if (whereToInsert >= xPoses.length){ //Newest addition
whereToInsert = 0;
}
if (whereToInsert >= yPoses.length){ //Newest addition
whereToInsert = 0;
}

for(int j=0; j


Sorry, the comment form is closed at this time.