Hello, when I was using zed, I met the following problems, they have been bothering me for a long time, could you please help me try to solve them?
First problem, in the installation of zed-sdk, my installation location is: /usr/local/zed, in this directory there is a setting folder, in this folder there is a SN8452341.conf, after opening it will display the following data:
[LEFT_CAM_2K]
fx=1403.76
fy=1403.4
cx=1109.57
cy=592.367
k1=-0.175286
k2=0.0283094
p1=6.68414e-05
p2=-0.000150431
k3=4.06032e-11
[RIGHT_CAM_2K]
fx=1401.93
fy=1402.22
cx=1094.03
cy=622.627
k1=-0.172795
k2=0.0265223
p1=0.000164482
p2=1.02174e-05
k3=-1.0484e-10
[LEFT_CAM_FHD]
fx=1403.76
fy=1403.4
cx=965.57
cy=511.367
k1=-0.175286
k2=0.0283094
p1=6.68414e-05
p2=-0.000150431
k3=4.06032e-11
[RIGHT_CAM_FHD]
fx=1401.93
fy=1402.22
cx=950.03
cy=541.627
k1=-0.172795
k2=0.0265223
p1=0.000164482
p2=1.02174e-05
k3=-1.0484e-10
[LEFT_CAM_HD]
fx=701.88
fy=701.7
cx=641.285
cy=344.1835
k1=-0.175286
k2=0.0283094
p1=6.68414e-05
p2=-0.000150431
k3=4.06032e-11
[RIGHT_CAM_HD]
fx=700.965
fy=701.11
cx=633.515
cy=359.3135
k1=-0.172795
k2=0.0265223
p1=0.000164482
p2=1.02174e-05
k3=-1.0484e-10
[LEFT_CAM_VGA]
fx=350.94
fy=350.85
cx=336.1425
cy=179.59175
k1=-0.175286
k2=0.0283094
p1=6.68414e-05
p2=-0.000150431
k3=4.06032e-11
[RIGHT_CAM_VGA]
fx=350.4825
fy=350.555
cx=332.2575
cy=187.15675
k1=-0.172795
k2=0.0265223
p1=0.000164482
p2=1.02174e-05
k3=-1.0484e-10
[STEREO]
Baseline=119.978
TY=0.0259812
TZ=0.0158877
CV_2K=0.00623976
CV_FHD=0.00623976
CV_HD=0.00623976
CV_VGA=0.00623976
RX_2K=-0.000916611
RX_FHD=-0.000916611
RX_HD=-0.000916611
RX_VGA=-0.000916611
RZ_2K=0.000770041
RZ_FHD=0.000770041
RZ_HD=0.000770041
RZ_VGA=0.000770041
[MISC]
Sensor_ID=0
What does this data mean, in particular RIGHT_CAM_VGA
, RIGHT_CAM_HD
, RIGHT_CAM_FHD]
, TY
, TZ
and V_FHD
, RX_FHD
, RZ_FHD
and so on? In addition, in the SN8452341.conf file, what is the relationship between these parameters and the rotation matrix R and the translation matrix T between the two cameras? If there is a relationship, please use the data here to help me show it, thank you!
The second question is: how is the camera coordinate system of zed camera established? I used the zed data in zed_ros_wrapper package and found that the positive direction of x axis is the vertical mirror facing out, the positive direction of z axis is parallel to the mirror facing up, and the positive direction of y axis is parallel to the mirror from the left eye to the right eye. Is this coordinate axis correct? As shown in the picture below:
There is one last question: After a pixel coordinate (U, V) has been calibrated to obtain the corresponding parameter, can the correct three-dimensional coordinate be obtained through the following code? Please help me answer: Thank you!
#https://blog.csdn.net/qq_45077760/article/details/130091375?spm=1001.2014.3001.5502
import sys
import cv2
import numpy as np
# Binocular camera parameter
class stereoCamera(object):
def __init__(self):
# Left camera parameters
self.cam_matrix_left = np.array([ [479.6018, -0.0769, 652.6060],
[ 0, 478.0229, 352.3870],
[ 0, 0, 1]
])
# Right camera parameters
self.cam_matrix_right = np.array([ [489.9354, 0.2789, 641.6219],
[ 0, 487.9356, 354.5612],
[ 0, 0, 1]
])
# Left and right camera distortion factor:[k1, k2, p1, p2, k3]
self.distortion_l = np.array([[-0.0791, 0.0309, -0.0009, -0.0004, -0.0091]])
self.distortion_r = np.array([[-0.1153, 0.1021, -0.0011, -0.0005, -0.0459]])
# Right camera translation matrix and rotation matrix relative to left camera
# Rotation matrix
self.R = np.array([ [1.0000, 0.0005, -0.0184],
[-0.0005, 1.0000, 0.0001],
[ 0.0184, -0.0001, 1.0000]
])
# Translation matrix
self.T = np.array([[121.4655], [0.2118], [0.5950]])
# Focus Distance
self.focal_length = 749.402 #The default value is generally Q in the stereocorrected reprojection matrix Q[2,3].
# Baseline distance
self.baseline = 121.4655 # Unit: mm, the first parameter of the translation vector (absolute value)
# preconditioning
def preprocess(img1, img2):
# Color image -> Grayscale image
if (img1.ndim == 3): # Determine whether it is a three-dimensional array
img1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY) # Convert from BGR color space to grayscale image.
if (img2.ndim == 3):
img2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
#Histogram equalization
# Histogram equalization is an image enhancement technique, which can improve the contrast of the image and make the distribution of pixel values in the image more uniform.
# In image processing, histogram equalization is often used to improve image brightness and contrast, especially in lighting
img1 = cv2.equalizeHist(img1)
img2 = cv2.equalizeHist(img2)
return img1, img2
# Distortion elimination
# Function returns a dedistorted image
#
# image:The input image is usually a color image
# c