(pto_path, new_project_path, width=6800)
| 23 | |
| 24 | |
| 25 | def hugin_modify(pto_path, new_project_path, width=6800): |
| 26 | # Load the project file(pto_path) |
| 27 | with open(pto_path, 'r') as file: |
| 28 | lines = file.readlines() |
| 29 | |
| 30 | # search for first line that starts with 'p ' -> 'p f2 w6000 h3000 v360 ...' |
| 31 | for i, line in enumerate(lines): |
| 32 | |
| 33 | if line.startswith("p "): |
| 34 | # replace w and h arguments |
| 35 | words = line.split(" ") |
| 36 | for j, word in enumerate(words): |
| 37 | if word.startswith("w"): |
| 38 | words[j] = f"w{width}" |
| 39 | elif word.startswith("h"): |
| 40 | words[j] = f"h{width//2}" |
| 41 | |
| 42 | lines[i] = " ".join(words) |
| 43 | break |
| 44 | |
| 45 | # Save the project file at new_project_path |
| 46 | with open(new_project_path, 'w') as file: |
| 47 | file.writelines(lines) |
| 48 | |
| 49 | |
| 50 | def hugin_stitch(config, nice=19): |
no outgoing calls
no test coverage detected