Merge branch 'master' of http://git.hofee.top/hofee/nbv_reconstruction
This commit is contained in:
@@ -82,28 +82,40 @@ class StrategyGenerator(Runner):
|
||||
model_points_normals = DataLoadUtil.load_points_normals(root, scene_name)
|
||||
model_pts = model_points_normals[:,:3]
|
||||
down_sampled_model_pts = PtsUtil.voxel_downsample_point_cloud(model_pts, voxel_threshold)
|
||||
|
||||
display_table_info = DataLoadUtil.get_display_table_info(root, scene_name)
|
||||
radius = display_table_info["radius"]
|
||||
top = DataLoadUtil.get_display_table_top(root, scene_name)
|
||||
scan_points = ReconstructionUtil.generate_scan_points(display_table_top=top,display_table_radius=radius)
|
||||
pts_list = []
|
||||
scan_points_indices_list = []
|
||||
|
||||
for frame_idx in range(frame_num):
|
||||
if self.load_pts and os.path.exists(os.path.join(root,scene_name, "pts", f"{frame_idx}.txt")):
|
||||
sampled_point_cloud = np.loadtxt(os.path.join(root,scene_name, "pts", f"{frame_idx}.txt"))
|
||||
indices = np.loadtxt(os.path.join(root,scene_name, "pts", f"{frame_idx}_indices.txt")).astype(np.int32).tolist()
|
||||
status_manager.set_progress("generate_strategy", "strategy_generator", "loading frame", frame_idx, frame_num)
|
||||
pts_list.append(sampled_point_cloud)
|
||||
continue
|
||||
scan_points_indices_list.append(indices)
|
||||
|
||||
else:
|
||||
path = DataLoadUtil.get_path(root, scene_name, frame_idx)
|
||||
cam_params = DataLoadUtil.load_cam_info(path, binocular=True)
|
||||
status_manager.set_progress("generate_strategy", "strategy_generator", "loading frame", frame_idx, frame_num)
|
||||
point_cloud = DataLoadUtil.get_target_point_cloud_world_from_path(path, binocular=True)
|
||||
point_cloud, display_table_pts = DataLoadUtil.get_target_point_cloud_world_from_path(path, binocular=True, get_display_table_pts=True)
|
||||
sampled_point_cloud = ReconstructionUtil.filter_points(point_cloud, model_points_normals, cam_pose=cam_params["cam_to_world"], voxel_size=voxel_threshold, theta=self.filter_degree)
|
||||
|
||||
covered_pts, indices = ReconstructionUtil.compute_covered_scan_points(scan_points, display_table_pts)
|
||||
if self.save_pts:
|
||||
pts_dir = os.path.join(root,scene_name, "pts")
|
||||
covered_pts_dir = os.path.join(pts_dir, "covered_scan_pts")
|
||||
if not os.path.exists(pts_dir):
|
||||
os.makedirs(pts_dir)
|
||||
if not os.path.exists(covered_pts_dir):
|
||||
os.makedirs(covered_pts_dir)
|
||||
np.savetxt(os.path.join(pts_dir, f"{frame_idx}.txt"), sampled_point_cloud)
|
||||
np.savetxt(os.path.join(covered_pts_dir, f"{frame_idx}.txt"), covered_pts)
|
||||
np.savetxt(os.path.join(pts_dir, f"{frame_idx}_indices.txt"), indices)
|
||||
pts_list.append(sampled_point_cloud)
|
||||
scan_points_indices_list.append(indices)
|
||||
status_manager.set_progress("generate_strategy", "strategy_generator", "loading frame", frame_num, frame_num)
|
||||
|
||||
seq_num = min(self.seq_num, len(pts_list))
|
||||
|
Reference in New Issue
Block a user