We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I am trying to make a project with Processing and the Kinect, I already installed the right library (I use OpenNI and FingerTracker), everything seems to work. I followed a tutorial, which showed how to make the kinect detect our hands, especially our fingers. It's this one :
import fingertracker.*;
import SimpleOpenNI.*;
FingerTracker fingers;
SimpleOpenNI kinect;
int threshold = 625;
void setup() {
size(640, 480);
kinect = new SimpleOpenNI(this);
kinect.enableDepth();
kinect.setMirror(true);
fingers = new FingerTracker(this, 640, 480);
fingers.setMeltFactor(100);
}
void draw() {
kinect.update();
PImage depthImage = kinect.depthImage();
image(depthImage, 0, 0);
fingers.setThreshold(threshold);
int[] depthMap = kinect.depthMap();
fingers.update(depthMap);
stroke(0,255,0);
for (int k = 0; k < fingers.getNumContours(); k++) {
fingers.drawContour(k);
}
// iterate over all the fingers found
// and draw them as a red circle
noStroke();
fill(255,0,0);
for (int i = 0; i < fingers.getNumFingers(); i++) {
PVector position = fingers.getFinger(i);
ellipse(position.x - 5, position.y -5, 10, 10);
}
fill(255,0,0);
text(threshold, 10, 20);
}
void keyPressed(){
if(key == '-'){
threshold -= 10;
}
if(key == '='){
threshold += 10;
}
}
Everything works great, but I'm trying to make it detect when my fingers are on a certain location of the window. I am creating a picture with Photoshop, which will be displayed on the screen in Processing, and I want the JPG to have locations in which several things happen when my fingers touch these spaces (for example some objects which appear suddenly, other windows opening...). Is it possible ? How can I make it ?
Thank you for your future answers.
Answers
(don't paste code as a quote, it looks a mess. instead highlight it and press ctrl-o)
It's done, sorry !
Right now you are loading each finger location into
PVector position
and drawing it withposition.x
,position.y
.It sounds like you want to ask
if
thatposition.x,y
are in a location, then draw animage()
. "In a location" might mean at some distancedist()
from or between some known boundaries, i.e. collision detection: 1 2 3.Could someone please share a download link or zip file of SimpleOpenNI. The one I have doesn't seem to work and finding the library download is now very difficult. I've gotten the Kinect to work with other libraries.
https://github.com/totovr/SimpleOpenni