Software Archive
Read-only legacy content
17061 Discussions

Coordinates Mapping

Tomer_G_1
Beginner
171 Views

This example is incomplete . I need to know what kind of  array type and size is:  uv and ij ?

 

Thanks

 

 

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/manuals_coordinates_mapping.html

 

// Create the PXCMProjection instance.

PXCMProjection projection=device.CreateProjection();

 

// color and depth image size.

PXCMImage.ImageInfo dinfo=depth.info;

PXCMImage.ImageInfo cinfo=color.info;

 

// Calculate the UV map.

PXCMPointF32[] uvmap=new PXCMPointF32[dinfo.width*dinfo.height];

projection.QueryUVMap(depth, uvmap);

 

// Translate depth points uv[] to color ij[]

for (int i=0;i<uv.Length;i++) {

   ij.x=uvmap[(int)uv.y*dinfo.width+(int)uv.x].x*cinfo.width;

   ij.y=uvmap[(int)uv.y*dinfo.width+(int)uv.x].y*cinfo.height;

}

 

// Clean up

projection.Dispose();

0 Kudos
1 Reply
jb455
Valued Contributor II
171 Views

I think what they're trying to do here is to map a few depth points to colour points. so uv will be an array of PXCMPointF32 points in the depth image that you're interested in, and ij will be the same size and type.

So if you had 3 points of interest in the depth image, you'd set uv and ij to be an array of size 3, then set uv[0] = (a,b), uv[1] = (c,d) and uv[2] = (e,f). Then after you loop through, ij[0] will be the colour coordinates of the point uv[0] etc.

The docs and samples for using projections in C# aren't great unfortunately. I've been working on RealSense stuff for over 6 months and only just managed to get to grips with (some) things, mostly through trial and error.

0 Kudos
Reply