Skip to content
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

Fixed KeyError during export bundler. #161

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
33 changes: 17 additions & 16 deletions opensfm/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,22 +450,23 @@ def export_bundler(image_list, reconstructions, track_graph, bundle_file_path,
for point_id, point in points.iteritems():
coord = point.coordinates
color = map(int, point.color)
view_list = track_graph[point_id]
lines.append(' '.join(map(str, coord)))
lines.append(' '.join(map(str, color)))
view_line = []
for shot_key, view in view_list.iteritems():
if shot_key in shots.keys():
v = view['feature']
shot_index = shots_order[shot_key]
camera = shots[shot_key].camera
scale = max(camera.width, camera.height)
x = v[0] * scale
y = -v[1] * scale
view_line.append(' '.join(
map(str, [shot_index, view['feature_id'], x, y])))

lines.append(str(len(view_line)) + ' ' + ' '.join(view_line))
if point_id in track_graph:
view_list = track_graph[point_id]
lines.append(' '.join(map(str, coord)))
lines.append(' '.join(map(str, color)))
view_line = []
for shot_key, view in view_list.iteritems():
if shot_key in shots.keys():
v = view['feature']
shot_index = shots_order[shot_key]
camera = shots[shot_key].camera
scale = max(camera.width, camera.height)
x = v[0] * scale
y = -v[1] * scale
view_line.append(' '.join(
map(str, [shot_index, view['feature_id'], x, y])))

lines.append(str(len(view_line)) + ' ' + ' '.join(view_line))

bundle_file = os.path.join(bundle_file_path,
'bundle_r' + str(j).zfill(3) + '.out')
Expand Down