13#include <reusex/types/point_types.hpp>
21inline constexpr float kShC0 = 0.28209479177387814f;
48 std::vector<std::array<float, 3>>
means;
49 std::vector<std::array<float, 3>>
scales;
50 std::vector<std::array<float, 4>>
quats;
52 std::vector<std::array<float, 3>>
sh_dc;
115 const std::filesystem::path &path);
GaussianCloud load_gaussian_ply(const std::filesystem::path &path)
Read back a .ply written by save_gaussian_ply.
float sh_dc_to_rgb(float f)
Degree-0 SH coefficient -> RGB in [0,1] (not clamped).
GaussianCloud init_from_point_cloud(const CloudPtr &cloud, const GaussianInitOptions &opt={})
Seed Gaussians from an XYZRGB cloud: means = point positions, DC colour = point colour,...
constexpr float kShC0
The 3D Gaussian Splatting DC spherical-harmonic basis function value, 0.5 * sqrt(1/pi).
float inverse_sigmoid(float x)
Numerically safe logit, the inverse of the sigmoid used for opacity.
std::vector< std::uint8_t > gaussian_ply_bytes(const GaussianCloud &gaussians)
Serialize to a 3DGS-format binary-little-endian .ply in memory (the property names the reference impl...
float rgb_to_sh_dc(float c)
RGB in [0,1] -> degree-0 SH coefficient.
void save_gaussian_ply(const GaussianCloud &gaussians, const std::filesystem::path &path)
Write the bytes of gaussian_ply_bytes() to path.
typename Cloud::Ptr CloudPtr
A set of 3D Gaussians in plain host memory.
std::vector< std::array< float, 3 > > scales
log-scales, per axis
int sh_degree
active SH degree (0 = DC only)
std::vector< float > opacities
logit-opacity
std::vector< std::array< float, 4 > > quats
rotation (w, x, y, z)
void validate() const
Throws std::runtime_error naming the first array whose length disagrees.
std::vector< std::array< float, 3 > > means
world-space centres [m]
std::vector< std::array< float, 3 > > sh_dc
degree-0 SH per channel
std::vector< std::vector< float > > sh_rest
Higher-order SH, [N][(sh_bands-1)*3] flattened; empty when degree 0.
Parameters for seeding Gaussians from a ReUseX point cloud.
int knn
Neighbours used for the nearest-neighbour spacing that sets the initial (isotropic) scale of each Gau...
float initial_opacity
Initial alpha before the logit transform.
float min_scale
Clamp on the initial scale [m].
std::size_t max_points
Uniform stride cap on the number of seeds (0 = use every point).
int sh_degree
Active SH degree.