cars 1.0.0a3__cp313-cp313-win_amd64.whl → 1.0.0a4__cp313-cp313-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.

Files changed (139) hide show
  1. cars/__init__.py +3 -3
  2. cars/applications/__init__.py +0 -3
  3. cars/applications/application_template.py +20 -0
  4. cars/applications/auxiliary_filling/abstract_auxiliary_filling_app.py +12 -2
  5. cars/applications/auxiliary_filling/auxiliary_filling_algo.py +2 -2
  6. cars/applications/auxiliary_filling/auxiliary_filling_from_sensors_app.py +80 -36
  7. cars/applications/dem_generation/dem_generation_algo.py +1 -1
  8. cars/applications/dem_generation/dem_generation_wrappers.py +23 -57
  9. cars/applications/dem_generation/dichotomic_generation_app.py +3 -3
  10. cars/applications/dem_generation/rasterization_app.py +100 -41
  11. cars/applications/dense_match_filling/__init__.py +1 -1
  12. cars/applications/dense_match_filling/abstract_dense_match_filling_app.py +2 -15
  13. cars/applications/dense_match_filling/fill_disp_algo.py +32 -373
  14. cars/applications/dense_match_filling/fill_disp_wrappers.py +0 -343
  15. cars/applications/dense_match_filling/zero_padding_app.py +10 -5
  16. cars/applications/dense_matching/abstract_dense_matching_app.py +2 -1
  17. cars/applications/dense_matching/census_mccnn_sgm_app.py +38 -39
  18. cars/applications/dense_matching/cpp/dense_matching_cpp.cp313-win_amd64.dll.a +0 -0
  19. cars/applications/dense_matching/cpp/dense_matching_cpp.cp313-win_amd64.pyd +0 -0
  20. cars/applications/dense_matching/dense_matching_algo.py +48 -14
  21. cars/applications/dense_matching/dense_matching_wrappers.py +11 -3
  22. cars/applications/dense_matching/disparity_grid_algo.py +84 -62
  23. cars/applications/dense_matching/loaders/pandora_loader.py +91 -33
  24. cars/applications/dsm_filling/border_interpolation_app.py +1 -7
  25. cars/applications/dsm_filling/bulldozer_filling_app.py +2 -8
  26. cars/applications/dsm_filling/exogenous_filling_app.py +4 -9
  27. cars/applications/grid_generation/abstract_grid_generation_app.py +1 -1
  28. cars/applications/grid_generation/epipolar_grid_generation_app.py +4 -2
  29. cars/applications/grid_generation/grid_correction_app.py +4 -1
  30. cars/applications/grid_generation/grid_generation_algo.py +7 -2
  31. cars/applications/ground_truth_reprojection/abstract_ground_truth_reprojection_app.py +1 -1
  32. cars/applications/ground_truth_reprojection/direct_localization_app.py +2 -2
  33. cars/applications/ground_truth_reprojection/ground_truth_reprojection_algo.py +2 -1
  34. cars/applications/point_cloud_fusion/abstract_pc_fusion_app.py +0 -155
  35. cars/applications/point_cloud_fusion/mapping_to_terrain_tiles_app.py +0 -658
  36. cars/applications/point_cloud_fusion/pc_fusion_algo.py +0 -1339
  37. cars/applications/point_cloud_fusion/pc_fusion_wrappers.py +0 -869
  38. cars/applications/point_cloud_outlier_removal/abstract_outlier_removal_app.py +2 -1
  39. cars/applications/point_cloud_outlier_removal/outlier_removal_algo.py +9 -8
  40. cars/applications/point_cloud_outlier_removal/small_components_app.py +96 -267
  41. cars/applications/point_cloud_outlier_removal/statistical_app.py +116 -275
  42. cars/applications/rasterization/abstract_pc_rasterization_app.py +1 -1
  43. cars/applications/rasterization/rasterization_algo.py +18 -6
  44. cars/applications/rasterization/rasterization_wrappers.py +2 -1
  45. cars/applications/rasterization/simple_gaussian_app.py +60 -113
  46. cars/applications/resampling/abstract_resampling_app.py +1 -1
  47. cars/applications/resampling/bicubic_resampling_app.py +3 -1
  48. cars/applications/resampling/resampling_algo.py +16 -4
  49. cars/applications/resampling/resampling_wrappers.py +3 -1
  50. cars/applications/sparse_matching/abstract_sparse_matching_app.py +1 -1
  51. cars/applications/sparse_matching/sift_app.py +3 -3
  52. cars/applications/sparse_matching/sparse_matching_algo.py +3 -2
  53. cars/applications/sparse_matching/sparse_matching_wrappers.py +1 -1
  54. cars/applications/triangulation/abstract_triangulation_app.py +1 -1
  55. cars/applications/triangulation/line_of_sight_intersection_app.py +13 -11
  56. cars/applications/triangulation/pc_transform.py +552 -0
  57. cars/applications/triangulation/triangulation_algo.py +6 -4
  58. cars/applications/triangulation/triangulation_wrappers.py +1 -0
  59. cars/bundleadjustment.py +6 -6
  60. cars/cars.py +11 -9
  61. cars/core/cars_logging.py +80 -49
  62. cars/core/constants.py +0 -1
  63. cars/core/datasets.py +5 -2
  64. cars/core/geometry/abstract_geometry.py +256 -25
  65. cars/core/geometry/shareloc_geometry.py +110 -82
  66. cars/core/inputs.py +57 -19
  67. cars/core/outputs.py +1 -1
  68. cars/core/preprocessing.py +17 -3
  69. cars/core/projection.py +9 -6
  70. cars/core/tiling.py +10 -3
  71. cars/data_structures/cars_dataset.py +5 -5
  72. cars/data_structures/corresponding_tiles_tools.py +0 -103
  73. cars/data_structures/format_transformation.py +4 -1
  74. cars/devibrate.py +6 -3
  75. cars/extractroi.py +20 -21
  76. cars/orchestrator/cluster/abstract_cluster.py +15 -5
  77. cars/orchestrator/cluster/abstract_dask_cluster.py +6 -2
  78. cars/orchestrator/cluster/dask_jobqueue_utils.py +1 -1
  79. cars/orchestrator/cluster/log_wrapper.py +148 -21
  80. cars/orchestrator/cluster/mp_cluster/multiprocessing_cluster.py +11 -3
  81. cars/orchestrator/cluster/mp_cluster/multiprocessing_profiler.py +2 -2
  82. cars/orchestrator/cluster/pbs_dask_cluster.py +1 -1
  83. cars/orchestrator/cluster/sequential_cluster.py +5 -4
  84. cars/orchestrator/cluster/slurm_dask_cluster.py +1 -1
  85. cars/orchestrator/orchestrator.py +14 -3
  86. cars/orchestrator/registry/id_generator.py +1 -0
  87. cars/orchestrator/registry/saver_registry.py +2 -2
  88. cars/pipelines/conf_resolution/conf_final_resolution.json +5 -3
  89. cars/pipelines/default/default_pipeline.py +462 -1073
  90. cars/pipelines/parameters/advanced_parameters.py +74 -64
  91. cars/pipelines/parameters/advanced_parameters_constants.py +2 -5
  92. cars/pipelines/parameters/application_parameters.py +71 -0
  93. cars/pipelines/parameters/depth_map_inputs.py +0 -314
  94. cars/pipelines/parameters/dsm_inputs.py +40 -4
  95. cars/pipelines/parameters/output_parameters.py +2 -2
  96. cars/pipelines/parameters/sensor_inputs.py +30 -75
  97. cars/pipelines/parameters/sensor_inputs_constants.py +0 -2
  98. cars/pipelines/parameters/sensor_loaders/__init__.py +4 -3
  99. cars/pipelines/parameters/sensor_loaders/basic_classif_loader.py +106 -0
  100. cars/pipelines/parameters/sensor_loaders/{basic_sensor_loader.py → basic_image_loader.py} +16 -22
  101. cars/pipelines/parameters/sensor_loaders/pivot_classif_loader.py +121 -0
  102. cars/pipelines/parameters/sensor_loaders/{pivot_sensor_loader.py → pivot_image_loader.py} +10 -21
  103. cars/pipelines/parameters/sensor_loaders/sensor_loader.py +4 -6
  104. cars/pipelines/parameters/sensor_loaders/sensor_loader_template.py +1 -3
  105. cars/pipelines/pipeline_template.py +1 -3
  106. cars/pipelines/unit/unit_pipeline.py +527 -1016
  107. cars/starter.py +4 -3
  108. cars-1.0.0a4.dist-info/DELVEWHEEL +2 -0
  109. {cars-1.0.0a3.dist-info → cars-1.0.0a4.dist-info}/METADATA +135 -53
  110. {cars-1.0.0a3.dist-info → cars-1.0.0a4.dist-info}/RECORD +115 -131
  111. cars.libs/libgcc_s_seh-1-b2494fcbd4d80cf2c98fdd5261f6d850.dll +0 -0
  112. cars.libs/libstdc++-6-e9b0d12ae0e9555bbae55e8dfd08c3f7.dll +0 -0
  113. cars.libs/libwinpthread-1-7882d1b093714ccdfaf4e0789a817792.dll +0 -0
  114. cars/applications/dense_match_filling/cpp/__init__.py +0 -0
  115. cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp313-win_amd64.dll.a +0 -0
  116. cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp313-win_amd64.pyd +0 -0
  117. cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.py +0 -72
  118. cars/applications/dense_match_filling/cpp/includes/dense_match_filling.hpp +0 -46
  119. cars/applications/dense_match_filling/cpp/meson.build +0 -9
  120. cars/applications/dense_match_filling/cpp/src/bindings.cpp +0 -11
  121. cars/applications/dense_match_filling/cpp/src/dense_match_filling.cpp +0 -142
  122. cars/applications/dense_match_filling/plane_app.py +0 -556
  123. cars/applications/hole_detection/__init__.py +0 -30
  124. cars/applications/hole_detection/abstract_hole_detection_app.py +0 -125
  125. cars/applications/hole_detection/cloud_to_bbox_app.py +0 -346
  126. cars/applications/hole_detection/hole_detection_algo.py +0 -144
  127. cars/applications/hole_detection/hole_detection_wrappers.py +0 -53
  128. cars/applications/point_cloud_denoising/__init__.py +0 -29
  129. cars/applications/point_cloud_denoising/abstract_pc_denoising_app.py +0 -273
  130. cars/applications/point_cloud_fusion/__init__.py +0 -30
  131. cars/applications/point_cloud_fusion/cloud_fusion_constants.py +0 -39
  132. cars/applications/sparse_matching/pandora_sparse_matching_app.py +0 -0
  133. cars/pipelines/parameters/depth_map_inputs_constants.py +0 -25
  134. cars-1.0.0a3.dist-info/DELVEWHEEL +0 -2
  135. cars.libs/libgcc_s_seh-1-ca70890bbc5723b6d0ea31e9c9cded2b.dll +0 -0
  136. cars.libs/libstdc++-6-00ee19f73d5122a1277c137b1c218401.dll +0 -0
  137. cars.libs/libwinpthread-1-f5042e8e3d21edce20c1bc99445f551b.dll +0 -0
  138. {cars-1.0.0a3.dist-info → cars-1.0.0a4.dist-info}/WHEEL +0 -0
  139. {cars-1.0.0a3.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
- * np.abs(src.res[0])
867
+ / np.abs(src.res[0])
832
868
  )
