MCPcopy Index your code
hub / github.com/DNA-Rendering/DNA-Rendering / readNerfSyntheticInfo

Function readNerfSyntheticInfo

scripts/3DGS/dataset_readers.py:231–265  ·  view source on GitHub ↗
(path, white_background, eval, extension=".png")

Source from the content-addressed store, hash-verified

229 return cam_infos
230
231def readNerfSyntheticInfo(path, white_background, eval, extension=".png"):
232 print("Reading Training Transforms")
233 train_cam_infos = readCamerasFromTransforms(path, "transforms_train.json", white_background, extension)
234 print("Reading Test Transforms")
235 test_cam_infos = readCamerasFromTransforms(path, "transforms_test.json", white_background, extension)
236
237 if not eval:
238 train_cam_infos.extend(test_cam_infos)
239 test_cam_infos = []
240
241 nerf_normalization = getNerfppNorm(train_cam_infos)
242
243 ply_path = os.path.join(path, "points3d.ply")
244 if not os.path.exists(ply_path):
245 # Since this data set has no colmap data, we start with random points
246 num_pts = 100_000
247 print(f"Generating random point cloud ({num_pts})...")
248
249 # We create random points inside the bounds of the synthetic Blender scenes
250 xyz = np.random.random((num_pts, 3)) * 2.6 - 1.3
251 shs = np.random.random((num_pts, 3)) / 255.0
252 pcd = BasicPointCloud(points=xyz, colors=SH2RGB(shs), normals=np.zeros((num_pts, 3)))
253
254 storePly(ply_path, xyz, SH2RGB(shs) * 255)
255 try:
256 pcd = fetchPly(ply_path)
257 except:
258 pcd = None
259
260 scene_info = SceneInfo(point_cloud=pcd,
261 train_cameras=train_cam_infos,
262 test_cameras=test_cam_infos,
263 nerf_normalization=nerf_normalization,
264 ply_path=ply_path)
265 return scene_info
266
267def readCamerasDNARendering(path, info_dict, white_background, image_scaling=0.5, return_smplx=False):
268 output_view = info_dict["views"]

Callers

nothing calls this directly

Calls 6

getNerfppNormFunction · 0.85
BasicPointCloudClass · 0.85
storePlyFunction · 0.85
fetchPlyFunction · 0.85
SceneInfoClass · 0.85

Tested by

no test coverage detected