ZED API doesn't load the correct calibration value from the .conf file

Hi,

Using ZED SDK v.4.0.6 from https://download.stereolabs.com/zedsdk/4.0/whl/linux_x86_64/pyzed-4.0-cp310-cp310-linux_x86_64.whl#sha256=7229223fd5258ed43b6ac81b53b5b4bc0d0c682104ec3ef33b0fda65b046fea2,

I noticed that the value I get from
raw = camera.get_camera_information().camera_configuration.calibration_parameters_raw
is inconsistent with the .conf file.

raw.left_cam returns the coefficient of the right camera
raw.right_cam returns the coefficient of the left camera

Could someone confirm that the API has a bug and the parameters from the conf file are valid?
Could this bug affect rectified calibration parameters by initializing values from the incorrect?

Best,
Noé

Hi @nfntn
thank you for reporting this problem.

Can you verify it the problem persists with the latest ZED SDK v4.0.7?
Please also share the code that you are using so we can easily replicate the behavior and fix the bug.

camera = sl.Camera()
camera.open()
raw_calib = self.camera.get_camera_information().camera_configuration.calibration_parameters_raw
raw_calib_left = raw_calib.left_cam
raw_calib_right = raw_calib.right_cam

and checking the values of their fields against the value in /usr/local/zed/settings/SNXXXXXX.conf
we can see that left and right got inverted.

I haven’t upgraded to v4.0.7 so I haven’t tried.

Reproduced on v.4.0.7

@nfntn can you record a short SVO with ZED Explorer (15 seconds is OK) and share it with us?
You can send it to support@stereolabs.com.
This will allow us to test the code as if we are using your same camera.

We could not reproduce this problem and we want to be sure it’s not happening only with your device.

Sent to the support.

Interestingly, through ZED Explorer, the calibration values are not inverted wrt to the .conf file

Reproduced with a second camera.

Both are ZED2i

We tested also your SVO and it’s not possible to replicate the behavior:
image

What resolution are you using? Is it a problem with a particular resolution or does it happen with all of them?

I am using HD2K. I have not tried at other resolutions.

I may query the parameters with the default resolution (without passing parameters) or using a lower resolution. Checking the distortion coefficients which are resolution independent, I could check that there was no influence of this parameter.

As I said above, ZED Explorer did display the correct coefficient.

I am a bit stumped about what could the cause be.
Since the left and right struct are contiguous, the only thing I can think of is that my pywrapper binding and the source may have them in different orders but that’s unlikely and this not something I can check.

Not sure it helps but here are anonymized code sample, conf file and logs.

I am explicitly fetching the right cam from the API but getting the value of the left cam:

The code:

raw_calib = camera.get_camera_information( frame_grab_res ).camera_configuration.calibration_parameters_raw
left_raw = _raw_calib.right_cam # Hack around ZED API!
distortion_coeffs = left_raw.disto
self.logger.warning(
    {distortion_coeffs=}
)
[LEFT_DISTO] k1=-1.54086 k2=3.71464 k3=-0.0835021 k4=-1.45078 k5=3.57006 k6=0.107865 p1=-0.000324935 p2=0.000233897
Sep 28 11:27:03 distortion_coeffs=array([-1.541, 3.715, -0.000, 0.000, -0.084, -1.451, 3.570, 0.108, 0.000, 0.000, 0.000, 0.000])

Hi @nfntn
we tried many possible ways, but we could not replicate your problem in our lab.

Can you please try to delete the conf file and use this Python script?
The SDK will download a new conf file from our server in case the one you initially downloaded is corrupted:

import pyzed.sl as sl

def printDisto(disto):
    print("[k1",disto[0],
    ", \nk2=",disto[1],
    ", \np1=",disto[2],
    ", \np2=",disto[3],
    ", \nk3=",disto[4],
    ", \nk4=",disto[5],
    ", \nk5=",disto[6],
    ", \nk6=",disto[7],
    ", \ns1=",disto[8],
    ", \ns2=",disto[9],
    ", \ns3=",disto[10],
    ", \ns4=",disto[11],"]")

def main():
    # Create a Camera object
    camera = sl.Camera()

    init = sl.InitParameters()
    #init.set_from_svo_file("D:/SVO/svo_invert.svo")

    camera.open(init)
    raw_calib = camera.get_camera_information().camera_configuration.calibration_parameters_raw
    raw_calib_disto_left = raw_calib.left_cam.disto
    raw_calib_disto_right = raw_calib.right_cam.disto

    print("LEFT -------------")
    printDisto(raw_calib_disto_left)
    print("RIGHT ------------")
    printDisto(raw_calib_disto_right)

    # Close the camera
    camera.close()

if __name__ == "__main__":
    main()

Thank you very much for providing a script. As you can see on the screenshot, the issue is still present:

Tested on a second computer, the issue is not present.
The bug may be specific to my computer/installation. It is running a pretty standard OS and configuration but we could discuss in private if you want more details.

1 Like

We finally found an error source, the values returned depend on how we attach the ZED connector to the camera.

Rotating the connector 180 deg causes us to get inverted values from the API.

Replicated with two different Stereolabs ZED USB connector (right angle and standard).
Replicated with two different cameras.
Replicated with two different computers.

Correction, it seems to be caused by the API detection of whether the camera is flipped upside down.
Flipping the camera causes an inversion of the fields

I can’t understand the connection between the issue and the cause that you just reported, but we are going to test and verify this behavior to understand more about it.

This can make sense indeed. I report this issue to the team and it will be fixed in the next patch release.

Thank you for reporting and helping us finding the cause of the problem :pray:

Thanks for your help.

In the end, I don’t know if this should be considered a bug as it seems to be a feature of the API.
Unfortunately, I didn’t realize this feature existed until now so it was really surprising.

Thanks again

1 Like

If we decide to keep it as is, we’ll document it together with the ‘flip’ parameter.