gesture control interface
in
Core Library Questions
•
7 months ago
Hello everyone;
currently I'm making a gestural interface & for that I'm feeding a data from the Arduino serially to the processing & making a blob for the tracking purpose. I need the mouse cursor to follow the blob . Down here is the code with out cursor following function.:
Advanced thanks
& here is the snap shot of the tracking interface:
currently I'm making a gestural interface & for that I'm feeding a data from the Arduino serially to the processing & making a blob for the tracking purpose. I need the mouse cursor to follow the blob . Down here is the code with out cursor following function.:
- import fullscreen.*;
- import processing.serial.*;
- FullScreen fs;
- Serial port;
- String X_data = "";
- String Y_data = "";
- String data = "";
- int index= 0;
- int x = 0;
- int y = 0;
- PFont font;
- PImage img;
- void setup()
- {
- size(1400, 770);
- fs = new FullScreen(this);
- fs.enter();
- img = loadImage("heading.png");
- port = new Serial(this, "COM3", 9600);
- port.bufferUntil('.');
- font = loadFont("AgencyFB-Reg-30.vlw");
- textFont(font, 30);
- smooth();
- noStroke();
- }
- void draw()
- {
- //background(140, 140, 140);
- background(0);
- //image(img, 25, 10, img.width/2, img.height/2);
- ////////////////////////////////////////////
- fill(30, 30, 30);
- rect(20, 50, 260, 40);
- fill(255);
- text("X : ", 45, 81);
- fill(5, 130, 255);
- text(x, 75, 82);
- fill(255);
- text("Y : ", 165, 81);
- fill(5, 130, 255);
- text(y, 195, 82);
- fill(128, 0, 0);
- ellipse(250, 70, 15, 15);
- fill(128, 0, 0);
- ellipse(x, y, 15, 15);
- }
- void serialEvent (Serial port)
- {
- data = port.readStringUntil('.');
- data = data.substring(0, data.length() - 1);
- index = data.indexOf(",");
- X_data = data.substring(0, index);
- X_data = trim(X_data);
- x = int(X_data);
- Y_data = data.substring(index+1, data.length());
- Y_data = trim(Y_data);
- y = int(Y_data);
- }
Advanced thanks
& here is the snap shot of the tracking interface:
1