Merge pull request #1800 from pierotofy/smcamera

Merge cameras.json in split-merge
pull/1801/head v3.5.4
Piero Toffanin 2024-09-13 08:37:32 -04:00 zatwierdzone przez GitHub
commit e05e1be200
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
5 zmienionych plików z 26 dodań i 4 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -1 +1 @@
3.5.3
3.5.4

Wyświetl plik

@ -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))

Wyświetl plik

@ -15,7 +15,7 @@ from opensfm.large import metadataset
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
@ -337,6 +337,15 @@ class ODMMergeStage(types.ODM_Stage):
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()