Hi,
with the standard Pinhole depth camera, projection from 3D to 2D can be obtained easily:
view_proj_matrix = # From SD Helper
homo = np.pad(points, ((0, 0), (0, 1)), constant_values=1.0)
tf_points = np.dot(homo, view_proj_matrix)
tf_points = tf_points / (tf_points[..., -1:])
tf_points[..., :2] = 0.5 * (tf_points[..., :2] + 1)
return tf_points[..., :3]
However, the inverse of that is not as straight forward. In conventional terms we usually have P_2d = K.[R|t] P_3d and easily reverse that to inv(K[R|t]) P_2d = P_3d. In Isaac sim, the convention seems to be different, in that there is some division. I am not sure what tf_points = tf_points / (tf_points[..., -1:])
is supposed to be.
I get P_(3d,cam) by the standard method:
x = (u - u0) * depth[v, u] / fx
y = (v - v0) * depth[v, u] / fy
z = depth[v, u]
cam_points[i] = (x, y, z)
But then doing P_(3d,cam).T_(view to world)
actually produces wrong results, likely due to something else that I am missing in getting P_(3d,cam). I think Isaac swaps axes somewere, maybe distorts the image? Could you point me to a tutorial or show me how I can reverse the 2D to 3D points.