833
869
  y_offset = int(
834
870
  (tile_bounds[3] - intersect_bounds[idx][3])
835
- * np.abs(src.res[1])
871
+ / np.abs(src.res[1])
836
872
  )
837
873
 
838
874
  if cols > 0 and rows > 0:
@@ -89,7 +89,7 @@ def check_output_parameters(conf, scaling_coeff):
89
89
 
90
90
  resolution = None
91
91
  overloaded_scaling_coeff = scaling_coeff
92
- if output_constants.RESOLUTION in overloaded_conf:
92
+ if overloaded_conf.get(output_constants.RESOLUTION, None) is not None:
93
93
  resolution = overloaded_conf[output_constants.RESOLUTION]
94
94
  # update scaling coeff so the parameters are right for the dsm
95
95
  # overloaded_scaling_coeff = 2*resolution
@@ -104,7 +104,7 @@ def check_output_parameters(conf, scaling_coeff):
104
104
 
105
105
  else:
106
106
  resolution = float(0.5 * scaling_coeff)
107
- logging.warning(
107
+ logging.info(
108
108
  "The resolution of the output DSM will be " f"{resolution} meters. "
109
109
  )
110
110
 
@@ -29,15 +29,13 @@ import os
29
29
 
30
30
  import numpy as np
31
31
  import rasterio as rio
32
- from json_checker import Checker, OptionalKey, Or
32
+ from json_checker import Checker, Or
33
33
 
34
34
  # CARS imports
35
- from cars.core import inputs, preprocessing, projection, roi_tools
35
+ from cars.core import inputs, projection
36
36
  from cars.core.geometry.abstract_geometry import AbstractGeometry
37
37
  from cars.core.utils import make_relative_path_absolute
38
- from cars.pipelines.parameters import (
39
- depth_map_inputs_constants as depth_map_cst,
40
- )
38
+ from cars.orchestrator.cluster.log_wrapper import cars_profile
41
39
  from cars.pipelines.parameters import sensor_inputs_constants as sens_cst
42
40
  from cars.pipelines.parameters.sensor_loaders.sensor_loader import SensorLoader
43
41
 
@@ -70,7 +68,6 @@ def sensors_check_inputs(conf, config_dir=None): # noqa: C901
70
68
  sens_cst.PAIRING: Or([[str]], None),
71
69
  sens_cst.INITIAL_ELEVATION: Or(str, dict, None),
72
70
  sens_cst.ROI: Or(str, dict, None),
73
- OptionalKey(depth_map_cst.DEPTH_MAPS): dict,
74
71
  }
