We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to use the users silhouette as mask to show some animation in that mask. I came up to the http://www.creativeapplications.net/processing/kinect-physics-tutorial-for-processing/
I am using Processing and Kinect V1.
In the first place, the code doesn't work anymore that I download straight of the website, but after debugging some days I get it sort of working.
The problem seems to be that the vertex points of the silhouette are not saving correct, because I only see triangle shapes when I stand for the Kinect camera. Also I receive the error: "Vertices of chain shape are too close together".
Master .pde: http://snippi.com/s/25rcvbd Class CustomShape .pde: http://snippi.com/s/2omdfyu Class PolygonBlob .pde: http://snippi.com/s/7zfdqeq
I think the error will come from this part inside the PolygonBlob Class (see notice at PolygonBlob script at Snippi):
for (int n=0; n<theBlobDetection.getBlobNb (); n++) {
Blob b = theBlobDetection.getBlob(n);
if (b != null && b.getEdgeNb() > 100) {
ArrayList<PVector> contour = new ArrayList<PVector>();
for (int m=0; m<b.getEdgeNb (); m++) {
EdgeVertex eA = b.getEdgeVertexA(m);
EdgeVertex eB = b.getEdgeVertexB(m);
if (eA != null && eB != null) {
EdgeVertex fn = b.getEdgeVertexA((m+1) % b.getEdgeNb());
EdgeVertex fp = b.getEdgeVertexA((max(0, m-1)));
float dn = dist(eA.x*kinectWidth, eA.y*kinectHeight, fn.x*kinectWidth, fn.y*kinectHeight);
float dp = dist(eA.x*kinectWidth, eA.y*kinectHeight, fp.x*kinectWidth, fp.y*kinectHeight);
if (dn > 15 || dp > 15) {
if (contour.size() > 0) {
contour.add(new PVector(eB.x*kinectWidth, eB.y*kinectHeight));
contours.add(contour);
contour = new ArrayList<PVector>();
} else {
contour.add(new PVector(eA.x*kinectWidth, eA.y*kinectHeight));
}
} else {
// comment the next line
//contour.add(new PVector(eA.x*kinectWidth, eA.y*kinectHeight));
}
}
}
}
}
Hope someone can help me out and help me fix the issue?