cars 1.0.0a2__cp310-cp310-win_amd64.whl → 1.0.0a4__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cars might be problematic. Click here for more details.
- cars/__init__.py +3 -3
- cars/applications/__init__.py +0 -3
- cars/applications/application.py +14 -6
- cars/applications/application_template.py +42 -0
- cars/applications/auxiliary_filling/abstract_auxiliary_filling_app.py +12 -2
- cars/applications/auxiliary_filling/auxiliary_filling_algo.py +2 -2
- cars/applications/auxiliary_filling/auxiliary_filling_from_sensors_app.py +95 -46
- cars/applications/auxiliary_filling/auxiliary_filling_wrappers.py +7 -6
- cars/applications/dem_generation/abstract_dem_generation_app.py +9 -5
- cars/applications/dem_generation/dem_generation_algo.py +1 -1
- cars/applications/dem_generation/dem_generation_wrappers.py +44 -59
- cars/applications/dem_generation/dichotomic_generation_app.py +9 -6
- cars/applications/dem_generation/rasterization_app.py +112 -43
- cars/applications/dense_match_filling/__init__.py +1 -1
- cars/applications/dense_match_filling/abstract_dense_match_filling_app.py +2 -15
- cars/applications/dense_match_filling/fill_disp_algo.py +32 -373
- cars/applications/dense_match_filling/fill_disp_wrappers.py +0 -343
- cars/applications/dense_match_filling/zero_padding_app.py +10 -5
- cars/applications/dense_matching/abstract_dense_matching_app.py +2 -1
- cars/applications/dense_matching/census_mccnn_sgm_app.py +48 -60
- cars/applications/dense_matching/cpp/dense_matching_cpp.cp310-win_amd64.dll.a +0 -0
- cars/applications/dense_matching/cpp/dense_matching_cpp.cp310-win_amd64.pyd +0 -0
- cars/applications/dense_matching/dense_matching_algo.py +48 -14
- cars/applications/dense_matching/dense_matching_wrappers.py +11 -3
- cars/applications/dense_matching/disparity_grid_algo.py +95 -79
- cars/applications/dense_matching/loaders/config_mapping.json +13 -0
- cars/applications/dense_matching/loaders/global_land_cover_map.tif +0 -0
- cars/applications/dense_matching/loaders/pandora_loader.py +169 -34
- cars/applications/dsm_filling/border_interpolation_app.py +11 -12
- cars/applications/dsm_filling/bulldozer_filling_app.py +16 -15
- cars/applications/dsm_filling/exogenous_filling_app.py +14 -14
- cars/applications/grid_generation/abstract_grid_generation_app.py +1 -1
- cars/applications/grid_generation/epipolar_grid_generation_app.py +4 -2
- cars/applications/grid_generation/grid_correction_app.py +4 -1
- cars/applications/grid_generation/grid_generation_algo.py +7 -2
- cars/applications/ground_truth_reprojection/abstract_ground_truth_reprojection_app.py +1 -1
- cars/applications/ground_truth_reprojection/direct_localization_app.py +2 -2
- cars/applications/ground_truth_reprojection/ground_truth_reprojection_algo.py +2 -1
- cars/applications/point_cloud_fusion/abstract_pc_fusion_app.py +0 -155
- cars/applications/point_cloud_fusion/mapping_to_terrain_tiles_app.py +0 -658
- cars/applications/point_cloud_fusion/pc_fusion_algo.py +0 -1339
- cars/applications/point_cloud_fusion/pc_fusion_wrappers.py +0 -869
- cars/applications/point_cloud_outlier_removal/abstract_outlier_removal_app.py +11 -6
- cars/applications/point_cloud_outlier_removal/outlier_removal_algo.py +9 -8
- cars/applications/point_cloud_outlier_removal/small_components_app.py +101 -270
- cars/applications/point_cloud_outlier_removal/statistical_app.py +120 -277
- cars/applications/rasterization/abstract_pc_rasterization_app.py +2 -1
- cars/applications/rasterization/rasterization_algo.py +18 -6
- cars/applications/rasterization/rasterization_wrappers.py +2 -1
- cars/applications/rasterization/simple_gaussian_app.py +88 -116
- cars/applications/resampling/abstract_resampling_app.py +1 -1
- cars/applications/resampling/bicubic_resampling_app.py +3 -1
- cars/applications/resampling/resampling_algo.py +60 -53
- cars/applications/resampling/resampling_wrappers.py +3 -1
- cars/applications/sparse_matching/abstract_sparse_matching_app.py +1 -1
- cars/applications/sparse_matching/sift_app.py +5 -25
- cars/applications/sparse_matching/sparse_matching_algo.py +3 -2
- cars/applications/sparse_matching/sparse_matching_wrappers.py +1 -1
- cars/applications/triangulation/abstract_triangulation_app.py +1 -1
- cars/applications/triangulation/line_of_sight_intersection_app.py +13 -11
- cars/applications/triangulation/pc_transform.py +552 -0
- cars/applications/triangulation/triangulation_algo.py +6 -4
- cars/applications/triangulation/triangulation_wrappers.py +1 -0
- cars/bundleadjustment.py +6 -6
- cars/cars.py +11 -9
- cars/core/cars_logging.py +80 -49
- cars/core/constants.py +0 -1
- cars/core/datasets.py +5 -2
- cars/core/geometry/abstract_geometry.py +364 -22
- cars/core/geometry/shareloc_geometry.py +112 -82
- cars/core/inputs.py +72 -19
- cars/core/outputs.py +1 -1
- cars/core/preprocessing.py +17 -3
- cars/core/projection.py +126 -6
- cars/core/tiling.py +10 -3
- cars/data_structures/cars_dataset.py +12 -10
- cars/data_structures/corresponding_tiles_tools.py +0 -103
- cars/data_structures/format_transformation.py +4 -1
- cars/devibrate.py +6 -3
- cars/extractroi.py +20 -21
- cars/orchestrator/cluster/abstract_cluster.py +15 -5
- cars/orchestrator/cluster/abstract_dask_cluster.py +6 -2
- cars/orchestrator/cluster/dask_jobqueue_utils.py +1 -1
- cars/orchestrator/cluster/log_wrapper.py +149 -22
- cars/orchestrator/cluster/mp_cluster/multiprocessing_cluster.py +12 -4
- cars/orchestrator/cluster/mp_cluster/multiprocessing_profiler.py +2 -2
- cars/orchestrator/cluster/pbs_dask_cluster.py +1 -1
- cars/orchestrator/cluster/sequential_cluster.py +5 -4
- cars/orchestrator/cluster/slurm_dask_cluster.py +1 -1
- cars/orchestrator/orchestrator.py +15 -4
- cars/orchestrator/registry/id_generator.py +1 -0
- cars/orchestrator/registry/saver_registry.py +2 -2
- cars/pipelines/conf_resolution/conf_final_resolution.json +5 -3
- cars/pipelines/default/default_pipeline.py +461 -1052
- cars/pipelines/parameters/advanced_parameters.py +91 -64
- cars/pipelines/parameters/advanced_parameters_constants.py +6 -5
- cars/pipelines/parameters/application_parameters.py +71 -0
- cars/pipelines/parameters/depth_map_inputs.py +0 -314
- cars/pipelines/parameters/dsm_inputs.py +40 -4
- cars/pipelines/parameters/output_parameters.py +44 -8
- cars/pipelines/parameters/sensor_inputs.py +122 -73
- cars/pipelines/parameters/sensor_inputs_constants.py +0 -2
- cars/pipelines/parameters/sensor_loaders/__init__.py +4 -3
- cars/pipelines/parameters/sensor_loaders/basic_classif_loader.py +106 -0
- cars/pipelines/parameters/sensor_loaders/{basic_sensor_loader.py → basic_image_loader.py} +16 -22
- cars/pipelines/parameters/sensor_loaders/pivot_classif_loader.py +121 -0
- cars/pipelines/parameters/sensor_loaders/{pivot_sensor_loader.py → pivot_image_loader.py} +10 -21
- cars/pipelines/parameters/sensor_loaders/sensor_loader.py +4 -6
- cars/pipelines/parameters/sensor_loaders/sensor_loader_template.py +1 -3
- cars/pipelines/pipeline_template.py +1 -3
- cars/pipelines/unit/unit_pipeline.py +676 -1070
- cars/starter.py +4 -3
- cars-1.0.0a4.dist-info/DELVEWHEEL +2 -0
- {cars-1.0.0a2.dist-info → cars-1.0.0a4.dist-info}/METADATA +135 -53
- {cars-1.0.0a2.dist-info → cars-1.0.0a4.dist-info}/RECORD +120 -134
- cars.libs/libgcc_s_seh-1-b2494fcbd4d80cf2c98fdd5261f6d850.dll +0 -0
- cars.libs/libstdc++-6-e9b0d12ae0e9555bbae55e8dfd08c3f7.dll +0 -0
- cars.libs/libwinpthread-1-7882d1b093714ccdfaf4e0789a817792.dll +0 -0
- cars/applications/dense_match_filling/cpp/__init__.py +0 -0
- cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp310-win_amd64.dll.a +0 -0
- cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp310-win_amd64.pyd +0 -0
- cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.py +0 -72
- cars/applications/dense_match_filling/cpp/includes/dense_match_filling.hpp +0 -46
- cars/applications/dense_match_filling/cpp/meson.build +0 -9
- cars/applications/dense_match_filling/cpp/src/bindings.cpp +0 -11
- cars/applications/dense_match_filling/cpp/src/dense_match_filling.cpp +0 -142
- cars/applications/dense_match_filling/plane_app.py +0 -556
- cars/applications/hole_detection/__init__.py +0 -30
- cars/applications/hole_detection/abstract_hole_detection_app.py +0 -125
- cars/applications/hole_detection/cloud_to_bbox_app.py +0 -346
- cars/applications/hole_detection/hole_detection_algo.py +0 -144
- cars/applications/hole_detection/hole_detection_wrappers.py +0 -53
- cars/applications/point_cloud_denoising/__init__.py +0 -29
- cars/applications/point_cloud_denoising/abstract_pc_denoising_app.py +0 -273
- cars/applications/point_cloud_fusion/__init__.py +0 -30
- cars/applications/point_cloud_fusion/cloud_fusion_constants.py +0 -39
- cars/applications/sparse_matching/pandora_sparse_matching_app.py +0 -0
- cars/pipelines/parameters/depth_map_inputs_constants.py +0 -25
- cars-1.0.0a2.dist-info/DELVEWHEEL +0 -2
- cars.libs/libgcc_s_seh-1-f2b6825d483bdf14050493af93b5997d.dll +0 -0
- cars.libs/libstdc++-6-6b0059df6bc601df5a0f18a5805eea05.dll +0 -0
- cars.libs/libwinpthread-1-e01b8e85fd67c2b861f64d4ccc7df607.dll +0 -0
- {cars-1.0.0a2.dist-info → cars-1.0.0a4.dist-info}/WHEEL +0 -0
- {cars-1.0.0a2.dist-info → cars-1.0.0a4.dist-info}/entry_points.txt +0 -0
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# coding: utf8
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2020 Centre National d'Etudes Spatiales (CNES).
|
|
5
|
-
#
|
|
6
|
-
# This file is part of CARS
|
|
7
|
-
# (see https://github.com/CNES/cars).
|
|
8
|
-
#
|
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
# you may not use this file except in compliance with the License.
|
|
11
|
-
# You may obtain a copy of the License at
|
|
12
|
-
#
|
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
#
|
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
# See the License for the specific language governing permissions and
|
|
19
|
-
# limitations under the License.
|
|
20
|
-
#
|
|
21
|
-
"""
|
|
22
|
-
CARS depth map inputs
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
import logging
|
|
26
|
-
|
|
27
|
-
from json_checker import Checker, Or
|
|
28
|
-
|
|
29
|
-
import cars.pipelines.parameters.depth_map_inputs_constants as depth_map_cst
|
|
30
|
-
|
|
31
|
-
# CARS imports
|
|
32
|
-
from cars.core import constants as cst
|
|
33
|
-
from cars.core import inputs
|
|
34
|
-
from cars.core.geometry.abstract_geometry import AbstractGeometry
|
|
35
|
-
from cars.core.utils import make_relative_path_absolute
|
|
36
|
-
from cars.pipelines.parameters import sensor_inputs as sens_inp
|
|
37
|
-
from cars.pipelines.parameters import sensor_inputs_constants as sens_cst
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def check_depth_maps_inputs(conf, config_dir=None):
|
|
41
|
-
"""
|
|
42
|
-
Check the inputs given
|
|
43
|
-
|
|
44
|
-
:param conf: configuration of inputs
|
|
45
|
-
:type conf: dict
|
|
46
|
-
:param config_dir: directory of used json, if
|
|
47
|
-
user filled paths with relative paths
|
|
48
|
-
:type config_dir: str
|
|
49
|
-
|
|
50
|
-
:return: overloader inputs
|
|
51
|
-
:rtype: dict
|
|
52
|
-
"""
|
|
53
|
-
|
|
54
|
-
overloaded_conf = {}
|
|
55
|
-
|
|
56
|
-
# Overload some optional parameters
|
|
57
|
-
overloaded_conf[sens_cst.ROI] = conf.get(sens_cst.ROI, None)
|
|
58
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS] = {}
|
|
59
|
-
|
|
60
|
-
overloaded_conf[sens_cst.INITIAL_ELEVATION] = (
|
|
61
|
-
sens_inp.get_initial_elevation(
|
|
62
|
-
conf.get(sens_cst.INITIAL_ELEVATION, None)
|
|
63
|
-
)
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
overloaded_conf[sens_cst.SENSORS] = conf.get(sens_cst.SENSORS, None)
|
|
67
|
-
|
|
68
|
-
overloaded_conf[sens_cst.PAIRING] = conf.get(sens_cst.PAIRING, None)
|
|
69
|
-
|
|
70
|
-
# Validate inputs
|
|
71
|
-
inputs_schema = {
|
|
72
|
-
depth_map_cst.DEPTH_MAPS: dict,
|
|
73
|
-
sens_cst.ROI: Or(str, dict, None),
|
|
74
|
-
sens_cst.INITIAL_ELEVATION: Or(dict, None),
|
|
75
|
-
sens_cst.SENSORS: Or(dict, None),
|
|
76
|
-
sens_cst.PAIRING: Or([[str]], None),
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
checker_inputs = Checker(inputs_schema)
|
|
80
|
-
checker_inputs.validate(overloaded_conf)
|
|
81
|
-
|
|
82
|
-
# Validate depth maps
|
|
83
|
-
|
|
84
|
-
pc_schema = {
|
|
85
|
-
cst.X: str,
|
|
86
|
-
cst.Y: str,
|
|
87
|
-
cst.Z: str,
|
|
88
|
-
cst.EPI_Z_INF: Or(str, None),
|
|
89
|
-
cst.EPI_Z_SUP: Or(str, None),
|
|
90
|
-
cst.POINT_CLOUD_CLASSIF_KEY_ROOT: Or(str, None),
|
|
91
|
-
cst.POINT_CLOUD_AMBIGUITY_KEY_ROOT: Or(str, None),
|
|
92
|
-
cst.POINT_CLOUD_CLR_KEY_ROOT: str,
|
|
93
|
-
cst.POINT_CLOUD_FILLING_KEY_ROOT: Or(str, None),
|
|
94
|
-
cst.POINT_CLOUD_MSK: Or(str, None),
|
|
95
|
-
cst.POINT_CLOUD_PERFORMANCE_MAP_ROOT: Or(str, None),
|
|
96
|
-
cst.PC_EPSG: Or(str, int, None),
|
|
97
|
-
}
|
|
98
|
-
checker_pc = Checker(pc_schema)
|
|
99
|
-
for depth_map_key in conf[depth_map_cst.DEPTH_MAPS]:
|
|
100
|
-
# Get depth maps with default
|
|
101
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key] = {}
|
|
102
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][cst.X] = conf[
|
|
103
|
-
depth_map_cst.DEPTH_MAPS
|
|
104
|
-
][depth_map_key].get("x", None)
|
|
105
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][cst.Y] = conf[
|
|
106
|
-
depth_map_cst.DEPTH_MAPS
|
|
107
|
-
][depth_map_key].get("y", None)
|
|
108
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][cst.Z] = conf[
|
|
109
|
-
depth_map_cst.DEPTH_MAPS
|
|
110
|
-
][depth_map_key].get("z", None)
|
|
111
|
-
|
|
112
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
113
|
-
cst.EPI_Z_INF
|
|
114
|
-
] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get(
|
|
115
|
-
cst.EPI_Z_INF, None
|
|
116
|
-
)
|
|
117
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
118
|
-
cst.EPI_Z_SUP
|
|
119
|
-
] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get(
|
|
120
|
-
cst.EPI_Z_SUP, None
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
124
|
-
cst.POINT_CLOUD_CLR_KEY_ROOT
|
|
125
|
-
] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get("texture", None)
|
|
126
|
-
|
|
127
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
128
|
-
cst.POINT_CLOUD_MSK
|
|
129
|
-
] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get("mask", None)
|
|
130
|
-
|
|
131
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
132
|
-
cst.POINT_CLOUD_CLASSIF_KEY_ROOT
|
|
133
|
-
] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get(
|
|
134
|
-
"classification", None
|
|
135
|
-
)
|
|
136
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
137
|
-
cst.POINT_CLOUD_PERFORMANCE_MAP_ROOT
|
|
138
|
-
] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get(
|
|
139
|
-
"performance_map", None
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
143
|
-
cst.POINT_CLOUD_FILLING_KEY_ROOT
|
|
144
|
-
] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get("filling", None)
|
|
145
|
-
|
|
146
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
147
|
-
cst.POINT_CLOUD_AMBIGUITY_KEY_ROOT
|
|
148
|
-
] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get("ambiguity", None)
|
|
149
|
-
|
|
150
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
151
|
-
cst.PC_EPSG
|
|
152
|
-
] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get("epsg", 4326)
|
|
153
|
-
# validate
|
|
154
|
-
checker_pc.validate(
|
|
155
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key]
|
|
156
|
-
)
|
|
157
|
-
|
|
158
|
-
# Modify to absolute path
|
|
159
|
-
if config_dir is not None:
|
|
160
|
-
modify_to_absolute_path(config_dir, overloaded_conf)
|
|
161
|
-
else:
|
|
162
|
-
logging.debug(
|
|
163
|
-
"path of config file was not given,"
|
|
164
|
-
"relative path are not transformed to absolute paths"
|
|
165
|
-
)
|
|
166
|
-
|
|
167
|
-
for depth_map_key in conf[depth_map_cst.DEPTH_MAPS]:
|
|
168
|
-
# check sizes
|
|
169
|
-
check_input_size(
|
|
170
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][cst.X],
|
|
171
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][cst.Y],
|
|
172
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][cst.Z],
|
|
173
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
174
|
-
cst.POINT_CLOUD_MSK
|
|
175
|
-
],
|
|
176
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
177
|
-
cst.POINT_CLOUD_CLR_KEY_ROOT
|
|
178
|
-
],
|
|
179
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
180
|
-
cst.POINT_CLOUD_CLASSIF_KEY_ROOT
|
|
181
|
-
],
|
|
182
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
183
|
-
cst.POINT_CLOUD_FILLING_KEY_ROOT
|
|
184
|
-
],
|
|
185
|
-
overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
|
|
186
|
-
cst.POINT_CLOUD_AMBIGUITY_KEY_ROOT
|
|
187
|
-
],
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
# Check srtm dir
|
|
191
|
-
sens_inp.check_srtm(
|
|
192
|
-
overloaded_conf[sens_cst.INITIAL_ELEVATION][sens_cst.DEM_PATH]
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
if sens_cst.SENSORS in conf and conf[sens_cst.SENSORS] is not None:
|
|
196
|
-
sens_inp.check_sensors(conf, overloaded_conf, config_dir)
|
|
197
|
-
|
|
198
|
-
return overloaded_conf
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
def check_geometry_plugin(conf_inputs, conf_geom_plugin):
|
|
202
|
-
"""
|
|
203
|
-
Check the geometry plugin with inputs
|
|
204
|
-
:param conf_geom_plugin: name of geometry plugin
|
|
205
|
-
:type conf_geom_plugin: str
|
|
206
|
-
:param conf_inputs: checked configuration of inputs
|
|
207
|
-
:type conf_inputs: type
|
|
208
|
-
|
|
209
|
-
:return: geometry plugin with dem
|
|
210
|
-
"""
|
|
211
|
-
if conf_geom_plugin is None:
|
|
212
|
-
conf_geom_plugin = "SharelocGeometry"
|
|
213
|
-
|
|
214
|
-
dem_path = conf_inputs[sens_cst.INITIAL_ELEVATION][sens_cst.DEM_PATH]
|
|
215
|
-
|
|
216
|
-
if dem_path is None:
|
|
217
|
-
return conf_geom_plugin, None
|
|
218
|
-
|
|
219
|
-
# Initialize a geometry plugin with elevation information
|
|
220
|
-
geom_plugin_with_dem_and_geoid = (
|
|
221
|
-
AbstractGeometry( # pylint: disable=abstract-class-instantiated
|
|
222
|
-
conf_geom_plugin,
|
|
223
|
-
dem=dem_path,
|
|
224
|
-
geoid=conf_inputs[sens_cst.INITIAL_ELEVATION][sens_cst.GEOID],
|
|
225
|
-
default_alt=sens_cst.CARS_DEFAULT_ALT,
|
|
226
|
-
)
|
|
227
|
-
)
|
|
228
|
-
|
|
229
|
-
return conf_geom_plugin, geom_plugin_with_dem_and_geoid
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
def check_input_size(
|
|
233
|
-
x_path, y_path, z_path, mask, color, classif, filling, ambiguity
|
|
234
|
-
):
|
|
235
|
-
"""
|
|
236
|
-
Check x, y, z, mask, color, classif and ambiguity given
|
|
237
|
-
|
|
238
|
-
Images must have same size
|
|
239
|
-
|
|
240
|
-
:param x_path: x path
|
|
241
|
-
:type x_path: str
|
|
242
|
-
:param y_path: y path
|
|
243
|
-
:type y_path: str
|
|
244
|
-
:param z_path: z path
|
|
245
|
-
:type z_path: str
|
|
246
|
-
:param mask: mask path
|
|
247
|
-
:type mask: str
|
|
248
|
-
:param color: color path
|
|
249
|
-
:type color: str
|
|
250
|
-
:param classif: classif path
|
|
251
|
-
:type classif: str
|
|
252
|
-
:param filling: filling path
|
|
253
|
-
:type filling: str
|
|
254
|
-
:param ambiguity: ambiguity path
|
|
255
|
-
:type ambiguity: str
|
|
256
|
-
"""
|
|
257
|
-
|
|
258
|
-
for path in [x_path, y_path, z_path]:
|
|
259
|
-
if inputs.rasterio_get_nb_bands(path) != 1:
|
|
260
|
-
raise RuntimeError("{} is not mono-band image".format(path))
|
|
261
|
-
|
|
262
|
-
for path in [mask, color, classif, filling, ambiguity]:
|
|
263
|
-
if path is not None:
|
|
264
|
-
if inputs.rasterio_get_size(x_path) != inputs.rasterio_get_size(
|
|
265
|
-
path
|
|
266
|
-
):
|
|
267
|
-
raise RuntimeError(
|
|
268
|
-
"The image {} and {} "
|
|
269
|
-
"do not have the same size".format(x_path, path)
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
def modify_to_absolute_path(config_dir, overloaded_conf):
|
|
274
|
-
"""
|
|
275
|
-
Modify input file path to absolute path
|
|
276
|
-
|
|
277
|
-
:param config_dir: directory of the json/yaml configuration
|
|
278
|
-
:type config_dir: str
|
|
279
|
-
:param overloaded_conf: overloaded configuration json
|
|
280
|
-
:dict overloaded_conf: dict
|
|
281
|
-
"""
|
|
282
|
-
for depth_map_key in overloaded_conf[depth_map_cst.DEPTH_MAPS]:
|
|
283
|
-
depth_map = overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key]
|
|
284
|
-
for tag in [
|
|
285
|
-
cst.X,
|
|
286
|
-
cst.Y,
|
|
287
|
-
cst.Z,
|
|
288
|
-
cst.POINT_CLOUD_CLR_KEY_ROOT,
|
|
289
|
-
cst.POINT_CLOUD_MSK,
|
|
290
|
-
cst.POINT_CLOUD_CLASSIF_KEY_ROOT,
|
|
291
|
-
cst.POINT_CLOUD_FILLING_KEY_ROOT,
|
|
292
|
-
cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT,
|
|
293
|
-
]:
|
|
294
|
-
if tag != cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT:
|
|
295
|
-
if depth_map[tag] is not None:
|
|
296
|
-
depth_map[tag] = make_relative_path_absolute(
|
|
297
|
-
depth_map[tag], config_dir
|
|
298
|
-
)
|
|
299
|
-
else:
|
|
300
|
-
if depth_map[tag] is not None:
|
|
301
|
-
for confidence_name in depth_map[tag]:
|
|
302
|
-
if depth_map[tag][confidence_name] is not None:
|
|
303
|
-
depth_map[tag][confidence_name] = (
|
|
304
|
-
make_relative_path_absolute(
|
|
305
|
-
depth_map[tag][confidence_name],
|
|
306
|
-
config_dir,
|
|
307
|
-
)
|
|
308
|
-
)
|
|
309
|
-
|
|
310
|
-
if overloaded_conf[sens_cst.ROI] is not None:
|
|
311
|
-
if isinstance(overloaded_conf[sens_cst.ROI], str):
|
|
312
|
-
overloaded_conf[sens_cst.ROI] = make_relative_path_absolute(
|
|
313
|
-
overloaded_conf[sens_cst.ROI], config_dir
|
|
314
|
-
)
|
|
@@ -42,6 +42,7 @@ from cars.applications.rasterization.rasterization_wrappers import (
|
|
|
42
42
|
)
|
|
43
43
|
from cars.core import constants as cst
|
|
44
44
|
from cars.core import inputs, preprocessing, tiling
|
|
45
|
+
from cars.core.geometry.abstract_geometry import AbstractGeometry
|
|
45
46
|
from cars.core.utils import make_relative_path_absolute, safe_makedirs
|
|
46
47
|
from cars.data_structures import cars_dataset
|
|
47
48
|
from cars.pipelines.parameters import sensor_inputs as sens_inp
|
|
@@ -213,6 +214,37 @@ def check_dsm_inputs(conf, config_dir=None):
|
|
|
213
214
|
return overloaded_conf
|
|
214
215
|
|
|
215
216
|
|
|
217
|
+
def check_geometry_plugin(conf_inputs, conf_geom_plugin):
|
|
218
|
+
"""
|
|
219
|
+
Check the geometry plugin with inputs
|
|
220
|
+
:param conf_geom_plugin: name of geometry plugin
|
|
221
|
+
:type conf_geom_plugin: str
|
|
222
|
+
:param conf_inputs: checked configuration of inputs
|
|
223
|
+
:type conf_inputs: type
|
|
224
|
+
|
|
225
|
+
:return: geometry plugin with dem
|
|
226
|
+
"""
|
|
227
|
+
if conf_geom_plugin is None:
|
|
228
|
+
conf_geom_plugin = "SharelocGeometry"
|
|
229
|
+
|
|
230
|
+
dem_path = conf_inputs[sens_cst.INITIAL_ELEVATION][sens_cst.DEM_PATH]
|
|
231
|
+
|
|
232
|
+
if dem_path is None:
|
|
233
|
+
return conf_geom_plugin, None
|
|
234
|
+
|
|
235
|
+
# Initialize a geometry plugin with elevation information
|
|
236
|
+
geom_plugin_with_dem_and_geoid = (
|
|
237
|
+
AbstractGeometry( # pylint: disable=abstract-class-instantiated
|
|
238
|
+
conf_geom_plugin,
|
|
239
|
+
dem=dem_path,
|
|
240
|
+
geoid=conf_inputs[sens_cst.INITIAL_ELEVATION][sens_cst.GEOID],
|
|
241
|
+
default_alt=sens_cst.CARS_DEFAULT_ALT,
|
|
242
|
+
)
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
return conf_geom_plugin, geom_plugin_with_dem_and_geoid
|
|
246
|
+
|
|
247
|
+
|
|
216
248
|
def check_input_size(dsm, classif, color, mask):
|
|
217
249
|
"""
|
|
218
250
|
Check dsm, mask, color, classif given
|
|
@@ -318,6 +350,7 @@ def check_phasing(dsm_dict):
|
|
|
318
350
|
raise RuntimeError(f"DSM {dsm_key} and {ref_key} are not phased")
|
|
319
351
|
|
|
320
352
|
|
|
353
|
+
# pylint: disable=too-many-positional-arguments
|
|
321
354
|
def merge_dsm_infos( # noqa: C901 function is too complex
|
|
322
355
|
dict_path,
|
|
323
356
|
orchestrator,
|
|
@@ -378,6 +411,9 @@ def merge_dsm_infos( # noqa: C901 function is too complex
|
|
|
378
411
|
terrain_raster = cars_dataset.CarsDataset("arrays", name="rasterization")
|
|
379
412
|
|
|
380
413
|
# find the global bounds of the dataset
|
|
414
|
+
dsm_nodata = None
|
|
415
|
+
epsg = None
|
|
416
|
+
resolution = None
|
|
381
417
|
for index, path in enumerate(dict_path["dsm"]):
|
|
382
418
|
with rasterio.open(path) as src:
|
|
383
419
|
if index == 0:
|
|
@@ -544,7 +580,7 @@ def merge_dsm_infos( # noqa: C901 function is too complex
|
|
|
544
580
|
return terrain_raster
|
|
545
581
|
|
|
546
582
|
|
|
547
|
-
def dsm_merging_wrapper( # noqa C901
|
|
583
|
+
def dsm_merging_wrapper( # pylint: disable=too-many-positional-arguments # noqa C901
|
|
548
584
|
dict_path,
|
|
549
585
|
tile_bounds,
|
|
550
586
|
resolution,
|
|
@@ -744,7 +780,7 @@ def dsm_merging_wrapper( # noqa C901
|
|
|
744
780
|
return dataset
|
|
745
781
|
|
|
746
782
|
|
|
747
|
-
def assemblage(
|
|
783
|
+
def assemblage( # pylint: disable=too-many-positional-arguments
|
|
748
784
|
out,
|
|
749
785
|
current_weights,
|
|
750
786
|
method,
|
|
@@ -828,11 +864,11 @@ def assemblage(
|
|
|
828
864
|
# doesn't equal to the entire tile
|
|
829
865
|
x_offset = int(
|
|
830
866
|
(intersect_bounds[idx][0] - tile_bounds[0])
|
|
831
|
-
|
|
867
|
+
/ np.abs(src.res[0])
|
|
832
868
|
)
|
|
833
869
|
y_offset = int(
|
|
834
870
|
(tile_bounds[3] - intersect_bounds[idx][3])
|
|
835
|
-
|
|
871
|
+
/ np.abs(src.res[1])
|
|
836
872
|
)
|
|
837
873
|
|
|
838
874
|
if cols > 0 and rows > 0:
|
|
@@ -26,7 +26,7 @@ This module contains the output definition
|
|
|
26
26
|
import logging
|
|
27
27
|
import os
|
|
28
28
|
|
|
29
|
-
from json_checker import Checker, Or
|
|
29
|
+
from json_checker import And, Checker, Or
|
|
30
30
|
from pyproj import CRS
|
|
31
31
|
|
|
32
32
|
import cars.core.constants as cst
|
|
@@ -34,12 +34,29 @@ from cars.core.utils import safe_makedirs
|
|
|
34
34
|
from cars.pipelines.parameters import output_constants
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def
|
|
37
|
+
def is_valid_epsg(epsg) -> bool:
|
|
38
|
+
"""
|
|
39
|
+
Check if the given EPSG code is valid using pyproj.
|
|
40
|
+
"""
|
|
41
|
+
if epsg is None:
|
|
42
|
+
return True
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
# Try creating a CRS
|
|
46
|
+
CRS(f"EPSG:{epsg}")
|
|
47
|
+
return True
|
|
48
|
+
except Exception:
|
|
49
|
+
return False
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def check_output_parameters(conf, scaling_coeff):
|
|
38
53
|
"""
|
|
39
54
|
Check the output json configuration and fill in default values
|
|
40
55
|
|
|
41
56
|
:param conf: configuration of output
|
|
42
57
|
:type conf: dict
|
|
58
|
+
:param scaling_coeff: scaling factor for resolution
|
|
59
|
+
:type scaling_coeff: float
|
|
43
60
|
:param pipeline_name: name of corresponding pipeline
|
|
44
61
|
:type pipeline_name: str
|
|
45
62
|
"""
|
|
@@ -64,15 +81,34 @@ def check_output_parameters(conf):
|
|
|
64
81
|
raise RuntimeError("Unknown product level {}".format(level))
|
|
65
82
|
|
|
66
83
|
overloaded_conf[output_constants.OUT_GEOID] = overloaded_conf.get(
|
|
67
|
-
output_constants.OUT_GEOID,
|
|
84
|
+
output_constants.OUT_GEOID, True
|
|
68
85
|
)
|
|
69
86
|
overloaded_conf[output_constants.EPSG] = overloaded_conf.get(
|
|
70
87
|
output_constants.EPSG, None
|
|
71
88
|
)
|
|
72
89
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
)
|
|
90
|
+
resolution = None
|
|
91
|
+
overloaded_scaling_coeff = scaling_coeff
|
|
92
|
+
if overloaded_conf.get(output_constants.RESOLUTION, None) is not None:
|
|
93
|
+
resolution = overloaded_conf[output_constants.RESOLUTION]
|
|
94
|
+
# update scaling coeff so the parameters are right for the dsm
|
|
95
|
+
# overloaded_scaling_coeff = 2*resolution
|
|
96
|
+
|
|
97
|
+
if resolution < 0.5 * scaling_coeff:
|
|
98
|
+
logging.warning(
|
|
99
|
+
"The requested DSM resolution of "
|
|
100
|
+
f"{overloaded_conf[output_constants.RESOLUTION]} seems "
|
|
101
|
+
"too low for the sensor images' resolution. "
|
|
102
|
+
"The pipeline will still continue with it."
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
else:
|
|
106
|
+
resolution = float(0.5 * scaling_coeff)
|
|
107
|
+
logging.info(
|
|
108
|
+
"The resolution of the output DSM will be " f"{resolution} meters. "
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
overloaded_conf[output_constants.RESOLUTION] = resolution
|
|
76
112
|
|
|
77
113
|
overloaded_conf[output_constants.SAVE_BY_PAIR] = overloaded_conf.get(
|
|
78
114
|
output_constants.SAVE_BY_PAIR, False
|
|
@@ -145,7 +181,7 @@ def check_output_parameters(conf):
|
|
|
145
181
|
output_constants.OUT_DIRECTORY: str,
|
|
146
182
|
output_constants.PRODUCT_LEVEL: list,
|
|
147
183
|
output_constants.OUT_GEOID: Or(bool, str),
|
|
148
|
-
output_constants.EPSG: Or(int, None),
|
|
184
|
+
output_constants.EPSG: And(Or(int, str, None), is_valid_epsg),
|
|
149
185
|
output_constants.RESOLUTION: Or(int, float),
|
|
150
186
|
output_constants.SAVE_BY_PAIR: bool,
|
|
151
187
|
output_constants.AUXILIARY: dict,
|
|
@@ -181,7 +217,7 @@ def check_output_parameters(conf):
|
|
|
181
217
|
+ "fixed according to the epsg"
|
|
182
218
|
)
|
|
183
219
|
|
|
184
|
-
return overloaded_conf
|
|
220
|
+
return overloaded_conf, overloaded_scaling_coeff
|
|
185
221
|
|
|
186
222
|
|
|
187
223
|
def intialize_product_index(orchestrator, product_levels, input_pairs):
|