Skip to content

Automatic alignment with gravity using Colmap #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
parser = ArgumentParser("Colmap converter")
parser.add_argument("--no_gpu", action='store_true')
parser.add_argument("--skip_matching", action='store_true')
parser.add_argument("--skip_alignment", action='store_true')
parser.add_argument("--source_path", "-s", required=True, type=str)
parser.add_argument("--camera", default="OPENCV", type=str)
parser.add_argument("--colmap_executable", default="", type=str)
Expand Down Expand Up @@ -65,6 +66,20 @@
logging.error(f"Mapper failed with code {exit_code}. Exiting.")
exit(exit_code)

if not args.skip_alignment:
### Model alignment
# Aligns the scene so that +Z axis is up.
model_alignment_cmd = (colmap_command + " model_aligner \
--input_path " + args.source_path + "/distorted/sparse/0 \
--database_path " + args.source_path + "/distorted/database.db \
--alignment_max_error " + "0.1" "\
--alignment_type " + "plane" "\
--output_path " + args.source_path + "/distorted/sparse/0")
exit_code = os.system(model_alignment_cmd)
if exit_code != 0:
logging.error(f"Model aligner failed with code {exit_code}. Exiting.")
exit(exit_code)

### Image undistortion
## We need to undistort our images into ideal pinhole intrinsics.
img_undist_cmd = (colmap_command + " image_undistorter \
Expand Down