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

making hugin work with different versions #798

Merged
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
20 changes: 16 additions & 4 deletions localization/sparse_mapping/tools/generate_hugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,14 @@ def main():

if args.input_hugin is not None:
# read the pto file into the Panorama object
p.ReadPTOFile(args.input_hugin)
# Accomodate hugin changing API
try:
# Attempt the first method
ifs = ifstream(args.input_hugin)
p.readData(ifs)
except AttributeError:
# Fallback to the second method if the first method fails
p.ReadPTOFile(args.input_hugin)
# don't need anymore
del ifs

Expand All @@ -132,9 +139,14 @@ def main():
p.addImage(srcImage)

# write the modified panorama to that stream
p.WritePTOFile(output_hugin)
# done with it
del ofs
# Accomodate hugin changing API
try:
# Attempt the first method
ofs = ofstream(output_hugin)
p.writeData(ofs)
except AttributeError:
# Fallback to the second method if the first method fails
p.WritePTOFile(output_hugin)


if __name__ == "__main__":
Expand Down
Loading