How to do skeleton tracking through defining a class?

edited January 8 in Kinect

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.

Answers

  • Did you look at the contents of D:\processing project\processing-3.2.3\hs_err_pid1084.log ?

  • edited January 9

    dear Jeremy thank you for your attention, you can find contents of log in the attachment: ``#

    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

    #

    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.

    #

    --------------- T H R E A D ---------------

    Current thread (0x0000000016865000): JavaThread "Animation Thread" [_thread_in_native, id=5028, stack(0x0000000017820000,0x0000000017920000)]

    siginfo: ExceptionCode=0xc0000005, reading address 0x0000000000000020

    Stack: [0x0000000017820000,0x0000000017920000], sp=0x000000001791f158, free space=1020k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C 0x00007ffb44597040

    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j SimpleOpenNI.SimpleOpenNIJNI.IntVector_size(JLSimpleOpenNI/IntVector;)J+0 j SimpleOpenNI.IntVector.size()J+4 j SimpleOpenNI.SimpleOpenNI.getUsers()[I+27 j arminvideo1$effect2.run()V+18 j arminvideo1.draw()V+46 j processing.core.PApplet.handleDraw()V+161 j processing.awt.PSurfaceAWT$12.callDraw()V+7 j processing.core.PSurfaceNone$AnimationThread.run()V+30 v ~StubRoutines::call_stub

  • edited January 9

    How in the world can you possibly track a person's skeleton? You don't have an X-Ray machine, do you? Perhaps, you mean tracking the person or his/her body?

  • yes, I am just going to track their body...

  • edited January 10

    @Lord_of_the_Galaxy -- "skeleton" is the term Microsoft uses for the simplified data structure representing the body, arms and legs that the Kinect returns.

    @armin_af90 -- I'm glad that you were able to find the log, which looks like it might be a SimpleOpenNI error. Unfortunately Kinect is not my area of expertise, and I don't have one on-hand to test, so hopefully another forum member can help you.

  • So Microsoft has algorithms to determine a simplified structure from an image of a human body? Interesting. It would be better if it could work with other creatures as well.

  • @jeremydouglass ok thank you very much for your assistance and attention :)

Sign In or Register to comment.