Commit 57190dee authored by Clément Pinard's avatar Clément Pinard
Browse files

update path library

parent 0038991a
......@@ -56,7 +56,7 @@ def save_images_path_list(output_folder, origin, images_path_list):
def workflow(root, output_folder, video_path, args):
print("Generating images with gps for video {}".format(str(video_path)))
output_folder /= video_path.namebase
output_folder /= video_path.stem
if args.fps is not None:
output_folder += "_{}fps".format(args.fps)
output_folder.mkdir_p()
......
......@@ -18,8 +18,8 @@ parser.add_argument('--verbose', '-v', action='store_true')
def load_and_convert(input_file, output_folder, verbose=False):
output_folder.makedirs_p()
ply_path = output_folder / input_file.namebase + '.ply'
txt_path = output_folder / input_file.namebase + '_centroid.txt'
ply_path = output_folder / input_file.stem + '.ply'
txt_path = output_folder / input_file.stem + '_centroid.txt'
file_type = input_file.ext[1:].upper()
if file_type == "LAS":
offset = np.array(laspy.file.File(input_file, mode="r").header.offset)
......
......@@ -99,7 +99,7 @@ def main():
fps=args.lowfps, **env)
else:
env["videos_frames_folders"] = {}
by_name = {v.namebase: v for v in env["videos_list"]}
by_name = {v.stem: v for v in env["videos_list"]}
for folder in env["video_path"].walkdirs():
video_name = folder.basename()
if video_name in by_name.keys():
......
......@@ -57,7 +57,7 @@ def main():
env["videos_frames_folders"] = pi.extract_videos_to_workspace(fps=args.lowfps, **env)
else:
env["videos_frames_folders"] = {}
by_name = {v.namebase: v for v in env["videos_list"]}
by_name = {v.stem: v for v in env["videos_list"]}
for folder in env["video_path"].walkdirs():
video_name = folder.basename()
if video_name in by_name.keys():
......
......@@ -62,7 +62,7 @@ def prepare_video_workspace(video_name, video_frames_folder,
video_env["metadata"] = video_frames_folder / "metadata.csv"
video_env["lowfps_image_list_path"] = video_frames_folder / "lowfps.txt"
video_env["chunk_image_list_paths"] = sorted(video_frames_folder.files("full_chunk_*.txt"))
video_env["chunk_dbs"] = [video_frames_folder / fp.namebase + ".db" for fp in video_env["chunk_image_list_paths"]]
video_env["chunk_dbs"] = [video_frames_folder / fp.stem + ".db" for fp in video_env["chunk_image_list_paths"]]
colmap_root = video_recon / relative_path_folder
video_env["colmap_models_root"] = colmap_root
video_env["full_model"] = colmap_root
......@@ -80,5 +80,5 @@ def prepare_video_workspace(video_name, video_frames_folder,
output["viz_folder"] = converted_output_folder / "video" / relative_path_folder
video_env["output_env"] = output
video_env["already_localized"] = env["resume_work"] and output["model_folder"].isdir()
video_env["GT_already_done"] = env["resume_work"] and (raw_output_folder / "ground_truth_depth" / video_name.namebase).isdir()
video_env["GT_already_done"] = env["resume_work"] and (raw_output_folder / "ground_truth_depth" / video_name.stem).isdir()
return video_env
......@@ -40,7 +40,7 @@ def save_intrinsics(cameras, images, output_dir, downscale=1):
for _, img in images.items():
cam = cameras[img.camera_id]
intrinsics = construct_intrinsics(cam)
intrinsics_name = output_dir / Path(img.name).namebase + "_intrinsics.txt"
intrinsics_name = output_dir / Path(img.name).stem + "_intrinsics.txt"
np.savetxt(intrinsics_name, intrinsics)
......
......@@ -166,7 +166,7 @@ def localize_video(video_name, video_frames_folder, thorough_db, metadata, lowfp
colmap.triangulate_points(final_model, final_model)
colmap.export_model(final_model, final_model, output_type="TXT")
ply_name = final_model / "georef_{}.ply".format(video_name.namebase)
ply_name = final_model / "georef_{}.ply".format(video_name.stem)
matrix_name = final_model / "matrix.txt"
colmap.export_model(ply_name, final_model, output_type="PLY")
pcl_util.register_reconstruction(georef=ply_name, lidar=env["lidar_ply"],
......@@ -257,9 +257,9 @@ def generate_GT(video_name, raw_output_folder, images_root_folder, video_frames_
print_step(i_pv, "Convert to KITTI format and create video with GT vizualisation")
cd.convert_dataset(final_model,
raw_output_folder / "ground_truth_depth" / video_name.namebase,
raw_output_folder / "ground_truth_depth" / video_name.stem,
images_root_folder,
raw_output_folder / "occlusion_depth" / video_name.namebase,
raw_output_folder / "occlusion_depth" / video_name.stem,
kitti_format_folder, viz_folder,
metadata, interpolated_frames_list,
video=True, downscale=4, threads=8, **env)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment