Discussion and Support for the OptiTrack, SmartNav and TrackIR brands by NaturalPoint

NEW SDK spObject->get_Rank(&lRank);

by avelazquez » Wed Nov 17, 2010 10:17 am


I am in the process of porting my application from the old SDK to the new SDK which by the way seems very user friendly, I am however looking for a function equivalent to:

long lRank;
spObject->get_Rank(&lRank); //get object's rank

from the old SDK, I will like to track the object with the highest rank.

Posts: 19
Joined: Mon Jun 07, 2010 7:40 am

by VincentG » Wed Nov 17, 2010 12:37 pm

There is no equivalent, however a better result is easily achieved.

I would suggest using an object's roundness and size as metrics for 'rank'.

For example use the object with the highest Roundness() that is at least a size of 10.
Posts: 7728
Joined: Mon Jul 17, 2006 5:00 am
Location: Corvallis, Oregon

by mikeincinci » Wed Nov 17, 2010 3:07 pm

What about the equivalent of "NP_OPTION_OBJECT_CAP="?
Are there preferred methods in new SDK for tracking a single dot?

If more than one objects are being tracked, is it safe to assume the first one will be the "higher ranked"?
Posts: 22
Joined: Tue Aug 14, 2007 7:26 am

by beckdo » Wed Nov 17, 2010 4:45 pm

The SDK has a hard limit at 512 objects. There was a good reason to have that option in the previous SDK to improve performance by limiting the max to less objects but is not necessary in the new SDK.

Regarding ranking objects, the new SDK does not provide a rank or any specific order for objects. That said, it does provide more comprehensive information regarding objects to help users rank objects.

A good example is the Roundness() measurement. For any object you can call object->Roundness() to get a measure of how 'round' the object is. This utilizes a very high performance circle fitting algorithm that will give you a measure of roundness. In Precision Mode, this measurement is exceptionally accurate.

Since we tend to want to track round objects, a good measurement of object rank might be the highest object->Roundness() that is also object->Area() greater than 10 or 20 for example.

The concept of 'rank' is highly dependent on the application. We decided to provide all the high performance telemetry to enable users to fashion any 'rank' metric. Additionally, these calculations can be performed 'late' within the SDK meaning these metrics aren't even calculated unless the application needs them which results in higher performance.
NaturalPoint Employee
NaturalPoint Employee
Posts: 519
Joined: Tue Jan 02, 2007 2:02 pm

by mikeincinci » Wed Nov 17, 2010 5:17 pm

So I need to read ALL tracked objects (in case there exists more than one), and primary sort by roundness, secondary sort by Area?

Does this mean that there are 512 objects to be read every time, even if there is only one bright/round object to track?

Or will there only be as many objects in the frame to read as there are objects available to track?

Posts: 22
Joined: Tue Aug 14, 2007 7:26 am

by mikeincinci » Fri Nov 19, 2010 7:12 am

Anyone have a quick answer?
Posts: 22
Joined: Tue Aug 14, 2007 7:26 am

by Birch » Fri Nov 19, 2010 5:33 pm

Its only necessary to iterate through the number of detected objects, not the potential 512 maximum. You can find out the number of detected objects using frame->ObjectCount(), for example here is some code from one of the sample applications included in the SDK :
Code: Select all
            for(int i=0; i<frame->ObjectCount(); i++)
                cObject *obj = frame->Object(i);

Its also not necessary to sort unless you want to rank them.

We encourage you to review the SDK documentation and sample code to see how the SDK should be used.
Posts: 1139
Joined: Thu Jan 30, 2003 5:00 am
Location: Corvallis, Oregon

by mikeincinci » Mon Nov 22, 2010 7:39 am

Thanks! I called myself looking through all the examples, but I somehow missed that one.
Posts: 22
Joined: Tue Aug 14, 2007 7:26 am

Return to OptiTrack SDK