@@ -157,7 +157,7 @@ sh_2_rgb(x) = x * SH0 + 0.5f0
157157
158158inverse_sigmoid (x) = log (x / (1f0 - x))
159159
160- function export_ply! (g:: GaussianModel , filename:: String )
160+ function export_ply (g:: GaussianModel , filename:: String )
161161 ply = PlyIO. Ply ()
162162
163163 n = size (g. points, 2 )
@@ -174,16 +174,16 @@ function export_ply!(g::GaussianModel, filename::String)
174174 PlyIO. ArrayProperty (" y" , xyz[2 , :]),
175175 PlyIO. ArrayProperty (" z" , xyz[3 , :]),
176176
177- [PlyIO. ArrayProperty (" f_dc_$i " , features_dc[i, :]) for i in 1 : size (features_dc, 1 )]. .. ,
178- [PlyIO. ArrayProperty (" f_rest_$i " , features_rest[i, :]) for i in 1 : size (features_rest, 1 )]. .. ,
179- [PlyIO. ArrayProperty (" scale_$i " , scales[i, :]) for i in 1 : size (scales, 1 )]. .. ,
180- [PlyIO. ArrayProperty (" rot_$i " , rotations[i, :]) for i in 1 : size (rotations, 1 )]. .. ,
177+ [PlyIO. ArrayProperty (" f_dc_$(i - 1 ) " , features_dc[i, :]) for i in 1 : size (features_dc, 1 )]. .. ,
178+ [PlyIO. ArrayProperty (" f_rest_$(i - 1 ) " , features_rest[i, :]) for i in 1 : size (features_rest, 1 )]. .. ,
179+ [PlyIO. ArrayProperty (" scale_$(i - 1 ) " , scales[i, :]) for i in 1 : size (scales, 1 )]. .. ,
180+ [PlyIO. ArrayProperty (" rot_$(i - 1 ) " , rotations[i, :]) for i in 1 : size (rotations, 1 )]. .. ,
181181
182182 PlyIO. ArrayProperty (" opacity" , opacities),
183183 )
184184 push! (ply, vertex)
185185
186- PlyIO. save_ply (ply, filename)
186+ PlyIO. save_ply (ply, filename; ascii = false )
187187 return
188188end
189189
@@ -196,14 +196,14 @@ function import_ply(filename::String, kab)
196196
197197 n = length (vertex[" x" ])
198198 xyz = vcat ([reshape (vertex[i], 1 , n) for i in (" x" , " y" , " z" )]. .. )
199- scales = vcat ([reshape (vertex[" scale_$i " ], 1 , n) for i in 1 : 3 ]. .. )
200- rotations = vcat ([reshape (vertex[" rot_$i " ], 1 , n) for i in 1 : 4 ]. .. )
199+ scales = vcat ([reshape (vertex[" scale_$(i - 1 ) " ], 1 , n) for i in 1 : 3 ]. .. )
200+ rotations = vcat ([reshape (vertex[" rot_$(i - 1 ) " ], 1 , n) for i in 1 : 4 ]. .. )
201201 opacities = reshape (Array (vertex[" opacity" ]), 1 , n)
202202
203- features_dc = vcat ([reshape (vertex[" f_dc_$i " ], 1 , 1 , n) for i in 1 : 3 ]. .. )
203+ features_dc = vcat ([reshape (vertex[" f_dc_$(i - 1 ) " ], 1 , 1 , n) for i in 1 : 3 ]. .. )
204204 features_rest = if n_frest > 0
205205 reshape (
206- vcat ([reshape (vertex[" f_rest_$i " ], 1 , n) for i in 1 : n_frest]. .. ),
206+ vcat ([reshape (vertex[" f_rest_$(i - 1 ) " ], 1 , n) for i in 1 : n_frest]. .. ),
207207 3 , :, n)
208208 else
209209 Array {Float32} (undef, 3 , 0 , n)
0 commit comments