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
|
Binary file
|
|
Binary file
|
|
@@ -144,7 +144,7 @@ def compute_disparity_grid(
|
|
|
144
144
|
return disp_min_grid, disp_max_grid
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
def compute_disparity(
|
|
147
|
+
def compute_disparity( # pylint: disable=too-many-positional-arguments
|
|
148
148
|
left_dataset,
|
|
149
149
|
right_dataset,
|
|
150
150
|
corr_cfg,
|
|
@@ -257,19 +257,53 @@ def compute_disparity(
|
|
|
257
257
|
right_dataset = right_dataset.drop_vars([cst.EPI_MSK])
|
|
258
258
|
right_dataset[cst.EPI_MSK] = right_msk
|
|
259
259
|
|
|
260
|
-
#
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
260
|
+
# Check that the datasets are not full of nan (would crash later)
|
|
261
|
+
if left_dataset["msk"].all() or right_dataset["msk"].all():
|
|
262
|
+
height = left_dataset.sizes["row"]
|
|
263
|
+
width = left_dataset.sizes["col"]
|
|
264
|
+
ref = xr.Dataset(
|
|
265
|
+
coords={
|
|
266
|
+
"row": left_dataset.coords["row"],
|
|
267
|
+
"col": left_dataset.coords["col"],
|
|
268
|
+
"indicator": [
|
|
269
|
+
"confidence_from_ambiguity.cars_1",
|
|
270
|
+
"confidence_from_risk_max.cars_2",
|
|
271
|
+
"confidence_from_risk_min.cars_2",
|
|
272
|
+
"confidence_from_disp_sup_from_risk.cars_2",
|
|
273
|
+
"confidence_from_disp_inf_from_risk.cars_2",
|
|
274
|
+
"confidence_from_interval_bounds_inf.cars_3",
|
|
275
|
+
"confidence_from_interval_bounds_sup.cars_3",
|
|
276
|
+
"confidence_from_left_right_consistency",
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
data_vars={
|
|
280
|
+
"disparity_map": (
|
|
281
|
+
("row", "col"),
|
|
282
|
+
np.full((height, width), np.nan, dtype=np.float32),
|
|
283
|
+
),
|
|
284
|
+
"validity_mask": (
|
|
285
|
+
("row", "col"),
|
|
286
|
+
np.ones((height, width), dtype=np.int64),
|
|
287
|
+
),
|
|
288
|
+
"confidence_measure": (
|
|
289
|
+
("row", "col", "indicator"),
|
|
290
|
+
np.full((height, width, 8), np.nan, dtype=np.float32),
|
|
291
|
+
),
|
|
292
|
+
},
|
|
293
|
+
)
|
|
294
|
+
else:
|
|
295
|
+
# Instantiate pandora state machine
|
|
296
|
+
pandora_machine = PandoraMachine()
|
|
297
|
+
# check datasets
|
|
298
|
+
check_datasets(left_dataset, right_dataset)
|
|
299
|
+
|
|
300
|
+
# Run the Pandora pipeline
|
|
301
|
+
ref, _ = pandora.run(
|
|
302
|
+
pandora_machine,
|
|
303
|
+
left_dataset,
|
|
304
|
+
right_dataset,
|
|
305
|
+
corr_cfg,
|
|
306
|
+
)
|
|
273
307
|
|
|
274
308
|
disp_dataset = dm_wrap.create_disp_dataset(
|
|
275
309
|
ref,
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
This module is responsible for the dense matching algorithms:
|
|
22
22
|
- thus it creates a disparity map from a pair of images
|
|
23
23
|
"""
|
|
24
|
-
# pylint: disable=
|
|
24
|
+
# pylint: disable=C0302
|
|
25
25
|
|
|
26
26
|
# Standard imports
|
|
27
27
|
import logging
|
|
28
|
+
import math
|
|
28
29
|
import warnings
|
|
29
30
|
from typing import Dict
|
|
30
31
|
|
|
@@ -281,6 +282,7 @@ def compute_cropped_roi(
|
|
|
281
282
|
)
|
|
282
283
|
|
|
283
284
|
|
|
285
|
+
# pylint: disable=too-many-positional-arguments
|
|
284
286
|
def create_disp_dataset( # noqa: C901
|
|
285
287
|
disp: xr.Dataset,
|
|
286
288
|
ref_dataset: xr.Dataset,
|
|
@@ -513,6 +515,7 @@ def add_crop_info(disp_ds, cropped_range):
|
|
|
513
515
|
return disp_ds
|
|
514
516
|
|
|
515
517
|
|
|
518
|
+
# pylint: disable=too-many-positional-arguments
|
|
516
519
|
def estimate_right_classif_on_left(
|
|
517
520
|
right_classif,
|
|
518
521
|
disp_map,
|
|
@@ -752,6 +755,7 @@ def estimate_right_grid_disp(disp_min_grid, disp_max_grid):
|
|
|
752
755
|
)
|
|
753
756
|
|
|
754
757
|
|
|
758
|
+
# pylint: disable=too-many-positional-arguments
|
|
755
759
|
def optimal_tile_size_pandora_plugin_libsgm(
|
|
756
760
|
disp_min: int,
|
|
757
761
|
disp_max: int,
|
|
@@ -779,7 +783,7 @@ def optimal_tile_size_pandora_plugin_libsgm(
|
|
|
779
783
|
"""
|
|
780
784
|
|
|
781
785
|
memory = max_ram_per_worker
|
|
782
|
-
disp = disp_max - disp_min
|
|
786
|
+
disp = max(3, abs(disp_max - disp_min))
|
|
783
787
|
|
|
784
788
|
image = 32 * 2
|
|
785
789
|
disp_ref = 32
|
|
@@ -809,13 +813,17 @@ def optimal_tile_size_pandora_plugin_libsgm(
|
|
|
809
813
|
# but sqrt(nb_pixels + (disp/2)**2) - disp/2
|
|
810
814
|
tile_size = np.sqrt(row_or_col + (disp / 2) ** 2) - disp / 2
|
|
811
815
|
tile_size = (1.0 - margin / 100.0) * tile_size
|
|
812
|
-
|
|
816
|
+
|
|
817
|
+
if math.isinf(tile_size):
|
|
818
|
+
logging.warning("Tile size infinite")
|
|
813
819
|
|
|
814
820
|
if tile_size > max_tile_size:
|
|
815
821
|
tile_size = max_tile_size
|
|
816
822
|
elif tile_size < min_tile_size:
|
|
817
823
|
tile_size = min_tile_size
|
|
818
824
|
|
|
825
|
+
tile_size = tile_size_rounding * int(tile_size / tile_size_rounding)
|
|
826
|
+
|
|
819
827
|
return tile_size
|
|
820
828
|
|
|
821
829
|
|
|
@@ -27,7 +27,6 @@ import itertools
|
|
|
27
27
|
import logging
|
|
28
28
|
|
|
29
29
|
# Third party imports
|
|
30
|
-
import affine
|
|
31
30
|
import numpy as np
|
|
32
31
|
import rasterio
|
|
33
32
|
import xarray as xr
|
|
@@ -45,6 +44,7 @@ from cars.core.projection import point_cloud_conversion
|
|
|
45
44
|
from cars.data_structures import cars_dataset, cars_dict
|
|
46
45
|
|
|
47
46
|
|
|
47
|
+
# pylint: disable=too-many-positional-arguments
|
|
48
48
|
def generate_disp_grids_dataset(
|
|
49
49
|
grid_min,
|
|
50
50
|
grid_max,
|
|
@@ -103,6 +103,7 @@ def generate_disp_grids_dataset(
|
|
|
103
103
|
return disp_range_tile
|
|
104
104
|
|
|
105
105
|
|
|
106
|
+
# pylint: disable=too-many-positional-arguments
|
|
106
107
|
def generate_disp_range_const_tile_wrapper(
|
|
107
108
|
row_range,
|
|
108
109
|
col_range,
|
|
@@ -152,6 +153,7 @@ def generate_disp_range_const_tile_wrapper(
|
|
|
152
153
|
return disp_range, global_infos
|
|
153
154
|
|
|
154
155
|
|
|
156
|
+
# pylint: disable=too-many-positional-arguments
|
|
155
157
|
def generate_disp_range_from_dem_wrapper(
|
|
156
158
|
epipolar_grid_array_window,
|
|
157
159
|
full_epi_row_range,
|
|
@@ -162,8 +164,6 @@ def generate_disp_range_from_dem_wrapper(
|
|
|
162
164
|
dem_median,
|
|
163
165
|
dem_min,
|
|
164
166
|
dem_max,
|
|
165
|
-
altitude_delta_min,
|
|
166
|
-
altitude_delta_max,
|
|
167
167
|
raster_profile,
|
|
168
168
|
saving_info,
|
|
169
169
|
saving_info_global_infos,
|
|
@@ -193,10 +193,6 @@ def generate_disp_range_from_dem_wrapper(
|
|
|
193
193
|
:type dem_min: str
|
|
194
194
|
:param dem_max: Path of dem max.
|
|
195
195
|
:type dem_max: srt
|
|
196
|
-
:param altitude_delta_min: The minimum altitude delta.
|
|
197
|
-
:type altitude_delta_min: float
|
|
198
|
-
:param altitude_delta_max: The maximum altitude delta.
|
|
199
|
-
:type altitude_delta_max: float
|
|
200
196
|
:param raster_profile: The raster profile.
|
|
201
197
|
:type raster_profile: dict
|
|
202
198
|
:param saving_info: The disp range grid saving information.
|
|
@@ -216,6 +212,13 @@ def generate_disp_range_from_dem_wrapper(
|
|
|
216
212
|
:rtype: dict
|
|
217
213
|
"""
|
|
218
214
|
|
|
215
|
+
# compute reverse matrix
|
|
216
|
+
transform_sensor = inputs.rasterio_get_transform(
|
|
217
|
+
sensor_image_right["image"]["main_file"], convention="north"
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
trans_inv_sensor = ~transform_sensor
|
|
221
|
+
|
|
219
222
|
# Geometry plugin
|
|
220
223
|
geo_plugin = geom_plugin_with_dem_and_geoid
|
|
221
224
|
|
|
@@ -275,15 +278,14 @@ def generate_disp_range_from_dem_wrapper(
|
|
|
275
278
|
(np.max(col_range_with_margin), np.min(row_range_with_margin)),
|
|
276
279
|
(np.max(col_range_with_margin), np.max(row_range_with_margin)),
|
|
277
280
|
]
|
|
278
|
-
sensor_bbox = geo_plugin.sensor_position_from_grid(
|
|
279
|
-
|
|
280
|
-
sensor_image_right["image"]["main_file"]
|
|
281
|
+
sensor_bbox = geo_plugin.sensor_position_from_grid(
|
|
282
|
+
grid_right, epi_bbox, interpolation_method="linear"
|
|
281
283
|
)
|
|
282
284
|
row_sensor_bbox, col_sensor_bbox = transform_physical_point_to_index(
|
|
283
|
-
|
|
285
|
+
trans_inv_sensor, sensor_bbox[:, 1], sensor_bbox[:, 0]
|
|
284
286
|
)
|
|
285
287
|
|
|
286
|
-
terrain_bbox = geo_plugin.
|
|
288
|
+
terrain_bbox = geo_plugin.safe_direct_loc(
|
|
287
289
|
sensor_image_right["image"]["main_file"],
|
|
288
290
|
sensor_image_right["geomodel"],
|
|
289
291
|
col_sensor_bbox,
|
|
@@ -340,18 +342,26 @@ def generate_disp_range_from_dem_wrapper(
|
|
|
340
342
|
lon_mean = terrain_position_lon_lat[:, 0]
|
|
341
343
|
lat_mean = terrain_position_lon_lat[:, 1]
|
|
342
344
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
# dem min and max are in 4326
|
|
346
|
+
dem_min_list = inputs.rasterio_get_values(
|
|
347
|
+
dem_min, lon_mean, lat_mean, point_cloud_conversion
|
|
348
|
+
)
|
|
349
|
+
dem_max_list = inputs.rasterio_get_values(
|
|
350
|
+
dem_max, lon_mean, lat_mean, point_cloud_conversion
|
|
351
|
+
)
|
|
352
|
+
if dem_min_list is None or dem_max_list is None:
|
|
353
|
+
logging.warning("DEM min and DEM max does not cover this tile")
|
|
354
|
+
disp_range, global_infos = empty_disparity_grids(
|
|
355
|
+
row_range_no_margin,
|
|
356
|
+
col_range_no_margin,
|
|
357
|
+
epipolar_grid_array_window,
|
|
358
|
+
raster_profile,
|
|
359
|
+
saving_info,
|
|
360
|
+
saving_info_global_infos,
|
|
350
361
|
)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
dem_max_list = dem_median_list + altitude_delta_max
|
|
362
|
+
return disp_range, global_infos
|
|
363
|
+
|
|
364
|
+
nan_mask = nan_mask & ~np.isnan(dem_min_list) & ~np.isnan(dem_max_list)
|
|
355
365
|
|
|
356
366
|
# filter nan value from input points
|
|
357
367
|
lon_mean = lon_mean[nan_mask]
|
|
@@ -365,7 +375,7 @@ def generate_disp_range_from_dem_wrapper(
|
|
|
365
375
|
ind_cols_sensor,
|
|
366
376
|
ind_rows_sensor,
|
|
367
377
|
_,
|
|
368
|
-
) = geom_plugin_with_dem_and_geoid.
|
|
378
|
+
) = geom_plugin_with_dem_and_geoid.safe_inverse_loc(
|
|
369
379
|
sensor_image_right["image"]["main_file"],
|
|
370
380
|
sensor_image_right["geomodel"],
|
|
371
381
|
lat_mean,
|
|
@@ -394,71 +404,27 @@ def generate_disp_range_from_dem_wrapper(
|
|
|
394
404
|
2,
|
|
395
405
|
),
|
|
396
406
|
),
|
|
407
|
+
interpolation_method="linear",
|
|
397
408
|
)
|
|
398
409
|
)
|
|
399
410
|
|
|
400
|
-
#
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
sensor_image_right["image"]["main_file"]
|
|
405
|
-
)
|
|
411
|
+
# Transform physical position to index
|
|
412
|
+
ind_rows_sensor_grid, ind_cols_sensor_grid = (
|
|
413
|
+
transform_physical_point_to_index(
|
|
414
|
+
trans_inv_sensor, sensors_positions[:, 1], sensors_positions[:, 0]
|
|
406
415
|
)
|
|
407
416
|
)
|
|
408
417
|
|
|
409
|
-
trans_inv = ~transform_sensor
|
|
410
|
-
# Transform to positive values
|
|
411
|
-
trans_inv = np.array(trans_inv)
|
|
412
|
-
trans_inv = np.reshape(trans_inv, (3, 3))
|
|
413
|
-
if trans_inv[0, 0] < 0:
|
|
414
|
-
trans_inv[0, :] *= -1
|
|
415
|
-
if trans_inv[1, 1] < 0:
|
|
416
|
-
trans_inv[1, :] *= -1
|
|
417
|
-
trans_inv = affine.Affine(*list(trans_inv.flatten()))
|
|
418
|
-
|
|
419
|
-
# Transform physical position to index
|
|
420
|
-
index_positions = np.empty(sensors_positions.shape)
|
|
421
|
-
for row_point in range(index_positions.shape[0]):
|
|
422
|
-
row_geo, col_geo = sensors_positions[row_point, :]
|
|
423
|
-
col, row = trans_inv * (row_geo, col_geo)
|
|
424
|
-
index_positions[row_point, :] = (row, col)
|
|
425
|
-
|
|
426
|
-
ind_rows_sensor_grid = index_positions[:, 0] - 0.5
|
|
427
|
-
ind_cols_sensor_grid = index_positions[:, 1] - 0.5
|
|
428
|
-
|
|
429
418
|
if len(ind_rows_sensor) < 5:
|
|
430
419
|
# QH6214 needs at least 4 points for interpolation
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
grid_max = np.empty(
|
|
436
|
-
(len(row_range_no_margin), len(col_range_no_margin))
|
|
437
|
-
)
|
|
438
|
-
grid_min[:, :] = 0
|
|
439
|
-
grid_max[:, :] = 0
|
|
440
|
-
|
|
441
|
-
disp_range = generate_disp_grids_dataset(
|
|
442
|
-
grid_min,
|
|
443
|
-
grid_max,
|
|
444
|
-
saving_info,
|
|
420
|
+
disp_range, global_infos = empty_disparity_grids(
|
|
421
|
+
row_range_no_margin,
|
|
422
|
+
col_range_no_margin,
|
|
423
|
+
epipolar_grid_array_window,
|
|
445
424
|
raster_profile,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
col_coords=col_range_no_margin,
|
|
449
|
-
)
|
|
450
|
-
|
|
451
|
-
# Generate infos on global min and max
|
|
452
|
-
global_infos = cars_dict.CarsDict(
|
|
453
|
-
{
|
|
454
|
-
"global_min": 0,
|
|
455
|
-
"global_max": 0,
|
|
456
|
-
}
|
|
457
|
-
)
|
|
458
|
-
cars_dataset.fill_dict(
|
|
459
|
-
global_infos, saving_info=saving_info_global_infos
|
|
425
|
+
saving_info,
|
|
426
|
+
saving_info_global_infos,
|
|
460
427
|
)
|
|
461
|
-
|
|
462
428
|
return disp_range, global_infos
|
|
463
429
|
|
|
464
430
|
# Interpolate disparity
|
|
@@ -548,6 +514,56 @@ def generate_disp_range_from_dem_wrapper(
|
|
|
548
514
|
return disp_range, global_infos
|
|
549
515
|
|
|
550
516
|
|
|
517
|
+
def empty_disparity_grids( # pylint: disable=too-many-positional-arguments
|
|
518
|
+
row_range_no_margin,
|
|
519
|
+
col_range_no_margin,
|
|
520
|
+
epipolar_grid_array_window,
|
|
521
|
+
raster_profile,
|
|
522
|
+
saving_info,
|
|
523
|
+
saving_info_global_infos,
|
|
524
|
+
):
|
|
525
|
+
"""
|
|
526
|
+
Return empty disparity grids
|
|
527
|
+
:param row_range_no_margin: Rows id in grid
|
|
528
|
+
:type row_range_no_margin: int
|
|
529
|
+
:param col_range_no_margin: Cols id in grid
|
|
530
|
+
:type col_range_no_margin: int
|
|
531
|
+
:param epipolar_grid_array_window: ROI of grid
|
|
532
|
+
:type epipolar_grid_array_window: dict
|
|
533
|
+
:param raster_profile: The raster profile.
|
|
534
|
+
:type raster_profile: dict
|
|
535
|
+
:param saving_info: The disp range grid saving information.
|
|
536
|
+
:type saving_info: dict
|
|
537
|
+
:param saving_info_global_infos: Global info saving infos.
|
|
538
|
+
:type saving_info_global_infos: dict
|
|
539
|
+
"""
|
|
540
|
+
grid_min = np.empty((len(row_range_no_margin), len(col_range_no_margin)))
|
|
541
|
+
grid_max = np.empty((len(row_range_no_margin), len(col_range_no_margin)))
|
|
542
|
+
grid_min[:, :] = 0
|
|
543
|
+
grid_max[:, :] = 0
|
|
544
|
+
|
|
545
|
+
disp_range = generate_disp_grids_dataset(
|
|
546
|
+
grid_min,
|
|
547
|
+
grid_max,
|
|
548
|
+
saving_info,
|
|
549
|
+
raster_profile,
|
|
550
|
+
window=epipolar_grid_array_window,
|
|
551
|
+
row_coords=row_range_no_margin,
|
|
552
|
+
col_coords=col_range_no_margin,
|
|
553
|
+
)
|
|
554
|
+
|
|
555
|
+
# Generate infos on global min and max
|
|
556
|
+
global_infos = cars_dict.CarsDict(
|
|
557
|
+
{
|
|
558
|
+
"global_min": 0,
|
|
559
|
+
"global_max": 0,
|
|
560
|
+
}
|
|
561
|
+
)
|
|
562
|
+
cars_dataset.fill_dict(global_infos, saving_info=saving_info_global_infos)
|
|
563
|
+
|
|
564
|
+
return disp_range, global_infos
|
|
565
|
+
|
|
566
|
+
|
|
551
567
|
def create_circular_mask(height, width):
|
|
552
568
|
"""
|
|
553
569
|
Create a circular mask for footprint around pixel
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"10": "census_sgm_mountain_and_vegetation",
|
|
3
|
+
"20": "census_sgm_mountain_and_vegetation",
|
|
4
|
+
"30": "census_sgm_mountain_and_vegetation",
|
|
5
|
+
"40": "census_sgm_mountain_and_vegetation",
|
|
6
|
+
"50": "census_sgm_urban",
|
|
7
|
+
"60": "census_sgm_homogeneous",
|
|
8
|
+
"70": "census_sgm_mountain_and_vegetation",
|
|
9
|
+
"80": "census_sgm_mountain_and_vegetation",
|
|
10
|
+
"90": "census_sgm_mountain_and_vegetation",
|
|
11
|
+
"95": "census_sgm_mountain_and_vegetation",
|
|
12
|
+
"100": "census_sgm_mountain_and_vegetation"
|
|
13
|
+
}
|
|
Binary file
|