v9.1.1
Menu

2D Gaussian Splat Evaluation

mediumPRONeural Rendering3DGSCV: Image-Based Rendering

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
  • Inputs: pixel is the query point (x,y)=(0,0)(x, y) = (0, 0), center is the splat's mean (μx,μy)=(0,0)(\mu_x, \mu_y) = (0, 0), and sigma gives the spread along each axis, (σx,σy)=(1,1)(\sigma_x, \sigma_y) = (1, 1), in pixel units.
  • Offsets: the pixel sits exactly on the center, so x−μx=0x - \mu_x = 0 and y−μy=0y - \mu_y = 0.
  • Exponent terms: each axis contributes its squared offset scaled by twice its variance: 022⋅12=0\frac{0^2}{2 \cdot 1^2} = 0 for xx and 022⋅12=0\frac{0^2}{2 \cdot 1^2} = 0 for yy. Their sum is 00.
  • Value: G=e−0=1G = e^{-0} = 1, which rounded to 4 decimal places is the output 1.0.
  • Notice that 11 is the largest value a splat can take: any offset makes the exponent negative and the value falls toward 00. One standard deviation away along xx, e.g. pixel (1,0)(1, 0), gives e−1/2≈0.6065e^{-1/2} \approx 0.6065, and a larger σx\sigma_x would make that falloff slower.

Constraints

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

Learn this in

More from CV: Image-Based Rendering

PRO

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

Sign in to run your code against the test cases.