PIXELBANKv9.1.0
Menu

2D Gaussian Splat Evaluation

Compute the 2D Gaussian splat value at a pixel.

3D Gaussian Splatting represents scenes as millions of 3D Gaussians. When projected to 2D, each becomes an elliptical Gaussian:

G(x,y)=exp⁡(−(x−μx)22σx2−(y−μy)22σy2)G(x, y) = \exp\left(-\frac{(x-\mu_x)^2}{2\sigma_x^2} - \frac{(y-\mu_y)^2}{2\sigma_y^2}\right)

where:

  • (x,y)(x, y) is the pixel position
  • (μx,μy)(\mu_x, \mu_y) is the Gaussian center
  • (σx,σy)(\sigma_x, \sigma_y) are the standard deviations (scale)

This axis-aligned version is simplified - real 3DGS uses full 2D covariance for rotated ellipses.

Example:

Input:
gaussian_splat((0, 0), (0, 0), (1, 1))
Output:
1.0
Reasoning:
  • At center (0,0) of Gaussian centered at (0,0): dx² = (0-0)²/(2×1²) = 0 dy² = (0-0)²/(2×1²) = 0

  • G = exp(-(0+0)) = exp(0) = 1.0 Maximum value at center.

Constraints:

  • pixel: (x, y) query position
  • center: (μx, μy) Gaussian center
  • sigma: (σx, σy) standard deviations
  • Return Gaussian value, rounded to 4 decimal places
🔒

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.
2D Gaussian Splat Evaluation - Medium | PixelBank