75
72
 
76
73
  checker_inputs = Checker(inputs_schema)
@@ -113,12 +110,12 @@ def check_sensors(conf, overloaded_conf, config_dir=None): # noqa: C901
113
110
  sens_cst.INPUT_IMG, None
114
111
  )
115
112
  if isinstance(image, str):
116
- loader_name = "basic"
113
+ loader_name = "basic_image"
117
114
  elif isinstance(image, dict):
118
- loader_name = image.get("loader", "basic")
115
+ loader_name = image.get("loader", "basic_image")
119
116
  else:
120
117
  raise TypeError(f"Image {image} is not of type str or dict")
121
- image_loader = SensorLoader(loader_name, image, "image", config_dir)
118
+ image_loader = SensorLoader(loader_name, image, config_dir)
122
119
  image_as_pivot_format = (
123
120
  image_loader.get_pivot_format() # pylint: disable=E1101
124
121
  )
@@ -147,14 +144,12 @@ def check_sensors(conf, overloaded_conf, config_dir=None): # noqa: C901
147
144
  )
148
145
  if classif is not None:
149
146
  if isinstance(classif, str):
150
- loader_name = "basic"
147
+ loader_name = "basic_classif"
151
148
  elif isinstance(classif, dict):
152
- loader_name = classif.get("loader", "basic")
149
+ loader_name = classif.get("loader", "basic_classif")
153
150
  else:
