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

clarification of OLD issue - Smpl body to image projection #127

Open
Dipankar1997161 opened this issue Aug 4, 2023 · 0 comments
Open

clarification of OLD issue - Smpl body to image projection #127

Dipankar1997161 opened this issue Aug 4, 2023 · 0 comments

Comments

@Dipankar1997161
Copy link

Hey @mks0601, hope you doing well.

I actually came across your issue regarding the smpl body projection to image #classner/up#17 (comment)

I used the following projection function but unsure if the points are correct.

def perspective_projection_custom(points, rotation, translation, focal_length,
                           camera_center):
    """
    This function computes the perspective projection of a set of points.
    Input:
        points (bs, N, 3): 3D points
        rotation (bs, 3, 3): Camera rotation
        translation (bs, 3): Camera translation
        focal_length (bs,) or scalar: Focal length
        camera_center (bs, 2): Camera center
    """
    batch_size = points.shape[0]
    K = torch.zeros([batch_size, 3, 3], device=points.device)
    K[:, 0, 0] = focal_length
    K[:, 1, 1] = focal_length
    K[:, 2, 2] = 1.0
    K[:, :-1, -1] = camera_center

    # Transform points
    points = torch.einsum("bij,bkj->bki", rotation, points)
    points = points + translation.unsqueeze(1)

    # Apply perspective distortion
    projected_points = points / points[:, :, -1].unsqueeze(-1)

    # Apply camera intrinsics
    projected_points = torch.einsum("bij,bkj->bki", K, projected_points)

    return projected_points[:, :, :-1]

Can you share the check the function once or maybe share your sample code which you used for smpl body projection to image If possible?

I need to convert the smpl points into several other format for a custom dataset, so this conversion and projection is crucial for me.

I hope you can help out. Thank you once again.

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

1 participant