Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to do transform on object mesh with obj_pose data #25

Open
dqj5182 opened this issue Oct 1, 2024 · 1 comment
Open

How to do transform on object mesh with obj_pose data #25

dqj5182 opened this issue Oct 1, 2024 · 1 comment

Comments

@dqj5182
Copy link

dqj5182 commented Oct 1, 2024

I am trying to render the object mesh onto the image based on 3D object template, obj_pose data, and camera intrinsic. It seems that camera intrinsic is correct as I can render hand mesh correctly on the image. However, I am having trouble aligning the object mesh onto the image. May I ask how to do it?

For now, I am extracting obj pose / obj trans / obj scale with read_rtd function from readme and conduct rotation / translation / scale with below code.

obj_verts = obj_mesh.vertices
rot_mat =  trimesh.transformations.euler_matrix(obj_rot[0], obj_rot[1], obj_rot[2])[:3, :3]
obj_verts = np.dot(obj_verts, rot_mat.T)
obj_verts = obj_verts + obj_trans
obj_verts = obj_verts * obj_scale

The result from this code is as below.
Uploading obj_mesh.png…

@leolyliu
Copy link
Owner

leolyliu commented Oct 5, 2024

Hi dqj5182,

I cannot see the image. Could you upload it again?
The "obj_scale" should not be used in the transformation. Transforming the object model to the world coordinate system can be done using:

obj_verts = np.dot(obj_verts, rot_mat.T) + obj_trans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants