Multple GeoNode Queries in Unity

Multple GeoNode Queries in Unity

What is the best way to query for a series of GeoNodes? Should each query to a finger be wrapped in a conditional between each acquireframe in update, i.e.: 

void Update(){

AcquireFrame();

if(PXCMGesture.GeoNode.Label.LABEL_BODY_HAND_PRIMARY|PXCMGesture.GeoNode.Label.LABEL_FINGER_INDEX, out gnode)DoTaskA(gnode);

...

if(PXCMGesture.GeoNode.Label.LABEL_BODY_HAND_PRIMARY|PXCMGesture.GeoNode.Label.LABEL_FINGER_THUMB, out gnode)DoTaskT(gnode);

ReleaseFrame();

}

8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

up

There is an inline method which allows applications to query data of multiple GeoNodes. Please check gesture API (related code pasted below).

pxcStatus __inline QueryNodeData(pxcUID user, GeoNode::Label body, pxcU32 ndata, GeoNode *data) {

pxcStatus sts=PXC_STATUS_ITEM_UNAVAILABLE;

for (pxcU32 i=0;i<ndata;i++,body++) if (QueryNodeData(user,body,&data[i])<PXC_STATUS_NO_ERROR)

            data[i].body=GeoNode::LABEL_ANY; else sts=PXC_STATUS_NO_ERROR;

return sts;

 

Okay, so Unity C# can't do pointers like that - do you have a Unity framework specific snippet?

Quote:

Chuck De Sylva (Intel) wrote:

There is an inline method which allows applications to query data of multiple GeoNodes. Please check gesture API (related code pasted below).

pxcStatus __inline QueryNodeData(pxcUID user, GeoNode::Label body, pxcU32 ndata, GeoNode *data) {

pxcStatus sts=PXC_STATUS_ITEM_UNAVAILABLE;

for (pxcU32 i=0;i<ndata;i++,body++) if (QueryNodeData(user,body,&data[i])<PXC_STATUS_NO_ERROR)

            data[i].body=GeoNode::LABEL_ANY; else sts=PXC_STATUS_NO_ERROR;

return sts;

PXCMGesture.GeoNode[] data;

data=new PXCMGesture.GeoNode[6];

pp.QueryGeoNode(PXCMGesture.GeoNode.Label.LABEL_BODY_HAND_PRIMARY,data);

it seems the camera cannot detect my right hand vs left - LABEL_BODY_HAND_LEFT always returned

will the index always be in this order

0 = LABEL_BODY_HAND_LEFT
1 = LABEL_FINGER_THUMB, LABEL_BODY_HAND_LEFT
2 = LABEL_FINGER_INDEX, LABEL_BODY_HAND_LEFT
3 = LABEL_FINGER_MIDDLE, LABEL_BODY_HAND_LEFT
4 = LABEL_FINGER_RING, LABEL_BODY_HAND_LEFT
5 = LABEL_FINGER_PINKY, LABEL_BODY_HAND_LEFT

Quote:

Xintian Wu (Intel) wrote:

PXCMGesture.GeoNode[] data;

data=new PXCMGesture.GeoNode[6];

pp.QueryGeoNode(PXCMGesture.GeoNode.Label.LABEL_BODY_HAND_PRIMARY,data);

Yes But what you can do say you declare a label object such as public PXCMGesture.Label kl and then use it in Update function

after querying the Geonode you can use another if condition and put validation criteria like(kl==PXCMGesture.Label.THUMBS_UP)

then your validation criteria.Hope it helps.Another thing you need to change the kl object in Inspector element.

Abhishek Nandy

It would be more preferable if there is a way to access via associative array. The single-element geonode has each element accessible such, and the multi-dim geonode could be enumerated sdimilarly.

 

Quote:

Abhishek 81 wrote:

Yes But what you can do say you declare a label object such as public PXCMGesture.Label kl and then use it in Update function

after querying the Geonode you can use another if condition and put validation criteria like(kl==PXCMGesture.Label.THUMBS_UP)

then your validation criteria.Hope it helps.Another thing you need to change the kl object in Inspector element.

Leave a Comment

Please sign in to add a comment. Not a member? Join today