forked from mapillary/OpenSfM
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimport_bundler
executable file
·36 lines (28 loc) · 1.19 KB
/
import_bundler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
import os.path, sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import argparse
import json
import numpy as np
import opensfm.dataset as dataset
import opensfm.io as io
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Convert output from Bundler to OpenSfM reconstructions')
parser.add_argument('dataset', help='path to the dataset to be processed')
parser.add_argument('--list', help='the list.txt file')
parser.add_argument('--bundleout', help='the bundle.out file')
args = parser.parse_args()
if args.list:
list_file = args.list
else:
list_file = 'list.txt'
if not args.bundleout:
print "No bundle.out given. Importing only the list of images list.txt."
if os.path.exists(list_file):
print 'Converting output from Bundler to OpenSfM'
data = dataset.DataSet(args.dataset)
tracks_file = data._DataSet__tracks_graph_file()
reconstruction_file = data._DataSet__reconstruction_file(None)
io.import_bundler(args.dataset, args.bundleout, list_file, tracks_file, reconstruction_file)
else:
print 'Cannot find list.txt'