@@ -22,8 +22,8 @@ def main():
2222 parser = argparse .ArgumentParser ()
2323 parser .add_argument ('--config' , help = 'path to config file' , default = 'vanilla' )
2424 parser .add_argument ('--gpu' , default = '0' , help = 'GPU(s) to be used' )
25- parser .add_argument ('--camera' , '-c' , default = None , help = 'path to cameras.json' )
2625 parser .add_argument ('--model' , '-m' , default = None , help = 'path to the model' )
26+ parser .add_argument ('--source_path' , '-s' , help = 'path to the dataset' )
2727 parser .add_argument ('--output-dir' , '-o' , default = None , help = 'path to the output dir' )
2828 parser .add_argument ('--load_iteration' , default = - 1 , type = int , help = 'iteration to be rendered' )
2929 parser .add_argument ('--resolution' , default = 2 , type = int , help = 'downscale resolution' )
@@ -67,19 +67,23 @@ def main():
6767 print ("Model not found at {}" .format (model_path ))
6868 pcd .to ("cuda" )
6969
70- if args .camera is None :
71- args .camera = os .path .join (model_path , "cameras.json" )
72- if os .path .exists (args .camera ):
73- print ("Loading camera data from {}" .format (args .camera ))
74- with open (args .camera , 'r' ) as f :
70+ if args .source_path is None :
71+ args .source_path = os .path .join (os .path .dirname (model_path ), "cameras.json" )
72+
73+ if args .source_path .endswith (".json" ):
74+ print ("Loading camera data from {}" .format (args .source_path ))
75+ with open (args .source_path , 'r' ) as f :
7576 camera_data = json .load (f )
7677 cameras = []
7778 for camera_json in camera_data :
7879 camera = JSON_to_camera (camera_json , "cuda" )
7980 cameras .append (camera )
80- vdb_volume = vdbfusion .VDBVolume (voxel_size = 0.01 , sdf_trunc = 0.04 , space_carving = False ) # For Scene
8181 else :
82- assert "Camera data not found at {}" .format (args .camera )
82+ dataset_config = { "name" :"colmap" , "source_path" : args .source_path ,
83+ "images" :"images" , "resolution" :- 1 , "data_device" :"cuda" , "eval" : False }
84+ dataset = datasets .make (dataset_config )
85+ cameras = dataset .all_cameras
86+ vdb_volume = vdbfusion .VDBVolume (voxel_size = 0.01 , sdf_trunc = 0.04 , space_carving = False ) # For Scene
8387
8488 bg_color = [1 ,1 ,1 ] if args .white_background else [0 , 0 , 0 ]
8589 background = torch .tensor (bg_color , dtype = torch .float32 , device = "cuda" )
@@ -95,6 +99,7 @@ def main():
9599 render_pkg = renderer .render (camera , pcd )
96100 rendering = render_pkg ["render" ]
97101 rendered_final_opacity = render_pkg ["rendered_final_opacity" ][0 ]
102+ # rendered_depth = render_pkg["rendered_depth"][0] / rendered_final_opacity
98103 rendered_depth = render_pkg ["rendered_median_depth" ][0 ]
99104 invalid_mask = rendered_final_opacity < 0.5
100105
0 commit comments