Software Archive
Read-only legacy content
17061 Discussions

Depth coordinate in QueryVertices() function

Amit_T_
Beginner
479 Views

Hi,

In IQSampleTool application, the specified function returns a vertices array of 3D points (PXCMPoint3DF32[]). These points suppose to have 3 'single' fields - x,y,z.

However, the z field of all points of the vertices array retrieved by the function always seems to have an integer value. Is it necessarily the case? Do these vertices points always have an integer z value?

0 Kudos
9 Replies
jb455
Valued Contributor II
479 Views

Yes they do, annoyingly! If you want float values for depth you'll have to do depthImage.AcquireAccess() with a float pixel format then use depthData.ToFloatArray(), and use these z values along with the x & y you get from the vertices.

0 Kudos
Amit_T_
Beginner
479 Views

Thanks.

I am trying to follow your instructions, but the change from depthData.ToUShortArray() to depthData.ToFloatArray() cause this runtime exception: "System.AccessViolationException - Attempted to read or write protected memory".

Do you know what is it about and how to resolve it?

0 Kudos
jb455
Valued Contributor II
479 Views

Are you using PXCMImage.PixelFormat.PIXEL_FORMAT_DEPTH_F32?

0 Kudos
Amit_T_
Beginner
479 Views

Yes. This format changes the pixels resolution from 640*480 to 1280*480.

But the same exception is thrown when using both formats (PIXEL_FORMAT_DEPTH_F32 and PIXEL_FORMAT_DEPTH).

Attached is the exception details.

0 Kudos
Amit_T_
Beginner
479 Views

We solved the problem. Sorry for the trouble.

The problem was dividing by sizeof(float) instead of sizeof(ushort)...

Now it's working, thank you very much.

0 Kudos
jb455
Valued Contributor II
479 Views

Hmm, not sure what that could be.. I presume dpixels is of float[] type? My code is in bits at the moment so I can't test for you but I don't remember seeing this error before. Perhaps someone else can help?

0 Kudos
Dmitry_Z_Intel
Employee
479 Views

Please note this rounding behavior of QueryVertices() was fixed for future SDK releases.

0 Kudos
Amit_T_
Beginner
479 Views

Great, thank you.

0 Kudos
jb455
Valued Contributor II
479 Views

DMITRY Z. (Intel) wrote:

Please note this rounding behavior of QueryVertices() was fixed for future SDK releases.

That's good to hear! Is there anything you can share with us as to when we can expect the next release?

0 Kudos
Reply