cars 1.0.0a2__cp312-cp312-win_amd64.whl → 1.0.0a4__cp312-cp312-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.cp312-win_amd64.dll.a +0 -0
- cars/applications/dense_matching/cpp/dense_matching_cpp.cp312-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.cp312-win_amd64.dll.a +0 -0
- cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp312-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
|
@@ -42,21 +42,25 @@ from json_checker import Checker, Or
|
|
|
42
42
|
|
|
43
43
|
import cars.orchestrator.orchestrator as ocht
|
|
44
44
|
from cars.applications import application_constants
|
|
45
|
-
from cars.applications.point_cloud_fusion import pc_fusion_algo
|
|
46
45
|
|
|
47
46
|
# CARS imports
|
|
48
|
-
from cars.applications.rasterization import
|
|
47
|
+
from cars.applications.rasterization import (
|
|
48
|
+
rasterization_algo,
|
|
49
|
+
)
|
|
49
50
|
from cars.applications.rasterization import (
|
|
50
51
|
rasterization_constants as raster_cst,
|
|
51
52
|
)
|
|
52
|
-
from cars.applications.rasterization import
|
|
53
|
+
from cars.applications.rasterization import (
|
|
54
|
+
rasterization_wrappers,
|
|
55
|
+
)
|
|
53
56
|
from cars.applications.rasterization.abstract_pc_rasterization_app import (
|
|
54
57
|
PointCloudRasterization,
|
|
55
58
|
)
|
|
59
|
+
from cars.applications.triangulation import pc_transform
|
|
56
60
|
from cars.core import constants as cst
|
|
57
61
|
from cars.core import projection, tiling
|
|
58
62
|
from cars.core.utils import safe_makedirs
|
|
59
|
-
from cars.data_structures import cars_dataset
|
|
63
|
+
from cars.data_structures import cars_dataset
|
|
60
64
|
|
|
61
65
|
# R0903 temporary disabled for error "Too few public methods"
|
|
62
66
|
# œgoing to be corrected by adding new methods as check_conf
|
|
@@ -204,10 +208,12 @@ class SimpleGaussian(
|
|
|
204
208
|
)
|
|
205
209
|
return tile_size
|
|
206
210
|
|
|
211
|
+
# pylint: disable=too-many-positional-arguments
|
|
207
212
|
def run( # noqa: C901 function is too complex
|
|
208
213
|
self,
|
|
209
214
|
point_clouds,
|
|
210
215
|
epsg,
|
|
216
|
+
output_crs,
|
|
211
217
|
resolution,
|
|
212
218
|
orchestrator=None,
|
|
213
219
|
dsm_file_name=None,
|
|
@@ -256,6 +262,8 @@ class SimpleGaussian(
|
|
|
256
262
|
:type point_clouds: CarsDataset filled with pandas.DataFrame
|
|
257
263
|
:param epsg: epsg of raster data
|
|
258
264
|
:type epsg: str
|
|
265
|
+
:param output_crs: output_crs of raster data
|
|
266
|
+
:type output_crs: str
|
|
259
267
|
:param resolution: resolution of raster data (in target CRS unit)
|
|
260
268
|
:type resolution: float
|
|
261
269
|
:param orchestrator: orchestrator used
|
|
@@ -267,7 +275,7 @@ class SimpleGaussian(
|
|
|
267
275
|
:type color_file_name: str
|
|
268
276
|
:param mask_file_name: path of color
|
|
269
277
|
:type mask_file_name: str
|
|
270
|
-
:param classif_file_name: path of
|
|
278
|
+
:param classif_file_name: path of classification
|
|
271
279
|
:type classif_file_name: str
|
|
272
280
|
:param performance_map_file_name: path of performance map file
|
|
273
281
|
:type performance_map_file_name: str
|
|
@@ -317,6 +325,27 @@ class SimpleGaussian(
|
|
|
317
325
|
# Get if color, mask and stats are saved
|
|
318
326
|
save_intermediate_data = self.used_config["save_intermediate_data"]
|
|
319
327
|
|
|
328
|
+
keep_dir = (
|
|
329
|
+
len(
|
|
330
|
+
list(
|
|
331
|
+
filter(
|
|
332
|
+
lambda x: x is not None,
|
|
333
|
+
[
|
|
334
|
+
weights_file_name,
|
|
335
|
+
color_file_name,
|
|
336
|
+
mask_file_name,
|
|
337
|
+
classif_file_name,
|
|
338
|
+
performance_map_file_name,
|
|
339
|
+
ambiguity_file_name,
|
|
340
|
+
contributing_pair_file_name,
|
|
341
|
+
filling_file_name,
|
|
342
|
+
],
|
|
343
|
+
)
|
|
344
|
+
)
|
|
345
|
+
)
|
|
346
|
+
> 0
|
|
347
|
+
)
|
|
348
|
+
|
|
320
349
|
if not self.color_dtype:
|
|
321
350
|
self.color_dtype = color_dtype
|
|
322
351
|
|
|
@@ -333,27 +362,19 @@ class SimpleGaussian(
|
|
|
333
362
|
if dump_dir is not None:
|
|
334
363
|
out_dump_dir = dump_dir
|
|
335
364
|
safe_makedirs(dump_dir)
|
|
336
|
-
if not save_intermediate_data:
|
|
365
|
+
if not save_intermediate_data and not keep_dir:
|
|
337
366
|
self.orchestrator.add_to_clean(dump_dir)
|
|
338
367
|
else:
|
|
339
368
|
out_dump_dir = self.orchestrator.out_dir
|
|
340
369
|
|
|
341
370
|
# Check if input data is supported
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
else:
|
|
348
|
-
data_valid = False
|
|
349
|
-
elif isinstance(point_clouds, cars_dataset.CarsDataset):
|
|
350
|
-
if point_clouds.dataset_type != "points":
|
|
351
|
-
data_valid = False
|
|
352
|
-
else:
|
|
353
|
-
data_valid = False
|
|
354
|
-
if not data_valid:
|
|
371
|
+
if not (
|
|
372
|
+
isinstance(point_clouds, tuple)
|
|
373
|
+
and isinstance(point_clouds[0][0], cars_dataset.CarsDataset)
|
|
374
|
+
and point_clouds[0][0].dataset_type == "arrays"
|
|
375
|
+
):
|
|
355
376
|
message = (
|
|
356
|
-
"
|
|
377
|
+
"PointCloudRasterization application doesn't support "
|
|
357
378
|
"this input data "
|
|
358
379
|
"format : type : {}".format(type(point_clouds))
|
|
359
380
|
)
|
|
@@ -365,24 +386,17 @@ class SimpleGaussian(
|
|
|
365
386
|
"arrays", name="rasterization"
|
|
366
387
|
)
|
|
367
388
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
# CarsDataset is only used for processing
|
|
380
|
-
nb_tiles = 0
|
|
381
|
-
for point_cld in point_clouds[0]:
|
|
382
|
-
nb_tiles += point_cld.shape[0] * point_cld.shape[1]
|
|
383
|
-
terrain_raster.tiling_grid = tiling.generate_tiling_grid(
|
|
384
|
-
0, 0, 1, nb_tiles, 1, 1
|
|
385
|
-
)
|
|
389
|
+
paths_data = {}
|
|
390
|
+
|
|
391
|
+
bounds = point_clouds[1]
|
|
392
|
+
# tiling grid: all tiles from sources -> not replaceable.
|
|
393
|
+
# CarsDataset is only used for processing
|
|
394
|
+
nb_tiles = 0
|
|
395
|
+
for point_cld in point_clouds[0]:
|
|
396
|
+
nb_tiles += point_cld.shape[0] * point_cld.shape[1]
|
|
397
|
+
terrain_raster.tiling_grid = tiling.generate_tiling_grid(
|
|
398
|
+
0, 0, 1, nb_tiles, 1, 1
|
|
399
|
+
)
|
|
386
400
|
|
|
387
401
|
terrain_raster.generate_none_tiles()
|
|
388
402
|
|
|
@@ -421,6 +435,7 @@ class SimpleGaussian(
|
|
|
421
435
|
safe_makedirs(os.path.dirname(dsm_file_name))
|
|
422
436
|
|
|
423
437
|
out_dsm_file_name = dsm_file_name
|
|
438
|
+
|
|
424
439
|
if out_dsm_file_name is not None:
|
|
425
440
|
self.orchestrator.update_index(
|
|
426
441
|
{
|
|
@@ -442,6 +457,7 @@ class SimpleGaussian(
|
|
|
442
457
|
nodata=self.dsm_no_data,
|
|
443
458
|
cars_ds_name="dsm",
|
|
444
459
|
)
|
|
460
|
+
paths_data[cst.RASTER_HGT] = out_dsm_file_name
|
|
445
461
|
|
|
446
462
|
out_weights_file_name = weights_file_name
|
|
447
463
|
if out_weights_file_name is not None:
|
|
@@ -469,6 +485,7 @@ class SimpleGaussian(
|
|
|
469
485
|
nodata=0,
|
|
470
486
|
cars_ds_name="dsm_weights",
|
|
471
487
|
)
|
|
488
|
+
paths_data[cst.RASTER_WEIGHTS_SUM] = out_weights_file_name
|
|
472
489
|
|
|
473
490
|
out_clr_file_name = color_file_name
|
|
474
491
|
if out_clr_file_name is not None:
|
|
@@ -494,6 +511,7 @@ class SimpleGaussian(
|
|
|
494
511
|
nodata=self.texture_no_data,
|
|
495
512
|
cars_ds_name="texture",
|
|
496
513
|
)
|
|
514
|
+
paths_data[cst.RASTER_COLOR_IMG] = out_clr_file_name
|
|
497
515
|
|
|
498
516
|
out_classif_file_name = classif_file_name
|
|
499
517
|
if out_classif_file_name is not None:
|
|
@@ -512,6 +530,7 @@ class SimpleGaussian(
|
|
|
512
530
|
out_classif_file_name = os.path.join(
|
|
513
531
|
out_dump_dir, "classification.tif"
|
|
514
532
|
)
|
|
533
|
+
|
|
515
534
|
if out_classif_file_name is not None:
|
|
516
535
|
list_computed_layers += ["classif"]
|
|
517
536
|
self.orchestrator.add_to_save_lists(
|
|
@@ -523,6 +542,7 @@ class SimpleGaussian(
|
|
|
523
542
|
cars_ds_name="dsm_classif",
|
|
524
543
|
optional_data=True,
|
|
525
544
|
)
|
|
545
|
+
paths_data[cst.RASTER_CLASSIF] = out_classif_file_name
|
|
526
546
|
|
|
527
547
|
out_msk_file_name = mask_file_name
|
|
528
548
|
if out_msk_file_name is not None:
|
|
@@ -548,6 +568,7 @@ class SimpleGaussian(
|
|
|
548
568
|
cars_ds_name="dsm_mask",
|
|
549
569
|
optional_data=True,
|
|
550
570
|
)
|
|
571
|
+
paths_data[cst.RASTER_MSK] = out_msk_file_name
|
|
551
572
|
|
|
552
573
|
out_performance_map = performance_map_file_name
|
|
553
574
|
|
|
@@ -589,6 +610,7 @@ class SimpleGaussian(
|
|
|
589
610
|
cars_ds_name="performance_map_raw",
|
|
590
611
|
optional_data=True,
|
|
591
612
|
)
|
|
613
|
+
paths_data[cst.RASTER_PERFORMANCE_MAP_RAW] = out_performance_map_raw
|
|
592
614
|
if (
|
|
593
615
|
out_performance_map is not None
|
|
594
616
|
and performance_map_classes is not None
|
|
@@ -604,6 +626,7 @@ class SimpleGaussian(
|
|
|
604
626
|
cars_ds_name="performance_map",
|
|
605
627
|
optional_data=True,
|
|
606
628
|
)
|
|
629
|
+
paths_data[cst.RASTER_PERFORMANCE_MAP] = out_performance_map
|
|
607
630
|
|
|
608
631
|
out_ambiguity = ambiguity_file_name
|
|
609
632
|
if out_ambiguity is not None:
|
|
@@ -629,6 +652,7 @@ class SimpleGaussian(
|
|
|
629
652
|
cars_ds_name="ambiguity",
|
|
630
653
|
optional_data=True,
|
|
631
654
|
)
|
|
655
|
+
paths_data[cst.RASTER_AMBIGUITY] = out_ambiguity
|
|
632
656
|
|
|
633
657
|
out_source_pc = contributing_pair_file_name
|
|
634
658
|
if out_source_pc is not None:
|
|
@@ -656,6 +680,7 @@ class SimpleGaussian(
|
|
|
656
680
|
cars_ds_name="contributing_pair",
|
|
657
681
|
optional_data=True,
|
|
658
682
|
)
|
|
683
|
+
paths_data[cst.RASTER_SOURCE_PC] = out_source_pc
|
|
659
684
|
|
|
660
685
|
out_filling = filling_file_name
|
|
661
686
|
if out_filling is not None:
|
|
@@ -677,6 +702,7 @@ class SimpleGaussian(
|
|
|
677
702
|
cars_ds_name="filling",
|
|
678
703
|
optional_data=True,
|
|
679
704
|
)
|
|
705
|
+
paths_data[cst.RASTER_FILLING] = out_filling
|
|
680
706
|
|
|
681
707
|
# TODO Check that intervals indeed exist!
|
|
682
708
|
if save_intermediate_data:
|
|
@@ -817,7 +843,7 @@ class SimpleGaussian(
|
|
|
817
843
|
"driver": "GTiff",
|
|
818
844
|
"dtype": "float32",
|
|
819
845
|
"transform": transform,
|
|
820
|
-
"crs":
|
|
846
|
+
"crs": output_crs.to_wkt(),
|
|
821
847
|
"tiled": True,
|
|
822
848
|
}
|
|
823
849
|
)
|
|
@@ -848,53 +874,34 @@ class SimpleGaussian(
|
|
|
848
874
|
|
|
849
875
|
self.orchestrator.update_out_info(updating_dict)
|
|
850
876
|
|
|
851
|
-
#
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
row, col
|
|
877
|
+
# Add attributrs
|
|
878
|
+
terrain_raster.attributes["paths"] = paths_data
|
|
879
|
+
|
|
880
|
+
# Add final function to apply
|
|
881
|
+
terrain_raster.final_function = raster_final_function
|
|
882
|
+
ind_tile = 0
|
|
883
|
+
for point_cloud in point_clouds[0]:
|
|
884
|
+
for row_pc in range(point_cloud.shape[0]):
|
|
885
|
+
for col_pc in range(point_cloud.shape[1]):
|
|
886
|
+
# update saving infos for potential replacement
|
|
887
|
+
full_saving_info = ocht.update_saving_infos(
|
|
888
|
+
saving_info, row=0, col=ind_tile
|
|
864
889
|
)
|
|
865
|
-
|
|
866
|
-
if point_clouds.tiles[pc_row][pc_col] is not None:
|
|
867
|
-
# Get window
|
|
868
|
-
window = cars_dataset.window_array_to_dict(
|
|
869
|
-
terrain_raster.tiling_grid[row, col]
|
|
870
|
-
)
|
|
871
|
-
# update saving infos for potential replacement
|
|
872
|
-
full_saving_info = ocht.update_saving_infos(
|
|
873
|
-
saving_info, row=row, col=col
|
|
874
|
-
)
|
|
875
|
-
|
|
876
|
-
# Get terrain region
|
|
877
|
-
# corresponding to point cloud tile
|
|
878
|
-
terrain_region = [
|
|
879
|
-
point_clouds.tiling_grid[pc_row, pc_col, 0],
|
|
880
|
-
point_clouds.tiling_grid[pc_row, pc_col, 2],
|
|
881
|
-
point_clouds.tiling_grid[pc_row, pc_col, 1],
|
|
882
|
-
point_clouds.tiling_grid[pc_row, pc_col, 3],
|
|
883
|
-
]
|
|
884
|
-
|
|
890
|
+
if point_cloud[row_pc, col_pc] is not None:
|
|
885
891
|
# Delayed call to rasterization operations using all
|
|
886
892
|
# required point clouds
|
|
887
893
|
terrain_raster[
|
|
888
|
-
|
|
894
|
+
0, ind_tile
|
|
889
895
|
] = self.orchestrator.cluster.create_task(
|
|
890
896
|
rasterization_wrapper
|
|
891
897
|
)(
|
|
892
|
-
|
|
898
|
+
point_cloud[row_pc, col_pc],
|
|
893
899
|
resolution,
|
|
894
900
|
epsg,
|
|
895
901
|
raster_profile,
|
|
896
|
-
window=
|
|
897
|
-
terrain_region=
|
|
902
|
+
window=None,
|
|
903
|
+
terrain_region=None,
|
|
904
|
+
terrain_full_roi=bounds,
|
|
898
905
|
list_computed_layers=list_computed_layers,
|
|
899
906
|
saving_info=full_saving_info,
|
|
900
907
|
radius=self.dsm_radius,
|
|
@@ -906,50 +913,14 @@ class SimpleGaussian(
|
|
|
906
913
|
source_pc_names=source_pc_names,
|
|
907
914
|
performance_map_classes=performance_map_classes,
|
|
908
915
|
)
|
|
909
|
-
|
|
910
|
-
# Add final function to apply
|
|
911
|
-
terrain_raster.final_function = raster_final_function
|
|
912
|
-
ind_tile = 0
|
|
913
|
-
for point_cloud in point_clouds[0]:
|
|
914
|
-
for row_pc in range(point_cloud.shape[0]):
|
|
915
|
-
for col_pc in range(point_cloud.shape[1]):
|
|
916
|
-
# update saving infos for potential replacement
|
|
917
|
-
full_saving_info = ocht.update_saving_infos(
|
|
918
|
-
saving_info, row=0, col=ind_tile
|
|
919
|
-
)
|
|
920
|
-
if point_cloud[row_pc, col_pc] is not None:
|
|
921
|
-
# Delayed call to rasterization operations using all
|
|
922
|
-
# required point clouds
|
|
923
|
-
terrain_raster[
|
|
924
|
-
0, ind_tile
|
|
925
|
-
] = self.orchestrator.cluster.create_task(
|
|
926
|
-
rasterization_wrapper
|
|
927
|
-
)(
|
|
928
|
-
point_cloud[row_pc, col_pc],
|
|
929
|
-
resolution,
|
|
930
|
-
epsg,
|
|
931
|
-
raster_profile,
|
|
932
|
-
window=None,
|
|
933
|
-
terrain_region=None,
|
|
934
|
-
terrain_full_roi=bounds,
|
|
935
|
-
list_computed_layers=list_computed_layers,
|
|
936
|
-
saving_info=full_saving_info,
|
|
937
|
-
radius=self.dsm_radius,
|
|
938
|
-
sigma=self.sigma,
|
|
939
|
-
dsm_no_data=self.dsm_no_data,
|
|
940
|
-
texture_no_data=self.texture_no_data,
|
|
941
|
-
color_dtype=color_dtype,
|
|
942
|
-
msk_no_data=self.msk_no_data,
|
|
943
|
-
source_pc_names=source_pc_names,
|
|
944
|
-
performance_map_classes=performance_map_classes,
|
|
945
|
-
)
|
|
946
|
-
ind_tile += 1
|
|
916
|
+
ind_tile += 1
|
|
947
917
|
|
|
948
918
|
# Sort tiles according to rank TODO remove or implement it ?
|
|
949
919
|
|
|
950
920
|
return terrain_raster
|
|
951
921
|
|
|
952
922
|
|
|
923
|
+
# pylint: disable=too-many-positional-arguments
|
|
953
924
|
def rasterization_wrapper( # noqa: C901
|
|
954
925
|
cloud,
|
|
955
926
|
resolution,
|
|
@@ -1019,8 +990,8 @@ def rasterization_wrapper( # noqa: C901
|
|
|
1019
990
|
# If the point cloud is not in the right epsg referential, it is converted
|
|
1020
991
|
if isinstance(cloud, xarray.Dataset):
|
|
1021
992
|
# Transform Dataset to Dataframe
|
|
1022
|
-
cloud, cloud_epsg =
|
|
1023
|
-
|
|
993
|
+
cloud, cloud_epsg = pc_transform.depth_map_dataset_to_dataframe(
|
|
994
|
+
cloud, epsg
|
|
1024
995
|
)
|
|
1025
996
|
elif cloud is None:
|
|
1026
997
|
logging.warning("Input cloud is None")
|
|
@@ -1133,6 +1104,7 @@ def rasterization_wrapper( # noqa: C901
|
|
|
1133
1104
|
list_computed_layers=list_computed_layers,
|
|
1134
1105
|
source_pc_names=source_pc_names,
|
|
1135
1106
|
performance_map_classes=performance_map_classes,
|
|
1107
|
+
cloud_global_id=attributes["cloud_id"],
|
|
1136
1108
|
)
|
|
1137
1109
|
|
|
1138
1110
|
# Fill raster
|
|
@@ -208,7 +208,7 @@ class BicubicResampling(Resampling, short_name="bicubic"):
|
|
|
208
208
|
largest_epipolar_region,
|
|
209
209
|
)
|
|
210
210
|
|
|
211
|
-
def run( # noqa: C901
|
|
211
|
+
def run( # pylint: disable=too-many-positional-arguments # noqa: C901
|
|
212
212
|
self,
|
|
213
213
|
sensor_image_left,
|
|
214
214
|
sensor_image_right,
|
|
@@ -621,9 +621,11 @@ class BicubicResampling(Resampling, short_name="bicubic"):
|
|
|
621
621
|
epipolar_images_left[row, col] = None
|
|
622
622
|
if not in_sensor_right_array[row, col]:
|
|
623
623
|
epipolar_images_right[row, col] = None
|
|
624
|
+
|
|
624
625
|
return epipolar_images_left, epipolar_images_right
|
|
625
626
|
|
|
626
627
|
|
|
628
|
+
# pylint: disable=too-many-positional-arguments
|
|
627
629
|
def generate_epipolar_images_wrapper(
|
|
628
630
|
left_overlaps,
|
|
629
631
|
right_overlaps,
|
|
@@ -41,7 +41,7 @@ from cars.core import datasets, inputs, tiling
|
|
|
41
41
|
from cars.core.geometry import abstract_geometry
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
def epipolar_rectify_images(
|
|
44
|
+
def epipolar_rectify_images( # pylint: disable=too-many-positional-arguments
|
|
45
45
|
left_imgs,
|
|
46
46
|
right_imgs,
|
|
47
47
|
grid1,
|
|
@@ -108,7 +108,9 @@ def epipolar_rectify_images(
|
|
|
108
108
|
right_margins[3] = right_region[3] - right_roi[3]
|
|
109
109
|
|
|
110
110
|
# Resample left images
|
|
111
|
-
left_img_transform = inputs.rasterio_get_transform(
|
|
111
|
+
left_img_transform = inputs.rasterio_get_transform(
|
|
112
|
+
next(iter(left_imgs)), convention="north"
|
|
113
|
+
)
|
|
112
114
|
|
|
113
115
|
left_dataset = resample_image(
|
|
114
116
|
left_imgs,
|
|
@@ -201,6 +203,7 @@ def epipolar_rectify_images(
|
|
|
201
203
|
)
|
|
202
204
|
|
|
203
205
|
|
|
206
|
+
# pylint: disable=too-many-positional-arguments
|
|
204
207
|
def resample_image( # noqa: C901
|
|
205
208
|
imgs,
|
|
206
209
|
grid,
|
|
@@ -252,7 +255,9 @@ def resample_image( # noqa: C901
|
|
|
252
255
|
]
|
|
253
256
|
|
|
254
257
|
if img_transform is None:
|
|
255
|
-
img_transform = inputs.rasterio_get_transform(
|
|
258
|
+
img_transform = inputs.rasterio_get_transform(
|
|
259
|
+
img_sample, convention="north"
|
|
260
|
+
)
|
|
256
261
|
|
|
257
262
|
# Convert largest_size to int if needed
|
|
258
263
|
largest_size = [int(x) for x in largest_size]
|
|
@@ -284,14 +289,10 @@ def resample_image( # noqa: C901
|
|
|
284
289
|
(nb_bands, region[3] - region[1], region[2] - region[0]),
|
|
285
290
|
dtype=np.float32,
|
|
286
291
|
)
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
dtype=np.float32,
|
|
292
|
-
)
|
|
293
|
-
else:
|
|
294
|
-
msk = None
|
|
292
|
+
msk = np.empty(
|
|
293
|
+
(nb_bands, region[3] - region[1], region[2] - region[0]),
|
|
294
|
+
dtype=np.float32,
|
|
295
|
+
)
|
|
295
296
|
|
|
296
297
|
ystart = 0
|
|
297
298
|
with rio.open(grid["path"]) as grid_reader, rio.open(img) as img_reader:
|
|
@@ -348,7 +349,7 @@ def resample_image( # noqa: C901
|
|
|
348
349
|
return dataset
|
|
349
350
|
|
|
350
351
|
|
|
351
|
-
def oversampling_func(
|
|
352
|
+
def oversampling_func( # pylint: disable=too-many-positional-arguments
|
|
352
353
|
grid_reader,
|
|
353
354
|
img_reader,
|
|
354
355
|
img_transform,
|
|
@@ -457,7 +458,10 @@ def oversampling_func(
|
|
|
457
458
|
if in_sensor:
|
|
458
459
|
# Get sensor data
|
|
459
460
|
img_as_array = img_reader.read(bands["band_id"], window=img_window)
|
|
461
|
+
# get the nodata mask before blurring
|
|
462
|
+
img_nan_mask = img_as_array == nodata
|
|
460
463
|
|
|
464
|
+
# blur the image to avoid moiré artefacts if downsampling
|
|
461
465
|
if resolution != 1:
|
|
462
466
|
fourier = fftshift(fft2(img_as_array))
|
|
463
467
|
|
|
@@ -472,6 +476,10 @@ def oversampling_func(
|
|
|
472
476
|
|
|
473
477
|
img_as_array = np.real(ifft2(ifftshift(f_filtered)))
|
|
474
478
|
|
|
479
|
+
# set the nodata values back
|
|
480
|
+
if nodata is not None:
|
|
481
|
+
img_as_array[img_nan_mask] = nodata
|
|
482
|
+
|
|
475
483
|
# shift grid regarding the img extraction
|
|
476
484
|
grid_as_array[0, ...] -= x_offset
|
|
477
485
|
grid_as_array[1, ...] -= y_offset
|
|
@@ -513,51 +521,50 @@ def oversampling_func(
|
|
|
513
521
|
resamp[:, ystart : ystart + ysize, xstart : xstart + xsize] = block_resamp
|
|
514
522
|
|
|
515
523
|
# create msk
|
|
516
|
-
if
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
msk_as_array = np.array([msk_as_array] * img_as_array.shape[0])
|
|
525
|
-
else:
|
|
526
|
-
msk_as_array = np.zeros(img_as_array.shape)
|
|
524
|
+
if in_sensor:
|
|
525
|
+
# get mask in source geometry
|
|
526
|
+
if mask is not None:
|
|
527
|
+
with rio.open(mask) as msk_reader:
|
|
528
|
+
msk_as_array = msk_reader.read(1, window=img_window)
|
|
529
|
+
msk_as_array = np.array([msk_as_array] * img_as_array.shape[0])
|
|
530
|
+
else:
|
|
531
|
+
msk_as_array = np.zeros(img_as_array.shape)
|
|
527
532
|
|
|
533
|
+
if nodata is not None:
|
|
534
|
+
nodata_index = img_as_array == nodata
|
|
528
535
|
msk_as_array[nodata_index] = nodata_msk
|
|
529
536
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
537
|
+
# resample mask
|
|
538
|
+
block_msk = cresample.grid(
|
|
539
|
+
msk_as_array,
|
|
540
|
+
grid_as_array,
|
|
541
|
+
oversampling,
|
|
542
|
+
interpolator=interpolator_mask,
|
|
543
|
+
nodata=nodata_msk,
|
|
544
|
+
)
|
|
538
545
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
546
|
+
if interpolator_mask == "bicubic":
|
|
547
|
+
block_msk = np.where(
|
|
548
|
+
block_msk >= 0.5,
|
|
549
|
+
1,
|
|
550
|
+
np.where(block_msk < 0.5, 0, block_msk),
|
|
551
|
+
).astype(int)
|
|
552
|
+
|
|
553
|
+
block_msk = block_msk[
|
|
554
|
+
...,
|
|
555
|
+
ext_region[1] : ext_region[3] - 1,
|
|
556
|
+
ext_region[0] : ext_region[2] - 1,
|
|
557
|
+
]
|
|
558
|
+
else:
|
|
559
|
+
block_msk = np.full(
|
|
560
|
+
(
|
|
561
|
+
nb_bands,
|
|
562
|
+
block_region[3] - block_region[1],
|
|
563
|
+
block_region[2] - block_region[0],
|
|
564
|
+
),
|
|
565
|
+
fill_value=nodata_msk,
|
|
566
|
+
)
|
|
560
567
|
|
|
561
|
-
|
|
568
|
+
msk[:, ystart : ystart + ysize, xstart : xstart + xsize] = block_msk
|
|
562
569
|
|
|
563
570
|
return resamp, msk
|
|
@@ -34,9 +34,11 @@ import numpy as np
|
|
|
34
34
|
# CARS imports
|
|
35
35
|
from cars.core import constants as cst
|
|
36
36
|
from cars.core import inputs
|
|
37
|
+
from cars.orchestrator.cluster.log_wrapper import cars_profile
|
|
37
38
|
from cars.pipelines.parameters import sensor_inputs_constants as sens_cst
|
|
38
39
|
|
|
39
40
|
|
|
41
|
+
@cars_profile(name="Get paths and bands", interval=0.5)
|
|
40
42
|
def get_paths_and_bands(sensor_image, required_bands=None):
|
|
41
43
|
"""
|
|
42
44
|
Reformat file paths and bands required from each file to ease reading
|
|
@@ -92,7 +94,7 @@ def get_sensors_bounds(sensor_image_left, sensor_image_right):
|
|
|
92
94
|
return left_sensor_bounds, right_sensor_bounds
|
|
93
95
|
|
|
94
96
|
|
|
95
|
-
def check_tiles_in_sensor(
|
|
97
|
+
def check_tiles_in_sensor( # pylint: disable=too-many-positional-arguments
|
|
96
98
|
sensor_image_left,
|
|
97
99
|
sensor_image_right,
|
|
98
100
|
image_tiling,
|