Update calibration using librealsense API
Hi everyone,
I'm working on a project using D415 cameras, and I wish to update the calibration values (intrinsic and extrinsic) from the librealsense API.
NB: firmware version is 5.12.15.50
Right now I have a code looking like this :

However this does not work at all, and I can't get my camera to work anymore because when starting the pipeline I get the error messsage:
No intrinsics are available for this stream profile!
-
Hi Thomas Specte The official documentation for the rs2_set_intrinsics() SDK instruction is here:
A C++ example of implementing the instruction is in the SDK's rs_sensor.h file:
If your camera is not working correctly when starting the pipeline after using your calibration code then please try the instructions at the link below to use the RealSense Viewer tool to restore the camera to its default factory-new calibration.
https://github.com/IntelRealSense/librealsense/issues/10182#issuecomment-1019854487
-
rs_sensor.h is not an SDK example program, but a file from the RealSense SDK that I quoted as a demonstration of code. Quoting code from the SDK's operating files is a useful way to illustrate use of an instruction if there is not an example program that uses that instruction. My apologies for the confusion!
-
Hey Marty,
I tried several things but I still can't get it to work: I can retrieve the intrinsics parameters from a sensor, apparently I can use the function rs2_set_intrinsics, but when I start streaming the intrinsics I get from active sensor are not the one I'm expecting.
Are there some steps I should respect before trying to modify the intrinsics parameters ?
Here is the code I'm using:

-
There are very few references about setting custom intrinsics for a live camera unfortunately, the main one that I know of being a Python case where the RealSense user created an rs2.intrinsics object.
https://github.com/IntelRealSense/librealsense/issues/4061
Defining custom intrinsics and extrinsics is more often associated with setting up a 'synthetic camera' using the SDK's software_device interface. The SDK's C++ example program rs-software-device can be found at the link below:
https://github.com/IntelRealSense/librealsense/tree/master/examples/software-device
-
Thanks for the references ! Indeed I didn't find anything closely related to what I was trying to do :(
A thing though, the error message I showed you seems to tell me that since I'm not using a "T2XX" camera I can't change the intrinsics using this method:
"Object does not support "librealsense::tm2_sensor_interface" interface!"
Do you know if there is such a limitation with D400s cameras ?
https://intelrealsense.github.io/librealsense/doxygen/classrs2_1_1tm2.html


-
I checked the API Changes notes and they confirmed that rs2_set_intrinsics and rs2_set_extrinsics - which were introduced in SDK version 2.27.0 - are T265-exclusive instructions.
https://github.com/IntelRealSense/librealsense/wiki/API-Changes#version-2270
Whilst the notes suggested that the instructions could be implemented in future SDKs, this is the only reference to them in the API Changes notes, indicating that they likely remain only supported for the T265 Tracking Camera model unfortunately.
-
Page 62 of the PDF user guide for the RealSense SDK's Dynamic Calibration tool provides details of how to write custom calibration parameters to a camera using the tool's CustomRW command-line program.
In another discussion on this subject, I have previously suggested exporting the current calibration of the camera to an xml file using CustomRW, editing the calibration values of the file in a text editor and then loading the amended xml file back in and writing its details to the camera hardware.
-
Hi Marty,
Still on the same problem (to update the intrinsics parameters values from the RealSense API),
I had a look at the DynamicCalibrationAPI as you told me, I thought that I could use the functions "ReadCalibrationParameters" & "WriteCustomCalibrationParameters", however after using this function with some custom values, when I check the intrinsics from the rs2::sensor objects, they don't seem to have changed.

Do you know if I use these functions correctly ?
-
The free version of the Dynamic Calibration tool only calibrates extrinsics. For the majority of users, calibrating the extrinsics only will be fine as it is the extrinsics that will have the most impact when performing calibration.

To calibrate both intrinsics and extrinsics with the Dynamic Calibration tool, the OEM version of the tool that is supplied with Intel's $1500 USD 'OEM Calibration Target' board is required. This product is targeted at settings such as engineering departments and manufacturing facilities.
https://store.intelrealsense.com/buy-intel-realsense-d400-cameras-calibration-target.html
The On-Chip calibration tool can calibrate intrinsics and extrinsics, though as separate calibration operations rather than both at the same time.
Please sign in to leave a comment.



Comments
14 comments