project 3d pts onto 2d image plane
Hi,now I am trying to project world 3d pts onto 2d image plane,and the results doesn't look right.I am not familiar with the OcMotion dataset,could you please give me some advices?
Here is my code to project points,the R,T,K are all cameras' parameters. RT = torch.cat([torch.tensor(data.R.transpose()), torch.tensor(data.T).reshape(3,1)], -1)[None, None].cuda() xyz = torch.repeat_interleave(world_3d_pts.squeeze(0)[None, None], repeats=RT.shape[1], dim=1) xyz = torch.matmul(RT[:, :, None, :, :3].float(), xyz[..., None].float()) + RT[:, :, None, :, 3:].float() xyz = torch.matmul(torch.tensor(data.K)[None, None][:, :, None].float().cuda(), xyz)[..., 0] xy = xyz[..., :2] / (xyz[..., 2:] + 1e-5) src_uv = xy.view(-1, *xy.shape[2:]).squeeze(0) # (6890,2)
It seems your projection code is wrong. You may refer to Line 63 in this file
The result is still not right..., I'd like to know is R,T in smpl coordinate or world coordinate?
Here is the projected image I get now:
I have added projection code and you can use it by setting is_render = False in Line 92 https://github.com/boycehbz/CHOMP/blob/main/vis_OcMotion.py
sorry for bothering again,but my projection result still seems a bit wrong:
I'm pretty sure my projection code is right because I get the same result using your code.
Here is my code to transform points from canonical space to observation space,I remove 'Th' and get the above result but still not right.
I check my code and found I add wrong transpose on camera.R,now my projection result is like that:
Is this looks right now?