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

The projection of 3D box #40

Open
LuPaoPao opened this issue Mar 3, 2023 · 0 comments
Open

The projection of 3D box #40

LuPaoPao opened this issue Mar 3, 2023 · 0 comments

Comments

@LuPaoPao
Copy link

LuPaoPao commented Mar 3, 2023

I projected the 3D box onto the 2D pixel plane, but the orientation of the box was wrong. I did this:

step 1: Convert the orientation to a rotation matrix and then to a quaternion, using the corner points of the box.

def xyz2Quaternion(xyz):
rot = np.array(xyz)
rot_matrix = R.from_euler("xyz", rot, degrees=False).as_matrix()
return Quaternion(matrix=rot_matrix)

step 2: Convert the orientation to a rotation matrix and then to a quaternion, using the corner points of the box.
camera_intrinsic= [[640.0, 0.0, 640.0],
[0.0, 640.0, 400.0],
[0.0, 0.0, 1.0]]}
view = np.eye(4)
view[:3, :3] = np.array(camera_intrinsic)
in_front = corners_3d[2, :] > 0.1
if all(in_front) is False:
continue
points = corners_3d
points = np.concatenate((points, np.ones((1, points.shape[1]))), axis=0)
points = np.dot(view, points)[:3, :]
points /= points[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