stozpark / kinect-mssdk-openni-bridge

Automatically exported from code.google.com/p/kinect-mssdk-openni-bridge
Other
0 stars 0 forks source link

always userGenerator.PoseDetectionCapability is null in .NET #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i've try Openni sample "UserTracker.net.cs"

but it is always null error with userGenerator.PoseDetectionCapability

here is piece of code in UserTracker.net.cs

if (this.userGenerator.PoseDetectionCapability != null)
            {
                this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability;
                this.poseDetectionCapability.PoseDetected += poseDetectionCapability_PoseDetected;

            }
            else
            {
                MessageBox.Show("poseDetectionCapability is null");
            }

anybody know???

attached file is xml.

Original issue reported on code.google.com by tramp...@gmail.com on 17 Jun 2012 at 5:17

Attachments:

GoogleCodeExporter commented 9 years ago
Please try KinectSDKUserSkeletonGeneratorWithPsiPoseEmulation instead of 
KinectSDKUserSkeletonGenerator.

From readme:
* If your application assumes Psi pose detection, specify
  "KinectSDKUserSkeletonGeneratorWithPsiPoseEmulation" instead of
  "KinectSDKUserSkeletonGenerator". You application will get
  fake pose detection events.

Kinect SDK's user tracker essentially does not have pose detection. That is the 
reason why you get null for pose detection capability by default. 
KinectSDKUserSkeletonGeneratorWithPsiPoseEmulation emits dummy pose detection 
events.
I am not sure if your application likes these dummy events, but I think it is 
worth to try. Let me know if this could solve your problem.

Thanks,
Tomoto

Original comment by tom...@gmail.com on 17 Jun 2012 at 5:26

GoogleCodeExporter commented 9 years ago
Thanks for your ansawer, Tomoto

yes! it's no more null returns but it makes error at SkeletonJointPosition

as attached pic.

everything is ok with c++ sample as NiuserTracker.

but openni.net.dll has some problem...

Thanks

Original comment by tramp...@gmail.com on 17 Jun 2012 at 11:01

Attachments:

GoogleCodeExporter commented 9 years ago
Grad that you got through the first problem.

Now it looks like your application didn't like the sequence of the dummy 
events. I do not have enough time to "make it right" since currently I am not 
working on C#. The quickest workaround would be conservatively making sure your 
Dictionary was initialized each time before accessing to it. For example, 
inserting a code like this before the error location could solve the problem.

if (!this.joints.ContainsKey(user)) {
  this.joints.Add(user, new Dictionary<SkeletonJoint, SkeletonJointPosition>());
}

I have not validated it but I think you can start with this and figure it out.

Thanks,
Tomoto

Original comment by tom...@gmail.com on 17 Jun 2012 at 7:32

GoogleCodeExporter commented 9 years ago
Thanks Tomoto

it is working very well~

have a good day~

Original comment by tramp...@gmail.com on 18 Jun 2012 at 12:15

GoogleCodeExporter commented 9 years ago
Have a great hacking, too!

Original comment by tom...@gmail.com on 18 Jun 2012 at 7:03