Drawing Skeleton using ofxOpenNI from recorded .oni File

Hi All,

I’m working on a project with a Norwegian collaborator based around using the Kinect to allow dancers to draw with their movements - trying to work up a grammar both visual and physical.

https://github.com/HellicarAndLewis/Sync

I’ve made a basic Recorder that allows the dancers to draw with their limbs, you can see it here:

https://github.com/HellicarAndLewis/Sync/blob/master/Recorder/

Press space bar to record, and again to stop. It spits out timestamped .oni files in the bin directory.

I’ve added a few elements to Theo’s ofxControlPanel that allows for the drawing of Skeletons within preview windows of live video from the Kinect:

https://github.com/HellicarAndLewis/Sync/blob/master/addons/skeletonFor-ofxControlPanel/videoAndSkeletonCustomDrawer.h

I’ve recently been working on a Player that replicates the functionality of the Recorder, but with playback from pre-recorded .oni files. Press l to load files in:

https://github.com/HellicarAndLewis/Sync/blob/master/Player/src/testApp.cpp

The problem that I have is that even though the Player plays back the video and depth information, it seems unable to then generate the skeleton from playback.

Do I need to record the data in a different format? Add options to the recorder?

  
  
openNIRecorder.setup();  
openNIRecorder.addDepthGenerator();  
openNIRecorder.addImageGenerator();  
openNIRecorder.setRegister(true);  
openNIRecorder.setMirror(true);  
openNIRecorder.addUserGenerator();  
openNIRecorder.setMaxNumUsers(1); //1 for this one....  
      
openNIRecorder.setSafeThreading(true);  
  

  
  
if(!openNIRecorder.isRecording()){  
    string theNewFileName;  
                      
   theNewFileName = ofGetTimestampString();  
                      
   theNewFileName.append(".oni");  
                      
    openNIRecorder.startRecording(ofToDataPath(theNewFileName));  
}else{  
    openNIRecorder.stopRecording();  
}  

Is the player initialising things so that ofxOpenNI can’t reconstruct the skeleton?

  
                  
ofFileDialogResult results = ofSystemLoadDialog();  
                  
openNIPlayer.setupFromONI(results.filePath);  
                  
openNIPlayer.addDepthGenerator();  
openNIPlayer.addImageGenerator();  
openNIPlayer.setRegister(true);  
openNIPlayer.setMirror(true);  
openNIPlayer.addUserGenerator();  
openNIPlayer.setMaxNumUsers(1); //1 for this one....  
                  
openNIPlayer.startPlayer(results.filePath);  
  

Has anyone got skeletonisation working from playback?

Cheers,

Joel

hey joel - your code worked for me after removing the startPlayer function

here is the file I used (180MB)

http://www.jvcref.com/files/oni/hometest-single.oni

I am using oni files all the time –– no problem vis a vis the skeletons. If openni can find them in the first place, it will be able to find them in the oni.

One problem, I saw recently, that for long recordings over 4 gig, the player seems to be confused thinking the file is corrupted.

–8

Hi All,

Thanks to Jason for pointing out the obvious (!) bug of using the start player function to play the file. (-;

Works great, I’ve pushed my changes, some useful drawing code in there too.

Cheers,

Joel