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

Compatibility between Open3D camera and gsplat/Gaussian Splatting #7141

Open
3 tasks done
loryruta opened this issue Jan 18, 2025 · 1 comment
Open
3 tasks done

Compatibility between Open3D camera and gsplat/Gaussian Splatting #7141

loryruta opened this issue Jan 18, 2025 · 1 comment
Labels

Comments

@loryruta
Copy link

Checklist

My Question

Hello, I'm trying to combine Open3D with an image rendered from gsplat (Gaussian Splatting).

Gaussian Splatting coordinate system is (+X, -Y, +Z), the intrinsic matrix is calculated as follows (row-major):

K = np.zeros((3, 3), dtype=np.float64)
K[0, 0] = fx * W * 0.5
K[1, 1] = fy * H * 0.5
K[2, 0] = W * 0.5
K[2, 1] = H * 0.5
K[2, 2] = 1

The extrinsic is:

inv(Rot * t)

Rendering the Gaussian Splatting pointcloud with Open3D, using the same extrinsic_matrix/intrinsic_matrix that I use in gsplat, gives the following result:

I'm rendering using:

o3d.visualization.draw(
    [pointcloud],
    width=W,
    height=H,
    field_of_view=None,
    intrinsic_matrix=intrinsic,
    extrinsic_matrix=extrinsic_params,
)

Is there anything, like a zoom, or any parameter transforming the camera matrices that I'm missing? 👀

@Wissotsky
Copy link

Heres my code to go from 3dgs cameras.json to open3d extrinsics. I suspect you just need to transpose your rotation

    # Create rotation matrix (R) from the rotation list
    R = np.array(camera['rotation']).T
    
    # Get camera position (C)
    C = np.array(camera['position'])
    
    # Calculate translation vector (t = -RC)
    t = -np.dot(R, C)
    
    # Create extrinsic matrix [R|t]
    E = np.hstack((R, t.reshape(-1, 1)))
    E = np.vstack((E, np.array([0, 0, 0, 1])))

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

No branches or pull requests

2 participants