Transfer stereoParams to ROS

5 visualizaciones (últimos 30 días)
Martin Herrmann
Martin Herrmann el 29 de Ag. de 2018
Comentada: Jake Bonney el 6 de Ag. de 2020
I have problems transferring the stereo camera calibration results from matlab to ROS. The problem is, ROS expects me to fill out a field projection matrix and rectification matrix and I can't find much help how these matrices are build, except CameraInfo. I know that I'm posting to the matlab central forum, but since matlab supports a log ROS-tools I hope to find help here.
1. Rectification matrix: The documentation says
# Rectification matrix (stereo cameras only)
# A rotation matrix aligning the camera coordinate system to the ideal
# stereo image plane so that epipolar lines in both stereo images are
# parallel.
float64[9] R # 3x3 row-major matrix
In my eyes the rectification matrix for the left image then should be the identity matrix and the one of the right image should equal stereoParams.RotationOfCamera2, is that correct?
2. Projection matrix: The documentation says
# Projection/camera matrix
# [fx' 0 cx' Tx]
# P = [ 0 fy' cy' Ty]
# [ 0 0 1 0]
# By convention, this matrix specifies the intrinsic (camera) matrix
# of the processed (rectified) image. That is, the left 3x3 portion
# is the normal camera intrinsic matrix for the rectified image.
# It projects 3D points in the camera coordinate frame to 2D pixel
# coordinates using the focal lengths (fx', fy') and principal point
# (cx', cy') - these may differ from the values in K.
# For monocular cameras, Tx = Ty = 0. Normally, monocular cameras will
# also have R = the identity and P[1:3,1:3] = K.
# For a stereo pair, the fourth column [Tx Ty 0]' is related to the
# position of the optical center of the second camera in the first
# camera's frame. We assume Tz = 0 so both cameras are in the same
# stereo image plane. The first camera always has Tx = Ty = 0. For
# the right (second) camera of a horizontal stereo pair, Ty = 0 and
# Tx = -fx' * B, where B is the baseline between the cameras.
# Given a 3D point [X Y Z]', the projection (x, y) of the point onto
# the rectified image is given by:
# [u v w]' = P * [X Y Z 1]'
# x = u / w
# y = v / w
# This holds for both images of a stereo pair.
float64[12] P # 3x4 row-major matrix
This doesn't help me much. i) Tx, Ty seem clear, I can get them from the stereoParams.TranslationOfCamera2. However, does anybody know if ROS is able to handle a Tz? ii) Does anybody know how fx', fy', cx' and cy' are computed? iii) I found Matlab CameraMatrix documentation which describes how to calculate such matrices. However such matrix will never lead to the structure given in the ROS documentation.
Thank you very much for your help.
  1 comentario
Jake Bonney
Jake Bonney el 6 de Ag. de 2020
Currently working on this same problem. Did you ever solve this?

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by