Items with no label
3335 Discussions

How to use librealsense to find R200 focal length?

ychan261
Beginner
1,900 Views

I use Intel Aero compute board to run my program and I want to know R200's focal length.

I saw a post: , they use the SDK for Windows, I think it can't run on Aero.

0 Kudos
1 Solution
MartyG
Honored Contributor III
864 Views

In Librealsense, the focal length is processed within the rs_intrinsics struct. The fx and fy fields describe the focal length of the image, as a multiple of pixel width and height

In the script in the link below, an example of the use of rs_intrinsics to calculate focal length can be seen in lines 300 to 310 of the script.

https://github.com/IntelRealSense/librealsense/blob/master/include/librealsense/rs.h librealsense/rs.h at master · IntelRealSense/librealsense · GitHub

Line 597 of the script is used to retrieve the details of the intrinsics with the 'rs_get_stream_intrinsics' instruction for any stream which has been enabled with a call to rs_enable_stream or rs_enable_stream_preset.

Full details at this link:

https://github.com/IntelRealSense/librealsense/blob/master/doc/projection.md# intrinsic-camera-parameters librealsense/projection.md at master · IntelRealSense/librealsense · GitHub

View solution in original post

0 Kudos
5 Replies
MartyG
Honored Contributor III
865 Views

In Librealsense, the focal length is processed within the rs_intrinsics struct. The fx and fy fields describe the focal length of the image, as a multiple of pixel width and height

In the script in the link below, an example of the use of rs_intrinsics to calculate focal length can be seen in lines 300 to 310 of the script.

https://github.com/IntelRealSense/librealsense/blob/master/include/librealsense/rs.h librealsense/rs.h at master · IntelRealSense/librealsense · GitHub

Line 597 of the script is used to retrieve the details of the intrinsics with the 'rs_get_stream_intrinsics' instruction for any stream which has been enabled with a call to rs_enable_stream or rs_enable_stream_preset.

Full details at this link:

https://github.com/IntelRealSense/librealsense/blob/master/doc/projection.md# intrinsic-camera-parameters librealsense/projection.md at master · IntelRealSense/librealsense · GitHub

0 Kudos
ychan261
Beginner
864 Views

Thank you, MartyG

But I have another question, why there are fx and fy?

I found a website: https://www.theimagingsource.com/media/blog/archive/20080614/ Lenses Selection and Setup - Part 1 , but I still don't understand what is that mean.

0 Kudos
MartyG
Honored Contributor III
864 Views

I would assume that fx and fy are the horizontal (X) and vertical (Y) length of the focal (F). Hence fx and fy. So on the diagram on the site you linked to, 'focal length of the height' should be fy and 'focal length of the width' should be fx.

In the formulas on that site, object height and the distance between the camera and object are the easiest values to work out.

This image from the R200 data sheet describes the length and width of its field of view for the Color and IR cameras.

0 Kudos
ychan261
Beginner
864 Views

Ok, I understand, and the unit of fx and fy is mm, right?

0 Kudos
MartyG
Honored Contributor III
864 Views

In the web-page about projection that I linked you to, it stated that the default measurement scale for the R200 is mm. I also generally find that mm is the appropriate scale to use with RealSense functions. Also, with real-world cameras the standard measurement scale for focal length is mm.

0 Kudos
Reply