Cannot measure depth when running camera with yaml calibration file

I’m using a Zed Mini and I need to test the effectiveness of different stereo camera calibration methods. To do that, I first need to understand how to use the yaml file using the “optional_opencv_calibration_file” command. I used the factory calibration parameters to create the yaml file, then ran the camera. Everything was fine, the camera seemed to accept the yaml file, but when I checked the depth using the “retrieve_measure(self.xyz_mat, sl.MEASURE.XYZ, sl.MEM.CPU)” command, the result was extremely bad, it fluctuated up to a meter in the same point. I don’t understand why. Obviously, I used the factory calibration parameters, and without using the “optional_opencv_calibration_file” command, the camera worked very accurately.

Hi @phan_hieu
Welcome to the Stereolabs community.

Please share the original calibration file and the YAML file that you created to allow me to compare them and eventually find the issue.

Thanks for the feedback, here are the original Zed Mini calibration parameters and the YAML file I created, I only applied it to 2K resolution. I also think I did something wrong when converting the parameter, but I can’t figure it out, please help me.

Hi @Myzhar

Thanks for the feedback, here are the original Zed Mini calibration parameters and the YAML file I created, I only applied it to 2K resolution. I also think I did something wrong when converting the parameter, but I can’t figure it out, please help me.

How have you calculated the rotation matrix?

that’s also the part i’m not sure about, here’s how i calculated it, i found a mistake in the order of the values ​​and reset it to data: [ 9.9999989258300000e-01, -4.6297400000000000e-04, -1.44251660048203e-06, 4.6297500000000000e-04, 9.9999989300000000e-01, 3.11575462479878e-03, 0, -3.11575495872334e-03, 9.99995146023738e-01 ] but still can not determine the exact depth value, it measured 4 meters at actual distance of 2 meters. And the fluctuation is very large at points of the same depth

Try to use the cv::Rodrigues function: