(mostly solved) Camera intrinsics differ between ZED Explorer and SDK (C++)

Update below. Seems like the parameters in ZED Explorer are for the distorted image but the images I retrieve are undistorted.

Hi

I have a ZED M and noticed that the camera intrinsics differ between what the ZED Explorer and the C++ SDK returns (minimum reproducable example below).

  1. ZED Explorer

In the ZED explorer settings → Calibration view after clicking ‘Factory Reset’
the parameters are hard to read, because the font is very small on my screen, but for the left camera it reads:

left: fx, fy, cx, cy, k1
1398.6500, 1398.6500, 982.5000, 546.2330, -0.1745

with the live view set to HD1080, 30 FPS

These values don’t change if I reopen the ZED Explorer

Update: I found the same parameters in the C:\ProgramData\Stereolabs\settings\SN*.conf file:

[LEFT_CAM_FHD]
fx=1398.65
fy=1398.65
cx=982.5
cy=546.233
k1=-0.174527

2a) SDK with camera_disable_self_calib = true

If I query these parameters in the SDK (minimal reproducable example below) and with

init_parameters.camera_disable_self_calib = true;

I get:

run 1:
left: fx, fy, cx, cy, k1
1436.33, 1436.33, 934.136, 577.175, 0

run 2:
left: fx, fy, cx, cy, k1
1436.33, 1436.33, 934.136, 577.175, 0

run3:
left: fx, fy, cx, cy, k1
1436.33, 1436.33, 934.136, 577.175, 0

As expected, these parameters don’t change between runs but they are very different from the ones provided by the ZED Explorer.
Note, that k1 is zero in the SDK, but non-zero in the ZED Explorer (this is also true for k2, p1 and p2).

2b) SDK with camera_disable_self_calib = false

init_parameters.camera_disable_self_calib = false;

run 1:
left: fx, fy, cx, cy, k1
1431.21, 1431.21, 934.142, 577.158, 0

run 2:
left: fx, fy, cx, cy, k1
1430.95, 1430.95, 934.141, 577.166, 0

run 3:
left: fx, fy, cx, cy, k1
1431.36, 1431.36, 934.141, 577.164, 0

Here the parameters differ slightly between runs but the difference between runs or camera_disable_self_calib = true
is smaller than the difference of the parameters given by the ZED explorer.

  1. Minimal reproducable C++ example

#include <iostream>
#include <sl/Camera.hpp> 


int main()
{
    sl::Camera zed;
    sl::InitParameters init_parameters;
    init_parameters.input.setFromCameraID(0);
    init_parameters.camera_resolution = sl::RESOLUTION::HD1080;
    init_parameters.camera_disable_self_calib = true;

    if (zed.open(init_parameters) == sl::ERROR_CODE::SUCCESS)
    {
        sl::CalibrationParameters calibration_params = zed.getCameraInformation().camera_configuration.calibration_parameters;

        //print camera parameters to console        
        std::cout << "left: fx, fy, cx, cy, k1\n";
        std::cout << calibration_params.left_cam.fx << ", " << calibration_params.left_cam.fy << ", ";
        std::cout << calibration_params.left_cam.cx << ", " << calibration_params.left_cam.cy << ", ";
        std::cout << calibration_params.left_cam.disto[1] << "\n";

    }

    zed.close();
}

So, which parameters are correct? Any help appreciated.

Update:
4) SDK using sl::CalibrationParameters calibration_params = zed.getCameraInformation().camera_configuration.calibration_parameters_raw ;

I get
left: fx, fy, cx, cy, k1
1398.65, 1398.65, 982.5, 546.233, 0.0276319

So, image center points and focal length are now the same as in the ZED Explorer but the radial distortion coefficient is not.

Since Im retrieving images via

zed.retrieveImage(imgLeftSL, sl::VIEW::LEFT_GRAY);

and not

zed.retrieveImage(imgLeftSL, sl::VIEW::LEFT_UNRECTIFIED_GRAY );

I suppose, I don’t have to worry about those raw values and can just use the values from the top with distortion parameters beeing zero.

I have a ZED M and noticed that the camera intrinsics differ between what the ZED Explorer and the C++ SDK returns (minimum reproducable example below).

When you call the open function the ZED SDK grabs a few frames and performs a calibration tuning to compensate for lenses modification produced by temperature changes or little bumps that the camera can have received.
This is way you are getting different intrinsic parameters.

You can disable this behavior by setting the parameter InitParameter::camera_disable_self_calib to true:
https://www.stereolabs.com/docs/api/structsl_1_1InitParameters.html#affeaa06cfc1d849e311e484ceb8edcc5

Hi Myzhar

thanks a lot for your reply. As you can see from my original post, I tested with and without InitParameter::camera_disable_self_calib set to true.

I suppose, I don’t have to worry about those raw values and can just use the values from the top with distortion parameters beeing zero.

That’s correct. If you use the rectified images the distortion parameters are indeed null.

1 Like