Skip to content

Commit

Permalink
Merge pull request #1800 from pierotofy/smcamera
Browse files Browse the repository at this point in the history
Merge cameras.json in split-merge
  • Loading branch information
pierotofy authored Sep 13, 2024
2 parents 2242d17 + c80af89 commit e05e1be
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: |
python configure.py dist --code-sign-cert-path $env:CODE_SIGN_CERT_PATH
- name: Upload Setup File
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Setup
path: dist\*.exe
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-prs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
run: |
python configure.py dist
- name: Upload Setup File
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Setup
path: dist\*.exe
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.3
3.5.4
13 changes: 13 additions & 0 deletions opendm/shots.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,16 @@ def merge_geojson_shots(geojson_shots_files, output_geojson_file):

with open(output_geojson_file, "w") as f:
f.write(json.dumps(result))

def merge_cameras(cameras_json_files, output_cameras_file):
result = {}
for cameras_file in cameras_json_files:
with open(cameras_file, "r") as f:
cameras = json.loads(f.read())

for cam_id in cameras:
if not cam_id in result:
result[cam_id] = cameras[cam_id]

with open(output_cameras_file, "w") as f:
f.write(json.dumps(result))
11 changes: 10 additions & 1 deletion stages/splitmerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from opendm.cropper import Cropper
from opendm.concurrency import get_max_memory
from opendm.remote import LocalRemoteExecutor
from opendm.shots import merge_geojson_shots
from opendm.shots import merge_geojson_shots, merge_cameras
from opendm import point_cloud
from opendm.utils import double_quote
from opendm.tiles.tiler import generate_dem_tiles
Expand Down Expand Up @@ -337,6 +337,15 @@ def merge_dems(dem_filename, human_name):
else:
log.ODM_WARNING("Found merged shots.geojson in %s" % tree.odm_report)

# Merge cameras
cameras_json = tree.path("cameras.json")
if not io.file_exists(cameras_json) or self.rerun():
cameras_json_files = get_submodel_paths(tree.submodels_path, "cameras.json")
log.ODM_INFO("Merging %s cameras.json files" % len(cameras_json_files))
merge_cameras(cameras_json_files, cameras_json)
else:
log.ODM_WARNING("Found merged cameras.json in %s" % tree.root_path)

# Stop the pipeline short by skipping to the postprocess stage.
# Afterwards, we're done.
self.next_stage = self.last_stage()
Expand Down

0 comments on commit e05e1be

Please sign in to comment.