How to create an NPPoint object in C#?

Post Reply
dsl
Posts: 2
Joined: Tue Feb 26, 2008 1:49 pm

How to create an NPPoint object in C#?

Post by dsl »

I'm using the "OptiTrack_1.1.033.final.b" SDK and started with
the "Single_Camera_CSharp_.NET_3.0" example. I'm trying to get
a Point object from a frame so I can use the "get_Z" property.
Tried the following:

OptiTrack.NPObject npObj = frame.Item(0); //NPCameraFrame
OptiTrack.NPPoint npPoint = npObj as OptiTrack.NPPoint;

npObj looks good, but npPoint is null. What's the right way
to get an NPPoint object?

Thanks,
dsl
beckdo
Posts: 520
Joined: Tue Jan 02, 2007 2:02 pm

Re: How to create an NPPoint object in C#?

Post by beckdo »

The OptiTrack SDK is two dimensional, so you'll only be able to get X & Y values--no third dimensional (Z axis). You'll be able to get those X & Y values as well as other object specifics from the NPObject object. The one (not officially supported) exception in the OptiTrack SDK is the NPVector object which will give you X,Y, and Z values as well as yaw, pitch, and roll if there is a TrackIR Vector Clip in the camera's view.

Our Point Cloud and Rigid Body toolkits may be what you are looking for, they allow the OptiTrack cameras to identify 3D points and track rigid bodies in 6DOF.


Lastly, If you are referring to using INPPoint as a subset of INPVector2, it would need to be used in this way :

m_spVector->Update(m_spCamera, pFrame);

m_spVector->GetPoint(0, &m_spPoint);

m_spPoint->get_X(&varX);
m_spPoint->get_Y(&varY);
m_spPoint->get_Z(&varZ);

m_spPoint.Release();
dsl
Posts: 2
Joined: Tue Feb 26, 2008 1:49 pm

Re: How to create an NPPoint object in C#?

Post by dsl »

Thanks Doug. I didn't notice the GetPoint method since I was only
interested in tracking a single point, at least for starters.
I'll give the Vector Clip and NPVector a try.
Post Reply