Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
24 Views

Depth coordinate in QueryVertices() function

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
Highlighted
Valued Contributor II
24 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
Highlighted
Beginner
24 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
Highlighted
Valued Contributor II
24 Views

Are you using PXCMImage.PixelFormat.PIXEL_FORMAT_DEPTH_F32?

0 Kudos
Highlighted
Beginner
24 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
Highlighted
Beginner
24 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
Highlighted
Valued Contributor II
24 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
Highlighted
Employee
24 Views

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

0 Kudos
Highlighted
Beginner
24 Views

Great, thank you.

0 Kudos
Highlighted
Valued Contributor II
24 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