Software Archive
Read-only legacy content

Project color and depth to camera

Mehmet_Akif_C_
Beginner
274 Views

Hi,

How could i project both color and depth to camera to work in real world coordinates in C#?

There are functions ProjectDepthtoCamera and ProjectColortoCamera. Projection from depth to camera is working but I could not understand how could I pass color to related function. ProjectColortoCamera needs color array with depth values. How could I retrieve this array? I could not find any conversion to this type of array.

ProjectColorToCamera(PXCMPoint3DF32[] pos_ijz, PXCMPoint3DF32[] pos3d);

pos_ijz

An array of color coordinates in the Point3DF32 structure. The application must fill the z field with the corresponding depth value.

 

pos3d

An array of world coordinates to be mapped.

 

Thanks

0 Kudos
1 Reply
jb455
Valued Contributor II
274 Views

Hi,

Check out this recent thread where I explained how to do most of what you're after: https://software.intel.com/en-us/forums/realsense/topic/595370

The extra bit (getting the corresponding depth point for a given colour point) uses 

projection.MapColorToDepth(depth, cp, dp);

Where cp is a PXCMPointF32 array (can just be one point or many but not too many or it'll take an age to process), and dp is an empty PXCMPointF32 array the same length as cp.

To get the vertex (which contains real-world coordinates in mm) for the colour point you're interested in then you just get the element of the vertex array corresponding to the depth point we just found: 

var v = vertices[(int)(dp[0].y * depth.info.width + dp[0].x)]

Though make sure your colour point does have corresponding depth data before doing the final bit by checking x & y aren't -1, or you'll get an error.

Good luck!
James

0 Kudos
Reply