Closed wematan closed 6 years ago
Firstly, you have to perform a roto-translation to have the origin in correspondence to the camera view-point:
Where:
After that, using the field of view parameter (that you can find in the annotation) you have to calculate the field of view:
Now, project the transformed 3D coords (X', Y', Z') over the image plane in order to find 2D coords x and y:
Where W and H are the width and height of the 2D plane (in our case are 1920 and 1080).
Note: all angles are expressed in radiants.
Hi Thanks for the info.
Few other questions regarding the conversion:
Yes, in our .csv, all the angles are in degrees. So, you have to convert FOV, α, β and γ to radiants.
@fabbrimatteo Hi thanks for your explanation, what do you mean about "[α, β, γ] are the components of the camera rotation". Does it mean that the camera is rotated or not? If you could explain, please. thanks in advance
The camera (and every object in a space) is always rotated to some quantity with respect to the reference system of the world. And you need thos values if you want to change your reference system according to the camera.
Hello, sorry for bringing this back up and thanks for what you have shared. I'm using the method you have talked about here (_WORLD3D_TO_SCREEN2D
has the same effect) but I'm getting some weird distortion effects around the edges. Do you know if there would be anyway to fix this? Thanks.
Try using this mod: https://www.gta5-mods.com/misc/no-chromatic-aberration-lens-distortion-1-41
That perfectly fixed my problem, thanks! 😄
Firstly, you have to perform a roto-translation to have the origin in correspondence to the camera view-point:
Where:
- [X, Y, Z] are the 3D coords that you want to convert
- [_X_cam, _Y_cam, _Z_cam] are the 3D coords of the camera
- [α, β, γ] are the components of the camera rotation
After that, using the field of view parameter (that you can find in the annotation) you have to calculate the field of view:
Now, project the transformed 3D coords (X', Y', Z') over the image plane in order to find 2D coords x and y:
Where W and H are the width and height of the 2D plane (in our case are 1920 and 1080).
Note: all angles are expressed in radiants.
Hi, a quick question. In which coordinate system was this? and what is the Up axis?
I do not have such information anymore. But with the new annotations you can use this formula:
Take a look at the pinhole camera model: https://docs.opencv.org/3.4/d9/d0c/group__calib3d.html
Is the focal length in mm or in pixels?
The focal length is in pixels.
Is there an easy way to convert x3D y3D z3D to 2D x,y pixels? The output only contains 3D coordinates.
Thanks.