问题
I am able to use SimpleOpenNI to successfully record and replay depth and rgb recordings (.oni files). I would also like to be able to track users from recorded files, in other words be able to easily extract sillhouettes of people from a depth image. This is easy to do with SimpleOpenNI when running connected to a sensor, by calling enableUser()
in the setup()
method, and then obtaining userMap()
or userImage()
during draw calls. The motivation for this is to be able to easily segment out a person's sillouhette from a background. I am using SimpleOpenNI version 1.96.
Here is the code I am using when record data:
SimpleOpenNI context;
public void setup()
{
context = new SimpleOpenNI(this);
// recording
context.enableDepth();
context.enableRGB();
context.enableUser();
context.enableRecorder(recordPath);
// select the recording channels
context.addNodeToRecording(SimpleOpenNI.NODE_DEPTH,true);
context.addNodeToRecording(SimpleOpenNI.NODE_IMAGE,true);
context.addNodeToRecording(SimpleOpenNI.NODE_USER, true);
context.addNodeToRecording(SimpleOpenNI.NODE_PLAYER, true);
context.addNodeToRecording(SimpleOpenNI.NODE_SCENE, true);
context.addNodeToRecording(SimpleOpenNI.NODE_IR, true);
}
Here is the code I am using to replay data:
SimpleOpenNI context;
String recordPath = "/path/to/test.oni";
public void setup()
{
context = new SimpleOpenNI(this,recordPath);
context.enableDepth();
context.enableRGB();
context.enableUser();
}
...
The method call context.enableUser();
when I attempt to replay the data causes the error Couldn't getXN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE Invalid memory access of location 0x4c rip=0x10e2c38e2
. However, I know that in order to obtain information about which users are being tracked, I need to call context.enableUser()
. Removing this line removes the error but does not allow me to access information about which users are being tracked.
Does anybody know if it is possible to track users from pre-recorded .oni
files?
回答1:
Yes, it was possible in older versions of SimpleOpenNI.
But it's not possible in version 1.96 without the error.
There is a bug report (See issue 103 in the Google project page. I added the link to the comments, since I can't post more links in answers with too little reputation.) that mentions this.
But there is a way to record .oni
files in an older version of SimpleOpenNI and use them to track users in version 1.96:
I managed to record userMap()
data by installing SimpleOpenNI 0.27, following the old installation guide and using Processing 1.5.1 and the RecorderPlay example that comes with SimpleOpenNI 0.27.
I was then able to play back the .oni
file in SimpleOpenNI 1.96 and Processing 2.2.1 to retrieve userMap and skeleton data.
I am using a Mac Book Pro Retina and OS X 10.9.4.
来源:https://stackoverflow.com/questions/19534014/simpleopenni-record-and-replay-user-tracking-data