Virtual Zed X One calibration fails: segmentation fault

Hi,

We are trying to calibrate a virtual Zed X One stereo setup using the OpenCV tool. When launching the tool with ./zed_stereo_calibration --h_edges 12 --v_edges 8 --square_size 32 --left_id 0 --right_id 1 --virtual, we get the response:

*** Stereo Camera Calibration Tool ***

The calibration process requires a checkerboard of known characteristics.
 * Expected checkerboard features:
   - Inner horizontal edges:    12
   - Inner vertical edges:      8
   - Square size:               32 mm
Change these parameters using the command line options if needed. Use the '-h' option for help.

 * Lens distorsion model: Radial-Tangential
 * Virtual Stereo Camera mode enabled.
Using camera IDs for left and right cameras: 0, 1
 * Unique Virtual SN: 116170631 (Generated by the ZED SDK)
 * ZED X One GS Virtual Stereo Camera detected.
 * Camera Model: Virtual ZED-X
 * Camera Serial Number: 116170631
 * Camera Resolution: 1920 x 1200
 * Using prior calibration: No
Segmentation fault (core dumped)

Any advice?

1 Like

Hi @andrwr_rev
What’s your setup?

  • ZED SDK version
  • ZED X Driver version
  • OpenCV version

SDK: 5.1

Driver: 1.4.0

OpenCV: 4.8.0

One update though. When we reverted to SDK 5.1, the calibration program opens successfully.

Another issue: in the OpenCV calibration tool, the Calibration Checker is instantiated before the argparsing. So parameters such as v_edges and h_edges are locked to the default, hardcoded values. Results in every sample being rejected if a custom checkerboard is used

What do you mean? Have you used the correct command line options?

I think it is more appropriate to continue this discussion here: Samples from custom checkerboard are always rejected · Issue #2 · stereolabs/zed-opencv-calibration · GitHub

1 Like

Thank you.
I’ve just applied the proposed fix, and I’m waiting for feedback to close your issue.

1 Like

Closed now.

Do you have any comments regarding why the calibration script would fail on SDK 5.2 but not 5.1?

Sincerely, I’ve just tested with SDK v5.2.1 and driver v1.4.0, and it worked correctly.

Please try to set this environment variable before starting the calibration:
export ZED_SDK_DIAGNOSTIC_MODE=1

After the crash, you can find a full debug log in /usr/local/zed/.log.
Please share it with us, together with the full console log.

I am having the exact same issues as well, while trying to calibrate a dual Zed X One stereo setup (using the OpenCV tool), on an AGX Orin 64G with Jetpack 6.2.1, SDK v5.2.1, and quad-driver v1.4.0. I have gotten the same error message (when launching with default checkerboard characteristics - 9x6, 25.4mm):

$ ./stereo_calibration/zed_stereo_calibration --virtual --left_id 0 --right_id 1


*** Stereo Camera Calibration Tool ***

The calibration process requires a checkerboard of known characteristics.
* Expected checkerboard features:
   - Inner horizontal edges:          9
   - Inner vertical edges:            6
   - Square size:               25.4 mm
Change these parameters using the command line options if needed. Use the '-h' option for help.

* Lens distorsion model: Radial-Tangential
* Virtual Stereo Camera mode enabled.
Using camera IDs for left and right cameras: 0, 1
* Unique Virtual SN: 116285092 (Generated by the ZED SDK)
* ZED X One GS Virtual Stereo Camera detected.
* Camera Model: Virtual ZED-X
* Camera Serial Number: 116285092
* Camera Resolution: 1920 x 1200
* Using prior calibration: No
Pos 1
Segmentation fault (core dumped)

I added this into the following code (in the OpenCV calibration’s main.cpp) to determine where this segmentation fault occurs. The “Pos 1” character-output above shows that the fault occurs when trying to retrieve the left camera’s image:

        std::cout << "Calibration aborted by user." << std::endl;
        zed_camera.close();
        return EXIT_SUCCESS;
      }

      const cv::Scalar info_color = cv::Scalar(50, 210, 50);
      const cv::Scalar warn_color = cv::Scalar(0, 50, 250);

      if (zed_camera.grab() == sl::ERROR_CODE::SUCCESS) {
std::cout << "Pos 1" << std::endl;
        zed_camera.retrieveImage(zed_imageL, sl::VIEW::LEFT_UNRECTIFIED);
std::cout << "Pos 2" << std::endl;
        zed_camera.retrieveImage(zed_imageR, sl::VIEW::RIGHT_UNRECTIFIED);

        cv::resize(rgb_l, rgb_d, display_size);
        cv::resize(rgb_r, rgb2_d, display_size);
        cv::resize(rgb_l, rgb_d_fill, display_size);

        applyCoverageIndicatorOverlay(rgb_d_fill, coverage_indicator,
                                      limits_indicator);
        applyPosIndicatorOverlay(rgb_d_fill, pos_indicator);

* The segmentation fault (core dumped) was still occurring, before the code above was ever added.

I have already sent the full debug log, from the export ZED_SDK_DIAGNOSTIC_MODE=1 command to tech support via email.

Hi @dsalasidis
We are trying to replicate this issue, with no success.

Let’s try to obtain more information to understand more.

What’s the output of the command ZED_Explorer -a?

I had already done this and knew the cameras were available, as ZED_Explorer, ZED_Studio, and ZED_Sensor_Viewer can successfully open both Zed X One cameras (the OpenCV Calibration and the Virtual Stereo Camera Sample can not open the cameras).

$ ZED_Explorer -a


## Cam  0  ##
 Model :  "ZED XOne GS"
 S/N :  300785707
 State :  "AVAILABLE"
 Path :  /dev/i2c-13
 ID :  0
 Port :  1
 Type :  "GMSL"
********************
## Cam  1  ##
 Model :  "ZED XOne GS"
 S/N :  308547270
 State :  "AVAILABLE"
 Path :  /dev/i2c-13
 ID :  1
 Port :  3
 Type :  "GMSL"
********************

Does it work if you use the serial numbers instead of the camera id to select them?
Have you pulled the latest version of the repository? We pushed a fix a few days ago.

Unfortunately, it does not work with those arguments either. Crashes at the same location, with the same error.

OK. We are currently performing internal tests to try to replicate your problem because without replicating it, it’s not possible to understand why it’s happening and how to fix it.

If you are unable to reproduce the error, I could offer you to remote desktop into my Jetson in order to potentially debug the problem there.

I was able to replicate the issue with 2x ZED X One S, while the problem is not present with 2x ZED X One GS.

We are digging into this to try to understand what’s happening under the hood.

That’s excellent. I just wanted to mention that I have also tested the calibration using a pair of Zed X One S cameras (that the ZED_Explorer -a oddly reports as ZED X One GS cameras), which also resulted in the same segmentation fault (as when using my original ZED X One GS pair).

To summarize, I am getting the segmentation fault with the ZED X One GS and S cameras.