Software Archive
Read-only legacy content
17061 Discussions

render the scene using 3rd lib with Realsense F200

Yixun_L_
Beginner
679 Views

Hi,

I have a F200 camera and I used it to capture a picture of a scene.

Now I want to render the scene using 3rd lib such as OpenGL.

I am not sure if the following way works.

1. I think F200 can give me 3D world coordinates of the scene (vertex coordinate) (not sure if F200 can do this)

2. Take the 2D image as a texture

3. Use OpenGL to render the scene using texture mapping

I am not sure if the above method works.

Thanks.

Xin

0 Kudos
3 Replies
samontab
Valued Contributor II
679 Views

Yes, you can do this.

Get the raw streams, depth and color. Then, you can project one onto the other to match the view of the cameras. You can get the X, Y, Z positions using the queryvertices method of the RealSense SDK.

0 Kudos
Yixun_L_
Beginner
679 Views

Thanks, samontab.

I am not clear about "project one onto the other to match the view of the cameras".

Would you please explain more?

BTW, does the RealSense SDK provide a method to query the projected pixel location for a vertex, i.e. the texture coordinate, so I can use texture mapping.

Do you know how does the result looks like using texture mapping? I need the result quite real, in another word, quite  similar with the 2D camera image. 

Thanks a lot.

Xin

0 Kudos
Yuri_M_Intel
Employee
679 Views

2.6.2 Coordinates Mapping

Example 31: Map Depth to Color Coordinates using UV Mapping
C++
// Create the PXCProjection instance.
PXCProjection *projection=device->CreateProjection();
// color and depth image size.
PXCImage::ImageInfo dinfo=depth->QueryInfo();
PXCImage::ImageInfo cinfo=color->QueryInfo();
// Calculate the UV map.
PXCPointF32 *uvmap=new PXCPointF32[dinfo.width*dinfo.height];
projection->QueryUVMap(depth, uvmap);
// Translate depth points uv[] to color ij[]
for (int i=0;i<npoints;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
delete[] uvmap;
projection->Release();

 

0 Kudos
Reply