Closed messmor closed 3 years ago
In render.py
, I calculated camera-centered coordinates by cam = R@world + t
, where t=-RT
.
On the other hand, original world2cam
calculates camera-centered coordinates by cam=(world-T)@R
.
In your case, you are mixing the two functions. If you want to use world2cam
function, you should remove t = -np.dot(R,t.reshape(3,1)).reshape(3) # -Rt -> t
line.
Thank you! This worked.
Hello,
I am using the utility functions
world2camera
andcamera2pixel
to compute the image plane coordinates for the joints locations in the 2D images hand images. I load in the camera parameters R,t just as you do in the render.py code. However when I piece everything together, the joint locations do not match with those in the images (see example below). Any help is appreciated. How are the R and t quantities used to convert from world to camera coordinates?'def cam2pixel(cam_coord, f, c): x = cam_coord[:, 0] / (cam_coord[:, 2] + 1e-8) f[0] + c[0] y = cam_coord[:, 1] / (cam_coord[:, 2] + 1e-8) f[1] + c[1] z = cam_coord[:, 2] img_coord = np.concatenate((x[:,None], y[:,None], z[:,None]),1) return img_coord
def world2cam(world_coord, R, T): cam_coord = np.dot(world_coord-T,R) cam_coord.transpose() return cam_coord
def world2image(joints,cam_params, capture_id, frame_idx, cam, hand_type):
camera extrinsic parameters (t is the translation vector, R is the rotation matrix)
'![PerspectiveProjectionTest](https://user-images.githubusercontent.com/74308853/98823030-2df72d00-23f7-11eb-8498-33d259ca055b.png)