How to transform the world coordinates of an object to 2D coordinates on the camera frame?
Hi,
I would like to get the 2D coordinates of an object in a certain camera frame. So far I know that the simGetObjectPose() can return the 3D pose of the object in the world frame and the simGetCameraInfo() can return the 3D pose of the certain camera, along with a 4 by 4 projection matrix. I am not sure what exactly is this 4 by 4 matrix because the camera projection matrix should be 4 by 3 usually. So how should I combine those things to get what I want. Does anyone have any ideas on it? Thanks for your help.
Is this for Unity or Unreal? Not sure what your trying to do, but if this is in Unity and if for example you want to place a bull-eye sprite image on top of an object visible in the camera view you could do something like this https://docs.unity3d.com/ScriptReference/Camera.WorldToScreenPoint.html Sorry, I have no idea how to do this in Unreal.
@jasonhbartlett Thanks for your help. However I want to achieve this in Unreal.
If I remember correctly, there is an extra row in the projection matrix that just has a -1 at the end. However our projection matrix is not quite right unless the camera is pointing straight down. You'd have to use the FOV to compute the projection matrix yourself. In the meantime I'm entering this as a bug.
Hi,
I would like to get the 2D coordinates of an object in a certain camera frame. So far I know that the simGetObjectPose() can return the 3D pose of the object in the world frame and the simGetCameraInfo() can return the 3D pose of the certain camera, along with a 4 by 4 projection matrix. I am not sure what exactly is this 4 by 4 matrix because the camera projection matrix should be 4 by 3 usually. So how should I combine those things to get what I want. Does anyone have any ideas on it? Thanks for your help.
Hi @flyers , Have you solved this problem?I am also confused about this 4X4 matrix . Thanks!