154
151
  raise TypeError(f"Classif {classif} is not of type str or dict")
155
- classif_loader = SensorLoader(
156
- loader_name, classif, "classification", config_dir
157
- )
152
+ classif_loader = SensorLoader(loader_name, classif, config_dir)
158
153
  classif_as_pivot_format = (
159
154
  classif_loader.get_pivot_format() # pylint: disable=E1101
160
155
  )
@@ -296,7 +291,9 @@ def get_sensor_resolution(
296
291
  return (res_x + res_y) / 2
297
292
 
298
293
 
299
- def check_geometry_plugin(conf_inputs, conf_geom_plugin):
294
+ def check_geometry_plugin(
295
+ conf_inputs, conf_geom_plugin, epipolar_resolution, output_dem_dir
296
+ ):
300
297
  """
301
298
  Check the geometry plugin with inputs
302
299
 
@@ -306,6 +303,8 @@ def check_geometry_plugin(conf_inputs, conf_geom_plugin):
306
303
  :type conf_advanced: type
307
304
  :param conf_geom_plugin: name of geometry plugin
308
305
  :type conf_geom_plugin: str
306
+ :param epipolar_resolution: epipolar resolution
307
+ :type epipolar_resolution: int
309
308
  :return: overload inputs conf
310
309
  overloaded geometry plugin conf
311
310
  geometry plugin without dem
@@ -329,8 +328,9 @@ def check_geometry_plugin(conf_inputs, conf_geom_plugin):
329
328
  sensor,
330
329
  geomodel,
331
330
  ) = temp_geom_plugin.check_product_consistency(sensor, geomodel)
332
- average_sensor_resolution += get_sensor_resolution(
333
- temp_geom_plugin, sensor, geomodel
331
+ average_sensor_resolution += (
332
+ get_sensor_resolution(temp_geom_plugin, sensor, geomodel)
333
+ * epipolar_resolution
334
334
  )
335
335
  average_sensor_resolution /= len(conf_inputs[sens_cst.SENSORS])
336
336
  # approximate resolution to the highest digit:
@@ -370,76 +370,29 @@ def check_geometry_plugin(conf_inputs, conf_geom_plugin):
370
370
  ] = geomodel
371
371
 
372
372
  geom_plugin_with_dem_and_geoid = generate_geometry_plugin_with_dem(
373
- conf_geom_plugin, conf_inputs, scaling_coeff=scaling_coeff
373
+ conf_geom_plugin,
374
+ conf_inputs,
375
+ scaling_coeff=scaling_coeff,
376
+ output_dem_dir=output_dem_dir,
374
377
  )
375
378
 
376
- # Check dem is big enough
377
- dem_generation_roi_poly = None
378
- needed_dem_roi = geom_plugin_with_dem_and_geoid.dem_roi
379
- needed_dem_roi_epsg = geom_plugin_with_dem_and_geoid.dem_roi_epsg
380
- if needed_dem_roi is not None:
381
- needed_dem_roi_poly = roi_tools.bounds_to_poly(needed_dem_roi)
382
- # convert to 4326 roi
383
- dem_generation_roi_poly = preprocessing.compute_roi_poly(
384
- needed_dem_roi_poly, needed_dem_roi_epsg, 4326
385
- )
386
-
387
- if (
388
- conf_inputs[sens_cst.INITIAL_ELEVATION][sens_cst.DEM_PATH]
389
- is not None
390
- ):
391
- # get dem total roi
392
- total_input_roi_poly = roi_tools.bounds_to_poly(
393
- inputs.rasterio_get_bounds(
394
- conf_inputs[sens_cst.INITIAL_ELEVATION][sens_cst.DEM_PATH]
395
- )
396
- )
397
- total_input_roi_epsg = inputs.rasterio_get_epsg_code(
398
- conf_inputs[sens_cst.INITIAL_ELEVATION][sens_cst.DEM_PATH]
399
- )
400
- if not isinstance(total_input_roi_epsg, int):
401
- total_input_roi_epsg = total_input_roi_epsg.to_epsg()
402
- total_input_roi_poly = preprocessing.compute_roi_poly(
403
- total_input_roi_poly, total_input_roi_epsg, 4326
404
- )
405
-
406
- # if needed roi not inside dem, raise error
407
- if not total_input_roi_poly.contains_properly(
408
- dem_generation_roi_poly
409
- ):
410
- base_message = (
411
- "Given initial elevation ROI is not covering needed ROI: "
412
- " EPSG:4326, ROI: {}".format(dem_generation_roi_poly.bounds)
413
- )
414
-
415
- if total_input_roi_poly.intersects(dem_generation_roi_poly):
416
- logging.warning(
417
- "{}. Only a part of it intersects. "
418
- "Errors might occur".format(base_message)
419
- )
420
- else:
421
- # Exit, Error is certain to occur
422
- raise RuntimeError(base_message)
423
-
424
- else:
425
- logging.warning(
426
- "Current geometry plugin doesnt compute dem roi needed "
427
- "for later computations. Errors related to unsufficient "
428
- "dem roi might occur."
429
- )
430
-
431
379
  return (
432
380
  overloaded_conf_inputs,
433
381
  conf_geom_plugin,
434
382
  geom_plugin_without_dem_and_geoid,
435
383
  geom_plugin_with_dem_and_geoid,
436
- dem_generation_roi_poly,
437
384
  scaling_coeff,
438
385
  )
439
386
 
440
387
 
388
+ # pylint: disable=too-many-positional-arguments
441
389
  def generate_geometry_plugin_with_dem(
442
- conf_geom_plugin, conf_inputs, dem=None, crop_dem=True, scaling_coeff=1
390
+ conf_geom_plugin,
391
+ conf_inputs,
392
+ dem=None,
393
+ crop_dem=True,
394
+ output_dem_dir=None,
395
+ scaling_coeff=1,
443
396
  ):
444
397
  """
445
398
  Generate geometry plugin with dem and geoid
@@ -483,6 +436,7 @@ def generate_geometry_plugin_with_dem(
483
436
  default_alt=sens_cst.CARS_DEFAULT_ALT,
484
437
  pairs_for_roi=pairs_for_roi,
485
438
  scaling_coeff=scaling_coeff,
439
+ output_dem_dir=output_dem_dir,
486
440
  )
487
441
  )
