[OpenNI-dev] Problem with joint orientaton in .NET wrapper

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[OpenNI-dev] Problem with joint orientaton in .NET wrapper

lukasz@arbuzz.eu
Hi,
I'm trying to get joint orientation.

The code:
SkeletonJointPosition pos = new SkeletonJointPosition();
skeletonCapbility.GetSkeletonJointPosition(user, SkeletonJoint.Torso,
ref pos);

works like a charm, but when I try:
SkeletonJointOrientation or = new SkeletonJointOrientation();
skeletonCapbility.GetSkeletonJointOrientation(user,
SkeletonJoint.Torso, ref or);

I'm getting AccessViolationException.

Thanks in advance,
Lukasz

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

[OpenNI-dev] Re: Problem with joint orientaton in .NET wrapper

likeBVH
Hi Lukasz, Eddie has kindly passed me this quick patch, I guess he
will soon provide a new version of the OpenNI.NET

apply this patch to the Wrappers/OpenNI.net/OpenNIImporter.cs:

@@ -283,14 +283,21 @@
       };

       [StructLayout(LayoutKind.Sequential)]
-       public class Matrix3X3
+       public struct Matrix3X3
       {
-               [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
-               public readonly float[] Elements = new float[9];
+               public float elem1;
+               public float elem2;
+               public float elem3;
+               public float elem4;
+               public float elem5;
+               public float elem6;
+               public float elem7;
+               public float elem8;
+               public float elem9;
       };

       [StructLayout(LayoutKind.Sequential)]
-       public class SkeletonJointOrientation
+       public struct SkeletonJointOrientation
       {
               /** The actual orientation */
               public Matrix3X3 Orientation;

Eddie.

On Dec 27, 4:22 pm, "[hidden email]" <[hidden email]>
wrote:

> Hi,
> I'm trying to get joint orientation.
>
> The code:
> SkeletonJointPosition pos = new SkeletonJointPosition();
> skeletonCapbility.GetSkeletonJointPosition(user, SkeletonJoint.Torso,
> ref pos);
>
> works like a charm, but when I try:
> SkeletonJointOrientation or = new SkeletonJointOrientation();
> skeletonCapbility.GetSkeletonJointOrientation(user,
> SkeletonJoint.Torso, ref or);
>
> I'm getting AccessViolationException.
>
> Thanks in advance,
> Lukasz

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

RE: [OpenNI-dev] Re: Problem with joint orientaton in .NET wrapper

Eddie Cohen
Actually we fixed it in a better way afterwards. The new fix in the git now, so feel free to download it.

Eddie.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of likeBVH
Sent: Monday, December 27, 2010 17:37
To: OpenNI
Subject: [OpenNI-dev] Re: Problem with joint orientaton in .NET wrapper

Hi Lukasz, Eddie has kindly passed me this quick patch, I guess he
will soon provide a new version of the OpenNI.NET

apply this patch to the Wrappers/OpenNI.net/OpenNIImporter.cs:

@@ -283,14 +283,21 @@
       };

       [StructLayout(LayoutKind.Sequential)]
-       public class Matrix3X3
+       public struct Matrix3X3
       {
-               [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
-               public readonly float[] Elements = new float[9];
+               public float elem1;
+               public float elem2;
+               public float elem3;
+               public float elem4;
+               public float elem5;
+               public float elem6;
+               public float elem7;
+               public float elem8;
+               public float elem9;
       };

       [StructLayout(LayoutKind.Sequential)]
-       public class SkeletonJointOrientation
+       public struct SkeletonJointOrientation
       {
               /** The actual orientation */
               public Matrix3X3 Orientation;

Eddie.

On Dec 27, 4:22 pm, "[hidden email]" <[hidden email]>
wrote:

> Hi,
> I'm trying to get joint orientation.
>
> The code:
> SkeletonJointPosition pos = new SkeletonJointPosition();
> skeletonCapbility.GetSkeletonJointPosition(user, SkeletonJoint.Torso,
> ref pos);
>
> works like a charm, but when I try:
> SkeletonJointOrientation or = new SkeletonJointOrientation();
> skeletonCapbility.GetSkeletonJointOrientation(user,
> SkeletonJoint.Torso, ref or);
>
> I'm getting AccessViolationException.
>
> Thanks in advance,
> Lukasz

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.