Skip to content

Commit

Permalink
script to empty tie points in images.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
lcmrl committed Oct 3, 2024
1 parent db2022e commit 048b6d1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions scripts/prepare_images_for_triangulator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os
import argparse
from pathlib import Path

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--images_txt', type=Path, required=True)
parser.add_argument('-o', '--output_dir', type=Path, required=True)
args = parser.parse_args()

input_file = args.images_txt
output_file = args.output_dir / "images.txt"

if os.path.exists(output_file):
print(f"Output directory {args.output_dir} already exists. Exiting.")
quit()

with open(input_file, 'r') as f, open(output_file, 'w') as out_f:
lines = f.readlines()
c = 0
for line in lines:
if line.startswith("#"):
continue
if c % 2 == 0:
out_f.write(line)
else:
out_f.write("\n")
c += 1

0 comments on commit 048b6d1

Please sign in to comment.