488
442
 
@@ -738,6 +692,7 @@ def check_all_nbits_equal_one(nbits):
738
692
  return False
739
693
 
740
694
 
695
+ @cars_profile(name="Generate inputs")
741
696
  def generate_inputs(conf, geometry_plugin):
742
697
  """
743
698
  Generate sensors inputs form inputs conf :
@@ -34,8 +34,6 @@ CHECK_INPUTS = "check_inputs"
34
34
  ROI = "roi"
35
35
  GEOID = "geoid"
36
36
  DEM_PATH = "dem"
37
- ALTITUDE_DELTA_MIN = "altitude_delta_min"
38
- ALTITUDE_DELTA_MAX = "altitude_delta_max"
39
37
 
40
38
  INPUT_IMG = "image"
41
39
  INPUT_MSK = "mask"
@@ -22,6 +22,7 @@
22
22
  CARS application module init file
23
23
  """
24
24
 
25
- # Imports needed in order to register application for Application factory
26
- from .basic_sensor_loader import BasicSensorLoader # noqa: F401
27
- from .pivot_sensor_loader import PivotSensorLoader # noqa: F401
25
+ from .basic_classif_loader import BasicClassifSensorLoader # noqa: F401
26
+ from .basic_image_loader import BasicImageSensorLoader # noqa: F401
27
+ from .pivot_classif_loader import PivotClassifSensorLoader # noqa: F401
28
+ from .pivot_image_loader import PivotImageSensorLoader # noqa: F401