View my account

Update calibration using librealsense API

Comments

14 comments

  • MartyG

    Hi Thomas Specte  The official documentation for the rs2_set_intrinsics() SDK instruction is here:

    https://intelrealsense.github.io/librealsense/doxygen/rs__sensor_8h.html#ac1e8ebbd1e75fac3f1d7e9cc174dadbd

     

    A C++ example of implementing the instruction is in the SDK's rs_sensor.h file:

    https://github.com/IntelRealSense/librealsense/blob/master/include/librealsense2/h/rs_sensor.h#L595-L611

     

    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

    0
    Comment actions Permalink
  • Thomas Specte

    Hey MartyG, thanks for your answer !

    I can't find the C++ example you're talking about. Within the file rs_sensor.h I only read the same comments which are in your first link (official documentation). 

    0
    Comment actions Permalink
  • MartyG

    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!

    0
    Comment actions Permalink
  • Thomas Specte

    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:

    0
    Comment actions Permalink
  • Thomas Specte

    Update: I show you here the error message I got from rs2_set_intrinsics function

    Here is the code that prints it

    Here is the output:

    0
    Comment actions Permalink
  • MartyG

    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

    0
    Comment actions Permalink
  • Thomas Specte

    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

     

    0
    Comment actions Permalink
  • MartyG

    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.

    0
    Comment actions Permalink
  • Thomas Specte

    Once again thanks for your help :)

    We will have to choose another way to do this then.

    0
    Comment actions Permalink
  • Thomas Specte

    Hi Marty,

    Following my previous questions, is there a command line tool (within RealSense SDK) that I can use to update the intrinsics and extrinsics of a specific sensor / profile ?

    0
    Comment actions Permalink
  • MartyG

    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.  

    https://www.intel.com/content/www/us/en/support/articles/000026723/emerging-technologies/intel-realsense-technology.html

     

    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.

    0
    Comment actions Permalink
  • Thomas Specte

    Nice ! Thanks for those tips 

    0
    Comment actions Permalink
  • Thomas Specte

    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 ?

    0
    Comment actions Permalink
  • MartyG

    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.

    0
    Comment actions Permalink

Please sign in to leave a comment.