XYZ coordinates with stereo vision [closed]
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 :
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 :
with Q matrix :
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.
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.
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) ?
As far as I know, the (x,y) pixel coords should be in the undistorted and rectified frame.
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"?
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.
And I see you added a new question. Next time consider editing/adding info to your original question.
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 !
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 ?