Hi,sir
I’m using ZED 2i to do stereo camera calibration and depth measurement . Here is my idea:
I catch the raw image, calibrate the stereo camera myself, compare the calibration result with your calibration file, and use this parameter as the basis for depth measurement, but I have problems in the calibration stage and have not yet moved to the next step.
If set the resolution to HD720, then I should get the corresponding values under [LEFT_CAM_HD] and [RIGHT_CAM_HD] in the SN file, right?
When I get the camera parameters from your SDK, the results do not seem to correspond to the parameters under HD720, why? And how should I do?
Here is my code :
Camera zed;
InitParameters Init_Para;
Init_Para.camera_resolution = RESOLUTION::HD720;
Init_Para.camera_fps = 15;
Init_Para.depth_mode = DEPTH_MODE::ULTRA;
Init_Para.coordinate_units = UNIT::MILLIMETER;
Init_Para.camera_disable_self_calib = true;
ERROR_CODE returned_state = zed.open(Init_Para);
if (returned_state != ERROR_CODE::SUCCESS)
{
std::cout << "Error " << returned_state << ", exit program." << endl << endl << endl;
return EXIT_FAILURE;
}
while (i < 5)
{
if (zed.grab() == ERROR_CODE::SUCCESS)
{
zed.retrieveImage(Left_image, VIEW::LEFT_UNRECTIFIED);
zed.retrieveImage(Right_image, VIEW::RIGHT_UNRECTIFIED);
auto timestamp = zed.getTimestamp(TIME_REFERENCE::IMAGE);
Left_image.write((Left_Image_Directory_name + "\\" + to_string(timestamp) + ".png").c_str());
Right_image.write((Right_Image_Directory_name + "\\" + to_string(timestamp) + ".png").c_str());
i++;
}
}
CameraParameters Camera_para_left = zed.getCameraInformation().camera_configuration.calibration_parameters.left_cam;
CameraParameters Camera_para_right = zed.getCameraInformation().camera_configuration.calibration_parameters.right_cam;
//the changing code,and the ohter code is remained
CameraParameters Camera_para_left = zed.getCameraInformation().camera_configuration.calibration_parameters_raw.left_cam;
CameraParameters Camera_para_right = zed.getCameraInformation().camera_configuration.calibration_parameters_raw.right_cam;
cv::Mat DistortionL(8, 1, CV_64F);
//k1,k2,p1,p2,k3
DistortionL.at<double>(0, 0) = Camera_para_left.disto[0];
DistortionL.at<double>(1, 0) = Camera_para_left.disto[1];
DistortionL.at<double>(2, 0) = Camera_para_left.disto[2];
//the other distortion parameters... ...
//my calibration......
the result is:
and the changing code result is:
Some values of the SN file are as follows:
[LEFT_CAM_HD]
fx=534.59
fy=534.455
cx=632.085
cy=356.9815
k1=-0.0680342
k2=0.0484897
p1=-0.000230024
p2=0.000412872
k3=-0.0191863
[RIGHT_CAM_HD]
fx=533.31
fy=533.135
cx=623.805
cy=357.3375
k1=-0.0708259
k2=0.0545271
p1=-0.000345875
p2=-9.04287e-05
k3=-0.0228891
[LEFT_DISTO]
k1=-1.29351
k2=2.42123
k3=0.174327
k4=-1.19905
k5=2.26309
k6=0.340436
p1=-0.000353254
p2=7.36605e-05
[RIGHT_DISTO]
k1=-1.49879
k2=2.89675
k3=0.0692749
k4=-1.40798
k5=2.74192
k6=0.242784
p1=-0.000280535
p2=0.000144192