Dear All,
Thank you for your investigations in processing. I am going to implement a project. In this project I'm going to play a video in background and implement effects through defining different classes. In one of my effects, I have to track skeleton of human bodies. here is my code:
import processing.video.*; import SimpleOpenNI.*; import java.util.*;
Movie movie1; SimpleOpenNI kinect; effect1 x1; effect2 x1; void setup(){ size(1280,960,P2D);
movie1 = new Movie(this, "moon.mov"); kinect = new SimpleOpenNI(this); kinect.enableDepth(); kinect.enableRGB(); kinect.enableUser();
x1=new effect1(kinect);
}
void draw(){
movie1.play();
int m = millis(); if((m/1000)<10){ x1.run(); } else{ image(movie1, 0, 0, width, height); }
}
void movieEvent(Movie m) { m.read(); }
class effect1{
int [] userID,userColor;
PVector location, velocity, accelration,headPosition,confidenceVector;
float confidenceLevel=.4;
float confidence=0;
effect1(SimpleOpenNI kinect){
headPosition=new PVector();
confidenceVector=new PVector();
if(kinect.isInit() == false){
println("Can't init SimpleOpenNI, maybe the camera is not connected!");
exit();
return;
}
}
void run(){ kinect.update(); userID = kinect.getUsers(); background(255); //ellipse(100,100, 20,20); for(int i=0;i<userID.length;i++) { confidence = kinect.getJointPositionSkeleton(userID[i], SimpleOpenNI.SKEL_HEAD,confidenceVector);
// if confidence of tracking is beyond threshold, then track user
if(confidence > confidenceLevel)
{
// change draw color based on hand id#
stroke(userColor[(i)]);
// fill the ellipse with the same color
fill(userColor[(i)]);
// if Kinect is tracking certain user then get joint vectors
if(kinect.isTrackingSkeleton(userID[i]))
{
kinect.getJointPositionSkeleton(userID[i], SimpleOpenNI.SKEL_TORSO,headPosition);
// convert real world point to projective space
kinect.convertRealWorldToProjective(headPosition,headPosition);
//kinect.convertRealWorldToProjective(headPosition,headPosition);
fill(255,0,0);
ellipse(headposition.x,headposition.y, 20,20);
}
}
}
}
}
****the following error has been generated:****
0 #
A fatal error has been detected by the Java Runtime Environment:
#
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffb44597040, pid=1084, tid=0x00000000000013a4
#
JRE version: Java(TM) SE Runtime Environment (8.0_111-b14) (build 1.8.0_111-b14)
Java VM: Java HotSpot(TM) 64-Bit Server VM (25.111-b14 mixed mode windows-amd64 compressed oops)
Problematic frame:
C 0x00007ffb44597040
#
Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
An error report file with more information is saved as:
D:\processing project\processing-3.2.3\hs_err_pid1084.log
#
If you would like to submit a bug report, please visit:
http://bugreport.java.com/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.
# Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help ? Troubleshooting.