3D world coordinates from stereo calibration
Posted: Wed Oct 28, 2020 4:28 pm
I want to get a 3D world coordinate of a point in an image from its pixel coordinate. For this, I have studied that we need extrinsic and intrinsic parameters of a stereo setup.
Now, I have successfully done the stereo calibration. I have set two same cameras 14 cm apart and prepare a stereo setup. I have followed the code provided on your forum up to 4_fisheye_calibration.py. I have calibrated stereo camera setup and obtain RMS error of 0.45. and I have saved the projection matrices for both left and right camera. my projection matrix look like
leftProjection matrix
[[1.17125554e+03 0.00000000e+00 4.23688858e+02 0.00000000e+00]
[0.00000000e+00 1.17125554e+03 9.46732804e+01 0.00000000e+00]
[0.00000000e+00 0.00000000e+00 1.00000000e+00 0.00000000e+00]]
rightProjection matrix
[[ 1.17125554e+03 0.00000000e+00 5.48487792e+02 -9.48032081e+03]
[ 0.00000000e+00 1.17125554e+03 9.46732804e+01 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 1.00000000e+00 0.00000000e+00]]
Now I just want to find the 3D world coordinates of any point in the image with known coordinates. I am using these projection matrices and use them in the cv2.triangulatepoints() function. It gives me a 4x1 matrix. This function gives answers in homogenous coordinate. So I convert this in 3D coordinates by dividing the 4th value in this matrix with the first three values of the matrix. and this will give me world coordinates of the specific points according to my knowledge as far as I have gone through this cv2.triangulatepoints() function.
I am getting a difference of almost half value for X, Y and Z coordinates.i.e for the original distance of 3 meters it is only showing 1.5 meters in the result.
I am following his approach (https://stackoverflow.com/questions/461 ... n-2-7-with)
I have attached the picture from my code for the cv2.triangulatepoints() function.
P.S: The problem is the wrong coordinates that I am getting by this approach. Also, I am not sure if I am using the correct method or not to find the 3D world coordinates. I am stuck at this point. I have no idea what to do next
Kindly guide me if I am following the wrong approach
Now, I have successfully done the stereo calibration. I have set two same cameras 14 cm apart and prepare a stereo setup. I have followed the code provided on your forum up to 4_fisheye_calibration.py. I have calibrated stereo camera setup and obtain RMS error of 0.45. and I have saved the projection matrices for both left and right camera. my projection matrix look like
leftProjection matrix
[[1.17125554e+03 0.00000000e+00 4.23688858e+02 0.00000000e+00]
[0.00000000e+00 1.17125554e+03 9.46732804e+01 0.00000000e+00]
[0.00000000e+00 0.00000000e+00 1.00000000e+00 0.00000000e+00]]
rightProjection matrix
[[ 1.17125554e+03 0.00000000e+00 5.48487792e+02 -9.48032081e+03]
[ 0.00000000e+00 1.17125554e+03 9.46732804e+01 0.00000000e+00]
[ 0.00000000e+00 0.00000000e+00 1.00000000e+00 0.00000000e+00]]
Now I just want to find the 3D world coordinates of any point in the image with known coordinates. I am using these projection matrices and use them in the cv2.triangulatepoints() function. It gives me a 4x1 matrix. This function gives answers in homogenous coordinate. So I convert this in 3D coordinates by dividing the 4th value in this matrix with the first three values of the matrix. and this will give me world coordinates of the specific points according to my knowledge as far as I have gone through this cv2.triangulatepoints() function.
I am getting a difference of almost half value for X, Y and Z coordinates.i.e for the original distance of 3 meters it is only showing 1.5 meters in the result.
I am following his approach (https://stackoverflow.com/questions/461 ... n-2-7-with)
I have attached the picture from my code for the cv2.triangulatepoints() function.
P.S: The problem is the wrong coordinates that I am getting by this approach. Also, I am not sure if I am using the correct method or not to find the 3D world coordinates. I am stuck at this point. I have no idea what to do next
Kindly guide me if I am following the wrong approach