Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Amit_T_
Beginner
146 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
jb455
Valued Contributor II
146 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.

Amit_T_
Beginner
146 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?

jb455
Valued Contributor II
146 Views

Are you using PXCMImage.PixelFormat.PIXEL_FORMAT_DEPTH_F32?

Amit_T_
Beginner
146 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.

Amit_T_
Beginner
146 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.

jb455
Valued Contributor II
146 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?

Dmitry_Z_Intel
Employee
146 Views

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

Amit_T_
Beginner
146 Views

Great, thank you.

jb455
Valued Contributor II
146 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?

Reply