Wrong global orientation
Mercurialzhang opened this issue · 2 comments
Mercurialzhang commented
def batch_orth_proj(X, camera, mode='2d'):
camera = camera.view(-1, 1, 3)
s = camera[:, :, 0].unsqueeze(-1)
X_trans = X[:,:,:2].contiguous()
if mode=='2d':
X_trans = s * X_trans + camera[:, :, 1:]
return X_trans
elif mode=='v3d':
X[:, :, :2] = s * X_trans + camera[:, :, 1:]
return X
elif mode=='j3d':
X[:, :, :2] = s * X_trans/torch.abs(s) + camera[:, :, 1:]
return X
else:
print('projection mode is not included')
return X
It seems that you directly manipulate the tensor passed in, so verts and verts_cam here are the same value, and vertices of the body model is coupled with the camera.
Arthur151 commented
@Mercurialzhang Yes, you are right!
If you want to get vertices decoupled from the camera rotation, please just make the change like,
verts_camed = util.batch_orth_proj(verts.copy(), cam, mode='v3d')
The code will be revised later. Thanks for your kindness.
Mercurialzhang commented
Thanks for your quick reply! I will have a try