Items with no label
3335 Discussions

How to properly calculate intrinsics for the depth frame?

PTozo
Beginner
2,103 Views

I'm writing a custom system and would very much like to call the functions rs2_project_point_to_pixel() and rs2_deproject_pixel_to_point() in order to do things like creating my own point cloud (or at least, I plan to copy/paste and adapt these into my own apps).

To do this, I need to pass in a pointer to an rs2_intrinsics object.

All well and good ... Looking at https://github.com/IntelRealSense/librealsense/wiki/API-How-To%23get-video-stream-intrinsics https://github.com/IntelRealSense/librealsense/wiki/API-How-To# get-video-stream-intrinsics , it appears that I can use the quoted code in the "Get Field of View" section:

rs2::pipeline pipe;

rs2::pipeline_profile selection = pipe.start();

auto depth_stream = selection.get_stream(RS2_STREAM_DEPTH)

.as();

auto i = depth_stream.get_intrinsics();

Looking in the variable 'i' in the debugger, it appears to be ALMOST correct ... everything is filled in with what appear to be correct values EXCEPT for the distortion coefficients (rs2_intrinsics::coeffs) which are all 0 -- and that can't possibly be correct?

I will actually need those values to be filled in properly to call those functions I mentioned.

So -- how to fill in the distortion coefficients?

0 Kudos
1 Solution
jb455
Valued Contributor II
844 Views

This is likely to be more helpful:

We're assuming that the image has already been rectified, so the distortion of the image you receive is 0. This hasn't been confirmed by Intel devs however.

View solution in original post

0 Kudos
3 Replies
MartyG
Honored Contributor III
844 Views

I'm not sure if this will be helpful, but the link below shows the section of SDK 2.0 script code that generates the Modified Brown-Conrady distortion.

Similar code for Modified Brown-Conrady can be found in SDK 2.0's rsutil.h. file.

https://unanancyowen.github.io/librealsense2_apireference/rsutil_8h_source.html Intel® RealSense™ Cross Platform API: C:/librealsense-2.10.3/include/librealsense2/rsutil.h Source File

0 Kudos
jb455
Valued Contributor II
845 Views

This is likely to be more helpful:

We're assuming that the image has already been rectified, so the distortion of the image you receive is 0. This hasn't been confirmed by Intel devs however.

0 Kudos
PTozo
Beginner
844 Views

Ah, thanks! Yes, would love to hear from the Intel devs from this.

I'll try it with 0's and see if that works. Would certainly let me simplify the code considerably if I knew in advance that they'd always be 0 ...

0 Kudos
Reply