Software Archive
Read-only legacy content
17061 Discussions

query device & vertices

agund4
Novice
877 Views

Dear All,

I'm using c# interface

I need to get the x,y,z  coordinates of  22 points in hand module.

I found that query vertices is the option to do that.

Can some one help me with- the code to create a instance for pxcmcapture.device  and help me with the required code to get vertices using queryvertices function.

 

I am trying to develope hands console(which is in cpp  in sample browser) in  c# environment

0 Kudos
3 Replies
jb455
Valued Contributor II
877 Views

To start off you need the SenseManager:

pSenseManager = PXCMSenseManager.CreateInstance();

Then the device instance:

var device = pSenseManager.captureManager.QueryDevice();

Get the depth photo & data:

PXCMCapture.Sample photo = pSenseManager.QuerySample();
PXCMImage depth = photo.depth;
PXCMImage.ImageData ddata;
depth.AcquireAccess(PXCMImage.Access.ACCESS_READ, out ddata);

Set up the projection:

projection = device.CreateProjection();

Then get the vertices:

PXCMPoint3DF32[] vertices = new PXCMPoint3DF32[depth.info.width * depth.info.height];
projection.QueryVertices(depth, vertices);

Note, the projection and vertices take a fair amount of processing and memory so I'd advise against updating those every frame. Also make sure you Dispose and/or Release everything when you're done with it each frame or the memory will keep piling up!

Let me know if you need any more help!

0 Kudos
agund4
Novice
877 Views

Dear James..

Greetings!!!

Thank you it helped me..

I was using FF Hands console in cpp.

plz help me in decreasing the frame rate .

Very new to cpp, real sense. Kindly please help me with exact location.

0 Kudos
jb455
Valued Contributor II
877 Views

Hi,

If you want to only do the calculations every few frames (is this what you meant?), you can do something like (again, C# as I don't know C++ but I'd imagine it'd be similar):

int frameCount = -1 //before the loop starts (start at -1 so it does the calculations on the first frame)

//inside the while loop which does the imaging stuff:
if
((frameCount++) % 10 == 0)
  [do stuff]

Where you replace 10 with however often you want to update everything (so if your camera stream is 30fps this'll go 3 times per second)

James

0 Kudos
Reply