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

Mistake in transforming 3D coordinates from cropped image to original image #5

Open
jianweif opened this issue Nov 2, 2020 · 0 comments

Comments

@jianweif
Copy link

jianweif commented Nov 2, 2020

Hi, thanks for the great work! I would like to point out a small mistake in MultiHandTracker3D.

In multi_hand_tracker.py, line 884-889, it's transforming 2D coordinates from cropped image back to original image with 2D similarity transform Minv. However, here the z coordinates are still in cropped image and not transformed.

            kp_orig_0 = (self._pad1(joints[:,:2]) @ Minv.T)[:,:2]
            kp_orig_0 -= pad[::-1]
            
            # Add back the 3D data
            kp_orig = joints[:,:]
            kp_orig[:,:2] = kp_orig_0[:,:2]

The z coordinates need to be scaled as well, so I did the following:

            kp_orig_0 = (self._pad1(joints[:,:2]) @ Minv.T)[:,:2]
            kp_orig_0 -= pad[::-1]

            scale = np.linalg.norm(Minv[0, :2])

            # Add back the 3D data
            kp_orig = joints[:,:]
            kp_orig[:,:2] = kp_orig_0[:,:2]
            # also scale the z coordinates
            kp_orig[:, 2] *= scale

Thanks!

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