CHOMP icon indicating copy to clipboard operation
CHOMP copied to clipboard

project 3d pts onto 2d image plane

Open muses0229 opened this issue 1 year ago • 3 comments

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?

muses0229 avatar Feb 22 '24 08:02 muses0229

22

muses0229 avatar Feb 22 '24 08:02 muses0229

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)

muses0229 avatar Feb 22 '24 08:02 muses0229

It seems your projection code is wrong. You may refer to Line 63 in this file

boycehbz avatar Feb 22 '24 08:02 boycehbz

The result is still not right..., I'd like to know is R,T in smpl coordinate or world coordinate?

muses0229 avatar Feb 22 '24 13:02 muses0229

Here is the projected image I get now: bb

muses0229 avatar Feb 22 '24 14:02 muses0229

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

boycehbz avatar Mar 04 '24 10:03 boycehbz

sorry for bothering again,but my projection result still seems a bit wrong: 22 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. DZNY81JTI`2}7R}0QQ@@B_U

muses0229 avatar Mar 05 '24 14:03 muses0229

I check my code and found I add wrong transpose on camera.R,now my projection result is like that: F2N%KB SG13W$JUTBBEK~5L Is this looks right now?

muses0229 avatar Mar 06 '24 01:03 muses0229