XYZ coordinates with stereo vision

asked 2019-06-15 08:19:38 -0500

kobeking gravatar image

Hello everyone,

I work on a project where the goal is to detect and track and object, and then be able to compute the XYZ coordinates of the center of this object. I need you because I'm having some trouble understanding the reference point of my coordinate system. Below, you can see what are the results I get and I circled in red the XYZ coordinates I get. I thought that the reference point of these coordinates was the middle of my left camera, as all the calibration process has been done with the left camera as a reference. But the coordinates do not refer to the left camera lens as I tought, there are offset and so it probably means that the reference point is supposed to be somewhere else ....

Results :

image description

Until know, I have been able to compute a disparity map that looks not too bad after having done all the necessary steps (individual camera calibration, stereo calibration, rectification and undistortion). The disparity map has been generated using the SGBM algorithm and then the WLS filter has been used to finally get the disparity map shown above. The next step was to track an object using the CSRT algorithm, compute the center of that object and then look the disparity value at that point on the disparity map. Once this has been done, I thought that the XYZ coordinates of the center of the object could be obtained by computing :

image description

with Q matrix :

image description

By doing this, does anyone know what is the reference point of the XYZ coordinates that I compute if it is not the left camera lens ?

Thank you.

edit retag flag offensive close merge delete

Comments

Do cx and cy correspond to the center of your image or are they off-center? If substantially off-center, try calibrating with fixed principle points.

Der Luftmensch gravatar imageDer Luftmensch ( 2019-06-15 08:37:07 -0500 )edit

Thank you for your reply, I will try it and let you know the answer to your question soon. In the mean time, I just had an other question that might be the reason of the problem :

When computing the matrix multiplication that I wrote : [Q] * {x, y, d, 1}Translated , do the x and y coordinates need to be in the original frame (not undistorted) or in the rectified frame (undistorted) ?

kobeking gravatar imagekobeking ( 2019-06-15 09:02:37 -0500 )edit

As far as I know, the (x,y) pixel coords should be in the undistorted and rectified frame.

Der Luftmensch gravatar imageDer Luftmensch ( 2019-06-17 06:58:34 -0500 )edit

In the Q matrix, cy = 208 and cx = 451 for a 480 (number of lines) x 640 (number of columns) frame.... How is it possible that the cx and cy are that much off-center?

Also, what do you mean by " calibrating with fixed principle points"?

kobeking gravatar imagekobeking ( 2019-06-20 03:54:43 -0500 )edit

Fixing the principle point allows you to force cx and cy to be W/2 and H/2. This leads to more intuitive 3D coords. They are off center because they are the optimized distortion model center.

Der Luftmensch gravatar imageDer Luftmensch ( 2019-06-20 06:39:33 -0500 )edit

And I see you added a new question. Next time consider editing/adding info to your original question.

Der Luftmensch gravatar imageDer Luftmensch ( 2019-06-20 06:40:49 -0500 )edit

By "optimized distortion model center", do you mean that it is off-center because it represents the optical center of the frame obtained after undistortion ? If yes, then isn't it "normal" that they are off-center ?

Yes I added a new question, I thought that the subject of the question wasn't really the same as the one in this post.

Also, thank you very much for answering all my questions and trying to help me, it means a lot !

kobeking gravatar imagekobeking ( 2019-06-20 07:22:23 -0500 )edit

Also, I have one more question, does the center of projection (the reference point of the camera) physically represent the center of the lens of the camera ?

kobeking gravatar imagekobeking ( 2019-06-20 08:21:43 -0500 )edit