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

Add max depth for stereo

parent 9c57fdc8
......@@ -62,6 +62,8 @@ def set_argparser():
pm_parser.add_argument('--more_sift_features', action="store_true")
pm_parser.add_argument('--save_space', action="store_true")
pm_parser.add_argument('--add_new_videos', action="store_true")
pm_parser.add_argument('--stereo_min_depth', type=float, default=0.1)
pm_parser.add_argument('--stereo_max_depth', type=float, default=100)
om_parser = parser.add_argument_group("Occlusion Mesh")
om_parser.add_argument('--normals_method', default="radius", choices=["radius", "neighbours"])
......
......@@ -131,10 +131,10 @@ def main():
colmap.align_model(output=env["georef_recon"],
input=thorough_model,
ref_images=env["georef_frames_list"])
if not (env["georef_frames_list"]/"images.bin").isfile():
if not (env["georef_recon"]/"images.bin").isfile():
# GPS alignment failed, possibly because not enough GPS referenced images
# Copy the original model without alignment
(env["thorough_recon"] / "0").merge_tree(env["georef_recon"])
thorough_model.merge_tree(env["georef_recon"])
env["georef_recon"].merge_tree(env["georef_full_recon"])
if args.inspect_dataset:
colmap.export_model(output=env["georef_recon"] / "georef_sparse.ply",
......@@ -166,7 +166,7 @@ def main():
print_step(i, "Full reconstruction point cloud densificitation")
env["georef_full_recon"].makedirs_p()
colmap.undistort(input=env["georef_full_recon"])
colmap.dense_stereo()
colmap.dense_stereo(min_depth=env["stereo_min_depth"], max_depth=env["stereo_max_depth"])
colmap.stereo_fusion(output=env["georefrecon_ply"])
def get_matrix(path):
......
......@@ -87,10 +87,11 @@ def main():
colmap.align_model(output=env["georef_recon"],
input=env["thorough_recon"] / "0",
ref_images=env["georef_frames_list"])
if not (env["georef_frames_list"]/"images.bin").isfile():
if not (env["georef_recon"]/"images.bin").isfile():
# GPS alignment failed, possibly because not enough GPS referenced images
# Copy the original model without alignment
(env["thorough_recon"] / "0").merge_tree(env["georef_recon"])
print("Warning, model alignment failed, the model will be normalized, and thus the depth maps too")
thorough_model.merge_tree(env["georef_recon"])
env["georef_recon"].merge_tree(env["georef_full_recon"])
if args.inspect_dataset:
colmap.export_model(output=env["georef_recon"] / "georef_sparse.ply",
......@@ -121,7 +122,7 @@ def main():
print_step(i, "Full reconstruction point cloud densificitation")
env["georef_full_recon"].makedirs_p()
colmap.undistort(input=env["georef_full_recon"])
colmap.dense_stereo()
colmap.dense_stereo(min_depth=env["stereo_min_depth"], max_depth=env["stereo_max_depth"])
colmap.stereo_fusion(output=env["georefrecon_ply"])
i += 1
......
......@@ -98,10 +98,14 @@ class Colmap(Wrapper):
"--output_type", "COLMAP", "--max_image_size", str(max_image_size)]
self.__call__(options)
def dense_stereo(self):
def dense_stereo(self, max_depth=None, min_depth=None):
options = ["patch_match_stereo", "--workspace_path", self.dense_workspace,
"--workspace_format", "COLMAP",
"--PatchMatchStereo.geom_consistency", "1"]
if min_depth is not None:
options += ["--PatchMatchStereo.depth_min", str(min_depth)]
if max_depth is not None:
options += ["--PatchMatchStereo.depth_max", str(max_depth)]
self.__call__(options)
def stereo_fusion(self, output):
......
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