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 convert topic "/tf" to kitti calib metrix like r_velo_to_cam、R0_rect、P2? #73

Open
HXB-1997 opened this issue Sep 22, 2023 · 0 comments

Comments

@HXB-1997
Copy link

I am using this code:
def project_velo_to_image(pts_3d, rect, Trv2c, P2): #(N,3)
# T=np.zeros([4,4],dtype=np.float32)
# T[:3,:]=Trv2c
# T[3,3]=1
T = Trv2c
# R=np.zeros([4,4],dtype=np.float32)
# R[:3,:3]=rect
# R[3,3]=1
R = rect
M=np.dot(P2,R)
M=np.dot(M,T)
pts_3d = cart2hom(pts_3d) # cartesian to homogeneous
pts_2d = np.dot(pts_3d, M.T) # nx3 x,y,scale
pts_2d[:, 0] /= pts_2d[:, 2] #divide by scale factor
pts_2d[:, 1] /= pts_2d[:, 2]
return pts_2d[:, 0:2]

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