Hi, everyone. I'm begginer of processing and I post my question. Hope you can give me some tips.
I've tried a motion tracking by a color tracking code. I'll use this for a modern ballet performence but tracking speed is way too slow. When it tracks color, it draws a cluster of circles. (actually I want to draw a line but it's harder than circle...) So the circles will be displayed like a line. However, when a performer moves fast(like turnning or jumping), those circles are chopped and looked ugly. Therefore I want to make it more speed up which can detect and draw circles faster than now.(no chopped) I tried to change framerate but it won't help. Please help me out! Below is the code.( I applied tracking code from Daniel Shiffman)
<sketch>
import processing.video.*;
Capture video; color trackColor; Snake snake; Snake2 snake2;
void setup(){ size(1024, 768);
video = new Capture(this, width, height,40); //video = new Capture(this, width, height, 15); trackColor = color(0, 0,255); smooth();
snake = new Snake(80); snake2 = new Snake2(70); //snake = new Snake(50); }
class Snake { // x and y positions int[] xpos; int[] ypos;
// The constructor determines the length of the snake Snake(int n) { xpos = new int[n]; ypos = new int[n]; }
void update(int newX, int newY) { // Shift all elements down one spot. // xpos[0] = xpos[1], xpos[1] = xpos = [2], and so on. Stop at the second to last element. for (int i = 0; i < xpos.length-1; i ++ ) { xpos[i] = xpos[i+1]; ypos[i] = ypos[i+1]; }
// Update the last spot in the array with the mouse location. xpos[xpos.length-1] = newX; ypos[ypos.length-1] = newY; }
void display() { // Draw everything //background(255); //background(0); for (int i = 0; i < xpos.length; i ++ ) { // Draw an ellipse for each element in the arrays. // Color and size are tied to the loop's counter: i.
noStroke();
fill(xpos[i], 255-i*1.5, ypos[i],i*2); // BK to WH //fill(100+i*1.5);//WH to BK //fill(random(100)); ellipse(xpos[i], ypos[i], i*0.3, i*0.3); fill(xpos[i], 255-i*1.5, ypos[i],i*1.5); // BK to WH ellipse(xpos[i], ypos[i], i*0.35, i*0.35); fill(xpos[i], 255-i*1.5, ypos[i],i*1); // BK to WH ellipse(xpos[i], ypos[i], i*0.4, i*0.4);
} if (keyPressed){ background(0); //background(255);