Skip to content

Commit

Permalink
making hugin work with different versions (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
marinagmoreira authored Jun 30, 2024
1 parent 2714fcb commit 8234583
Showing 1 changed file with 16 additions and 4 deletions.
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

0 comments on commit 8234583

Please sign in to comment.