cars 1.0.0a3__cp311-cp311-win_amd64.whl → 1.0.0a4__cp311-cp311-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_template.py +20 -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 +80 -36
- cars/applications/dem_generation/dem_generation_algo.py +1 -1
- cars/applications/dem_generation/dem_generation_wrappers.py +23 -57
- cars/applications/dem_generation/dichotomic_generation_app.py +3 -3
- cars/applications/dem_generation/rasterization_app.py +100 -41
- 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 +38 -39
- cars/applications/dense_matching/cpp/dense_matching_cpp.cp311-win_amd64.dll.a +0 -0
- cars/applications/dense_matching/cpp/dense_matching_cpp.cp311-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 +84 -62
- cars/applications/dense_matching/loaders/pandora_loader.py +91 -33
- cars/applications/dsm_filling/border_interpolation_app.py +1 -7
- cars/applications/dsm_filling/bulldozer_filling_app.py +2 -8
- cars/applications/dsm_filling/exogenous_filling_app.py +4 -9
- 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 +2 -1
- cars/applications/point_cloud_outlier_removal/outlier_removal_algo.py +9 -8
- cars/applications/point_cloud_outlier_removal/small_components_app.py +96 -267
- cars/applications/point_cloud_outlier_removal/statistical_app.py +116 -275
- cars/applications/rasterization/abstract_pc_rasterization_app.py +1 -1
- cars/applications/rasterization/rasterization_algo.py +18 -6
- cars/applications/rasterization/rasterization_wrappers.py +2 -1
- cars/applications/rasterization/simple_gaussian_app.py +60 -113
- cars/applications/resampling/abstract_resampling_app.py +1 -1
- cars/applications/resampling/bicubic_resampling_app.py +3 -1
- cars/applications/resampling/resampling_algo.py +16 -4
- 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 +3 -3
- 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 +256 -25
- cars/core/geometry/shareloc_geometry.py +110 -82
- cars/core/inputs.py +57 -19
- cars/core/outputs.py +1 -1
- cars/core/preprocessing.py +17 -3
- cars/core/projection.py +9 -6
- cars/core/tiling.py +10 -3
- cars/data_structures/cars_dataset.py +5 -5
- 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 +148 -21
- cars/orchestrator/cluster/mp_cluster/multiprocessing_cluster.py +11 -3
- 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 +14 -3
- 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 +462 -1073
- cars/pipelines/parameters/advanced_parameters.py +74 -64
- cars/pipelines/parameters/advanced_parameters_constants.py +2 -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 +2 -2
- cars/pipelines/parameters/sensor_inputs.py +30 -75
- 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 +527 -1016
- cars/starter.py +4 -3
- cars-1.0.0a4.dist-info/DELVEWHEEL +2 -0
- {cars-1.0.0a3.dist-info → cars-1.0.0a4.dist-info}/METADATA +135 -53
- {cars-1.0.0a3.dist-info → cars-1.0.0a4.dist-info}/RECORD +115 -131
- 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.cp311-win_amd64.dll.a +0 -0
- cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp311-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.0a3.dist-info/DELVEWHEEL +0 -2
- cars.libs/libgcc_s_seh-1-ca70890bbc5723b6d0ea31e9c9cded2b.dll +0 -0
- cars.libs/libstdc++-6-00ee19f73d5122a1277c137b1c218401.dll +0 -0
- cars.libs/libwinpthread-1-f5042e8e3d21edce20c1bc99445f551b.dll +0 -0
- {cars-1.0.0a3.dist-info → cars-1.0.0a4.dist-info}/WHEEL +0 -0
- {cars-1.0.0a3.dist-info → cars-1.0.0a4.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# !/usr/bin/env python
|
|
2
|
+
# coding: utf8
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2024 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
|
+
This module contains the ClassifSensorLoader class.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from json_checker import Checker
|
|
26
|
+
|
|
27
|
+
from cars.core import inputs
|
|
28
|
+
from cars.core.utils import make_relative_path_absolute
|
|
29
|
+
from cars.pipelines.parameters.sensor_loaders.pivot_classif_loader import (
|
|
30
|
+
PivotClassifSensorLoader,
|
|
31
|
+
)
|
|
32
|
+
from cars.pipelines.parameters.sensor_loaders.sensor_loader import SensorLoader
|
|
33
|
+
from cars.pipelines.parameters.sensor_loaders.sensor_loader_template import (
|
|
34
|
+
SensorLoaderTemplate,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@SensorLoader.register("basic_classif")
|
|
39
|
+
class BasicClassifSensorLoader(SensorLoaderTemplate):
|
|
40
|
+
"""
|
|
41
|
+
Default sensor loader (used when no sensor loader is specified)
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
def check_conf(self, conf):
|
|
45
|
+
"""
|
|
46
|
+
Check configuration
|
|
47
|
+
|
|
48
|
+
:param conf: configuration to check
|
|
49
|
+
|
|
50
|
+
:return: overloaded configuration
|
|
51
|
+
:rtype: dict
|
|
52
|
+
"""
|
|
53
|
+
default_filling = {
|
|
54
|
+
"fill_with_geoid": "b0",
|
|
55
|
+
"interpolate_from_borders": "b1",
|
|
56
|
+
"fill_with_endogenous_dem": "b2",
|
|
57
|
+
"fill_with_exogenous_dem": "b3",
|
|
58
|
+
}
|
|
59
|
+
if isinstance(conf, str):
|
|
60
|
+
overloaded_conf = {}
|
|
61
|
+
image_path = make_relative_path_absolute(conf, self.config_dir)
|
|
62
|
+
overloaded_conf["path"] = image_path
|
|
63
|
+
overloaded_conf["loader"] = "basic_classif"
|
|
64
|
+
overloaded_conf["filling"] = default_filling
|
|
65
|
+
elif isinstance(conf, dict):
|
|
66
|
+
overloaded_conf = conf.copy()
|
|
67
|
+
image_path = make_relative_path_absolute(
|
|
68
|
+
conf["path"], self.config_dir
|
|
69
|
+
)
|
|
70
|
+
overloaded_conf["path"] = image_path
|
|
71
|
+
overloaded_conf["loader"] = conf.get("loader", "basic")
|
|
72
|
+
overloaded_conf["filling"] = conf.get("filling", default_filling)
|
|
73
|
+
else:
|
|
74
|
+
raise TypeError(f"Input {conf} is not a string ot dict")
|
|
75
|
+
|
|
76
|
+
sensor_schema = {"loader": str, "path": str, "filling": dict}
|
|
77
|
+
|
|
78
|
+
# Check conf
|
|
79
|
+
checker = Checker(sensor_schema)
|
|
80
|
+
checker.validate(overloaded_conf)
|
|
81
|
+
|
|
82
|
+
return overloaded_conf
|
|
83
|
+
|
|
84
|
+
def set_pivot_format(self):
|
|
85
|
+
"""
|
|
86
|
+
Transform input configuration to pivot format and store it
|
|
87
|
+
"""
|
|
88
|
+
pivot_config = {
|
|
89
|
+
"loader": "pivot_classif",
|
|
90
|
+
"main_file": self.used_config["path"],
|
|
91
|
+
"filling": self.used_config["filling"],
|
|
92
|
+
}
|
|
93
|
+
pivot_config["bands"] = {}
|
|
94
|
+
for band_id in range(
|
|
95
|
+
inputs.rasterio_get_nb_bands(self.used_config["path"])
|
|
96
|
+
):
|
|
97
|
+
band_name = "b" + str(band_id)
|
|
98
|
+
pivot_config["bands"][band_name] = {
|
|
99
|
+
"path": self.used_config["path"],
|
|
100
|
+
"band": band_id,
|
|
101
|
+
}
|
|
102
|
+
pivot_config["texture_bands"] = None
|
|
103
|
+
pivot_sensor_loader = PivotClassifSensorLoader(
|
|
104
|
+
pivot_config, self.config_dir
|
|
105
|
+
)
|
|
106
|
+
self.pivot_format = pivot_sensor_loader.get_pivot_format()
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
# limitations under the License.
|
|
20
20
|
#
|
|
21
21
|
"""
|
|
22
|
-
|
|
22
|
+
This module contains the BasicImageSensorLoader class.
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
from json_checker import Checker, Or
|
|
@@ -27,8 +27,8 @@ from json_checker import Checker, Or
|
|
|
27
27
|
from cars.core import inputs
|
|
28
28
|
from cars.core.utils import make_relative_path_absolute
|
|
29
29
|
from cars.pipelines.parameters import sensor_inputs_constants as sens_cst
|
|
30
|
-
from cars.pipelines.parameters.sensor_loaders.
|
|
31
|
-
|
|
30
|
+
from cars.pipelines.parameters.sensor_loaders.pivot_image_loader import (
|
|
31
|
+
PivotImageSensorLoader,
|
|
32
32
|
)
|
|
33
33
|
from cars.pipelines.parameters.sensor_loaders.sensor_loader import SensorLoader
|
|
34
34
|
from cars.pipelines.parameters.sensor_loaders.sensor_loader_template import (
|
|
@@ -36,10 +36,10 @@ from cars.pipelines.parameters.sensor_loaders.sensor_loader_template import (
|
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
@SensorLoader.register("
|
|
40
|
-
class
|
|
39
|
+
@SensorLoader.register("basic_image")
|
|
40
|
+
class BasicImageSensorLoader(SensorLoaderTemplate):
|
|
41
41
|
"""
|
|
42
|
-
Default sensor loader (used when no sensor loader is specified)
|
|
42
|
+
Default sensor loader for image (used when no sensor loader is specified)
|
|
43
43
|
"""
|
|
44
44
|
|
|
45
45
|
def check_conf(self, conf):
|
|
@@ -55,26 +55,20 @@ class BasicSensorLoader(SensorLoaderTemplate):
|
|
|
55
55
|
overloaded_conf = {}
|
|
56
56
|
image_path = make_relative_path_absolute(conf, self.config_dir)
|
|
57
57
|
overloaded_conf["path"] = image_path
|
|
58
|
-
overloaded_conf["loader"] = "
|
|
59
|
-
|
|
60
|
-
overloaded_conf[sens_cst.INPUT_NODATA] = 0
|
|
61
|
-
else:
|
|
62
|
-
overloaded_conf[sens_cst.INPUT_NODATA] = None
|
|
58
|
+
overloaded_conf["loader"] = "basic_image"
|
|
59
|
+
overloaded_conf[sens_cst.INPUT_NODATA] = 0
|
|
63
60
|
elif isinstance(conf, dict):
|
|
64
61
|
overloaded_conf = conf.copy()
|
|
65
62
|
image_path = make_relative_path_absolute(
|
|
66
63
|
conf["path"], self.config_dir
|
|
67
64
|
)
|
|
68
65
|
overloaded_conf["path"] = image_path
|
|
69
|
-
overloaded_conf["loader"] = conf.get("loader", "
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
)
|
|
74
|
-
else:
|
|
75
|
-
overloaded_conf[sens_cst.INPUT_NODATA] = None
|
|
66
|
+
overloaded_conf["loader"] = conf.get("loader", "basic_image")
|
|
67
|
+
overloaded_conf[sens_cst.INPUT_NODATA] = conf.get(
|
|
68
|
+
sens_cst.INPUT_NODATA, 0
|
|
69
|
+
)
|
|
76
70
|
else:
|
|
77
|
-
raise TypeError(f"Input {
|
|
71
|
+
raise TypeError(f"Input {conf} is not a string ot dict")
|
|
78
72
|
|
|
79
73
|
sensor_schema = {"loader": str, "path": str, "no_data": Or(None, int)}
|
|
80
74
|
|
|
@@ -89,7 +83,7 @@ class BasicSensorLoader(SensorLoaderTemplate):
|
|
|
89
83
|
Transform input configuration to pivot format and store it
|
|
90
84
|
"""
|
|
91
85
|
pivot_config = {
|
|
92
|
-
"loader": "
|
|
86
|
+
"loader": "pivot_image",
|
|
93
87
|
"main_file": self.used_config["path"],
|
|
94
88
|
}
|
|
95
89
|
pivot_config["bands"] = {}
|
|
@@ -102,7 +96,7 @@ class BasicSensorLoader(SensorLoaderTemplate):
|
|
|
102
96
|
"band": band_id,
|
|
103
97
|
}
|
|
104
98
|
pivot_config["texture_bands"] = None
|
|
105
|
-
pivot_sensor_loader =
|
|
106
|
-
pivot_config, self.
|
|
99
|
+
pivot_sensor_loader = PivotImageSensorLoader(
|
|
100
|
+
pivot_config, self.config_dir
|
|
107
101
|
)
|
|
108
102
|
self.pivot_format = pivot_sensor_loader.get_pivot_format()
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# !/usr/bin/env python
|
|
2
|
+
# coding: utf8
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2024 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
|
+
this module contains the PivotImageSensorLoader class.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from json_checker import Checker, Or
|
|
26
|
+
|
|
27
|
+
from cars.core import inputs
|
|
28
|
+
from cars.core.utils import make_relative_path_absolute
|
|
29
|
+
from cars.pipelines.parameters.sensor_loaders.sensor_loader import SensorLoader
|
|
30
|
+
from cars.pipelines.parameters.sensor_loaders.sensor_loader_template import (
|
|
31
|
+
SensorLoaderTemplate,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@SensorLoader.register("pivot_classif")
|
|
36
|
+
class PivotClassifSensorLoader(SensorLoaderTemplate):
|
|
37
|
+
"""
|
|
38
|
+
Pivot image sensor loader : used by CARS to read inputs
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def check_conf(self, conf):
|
|
42
|
+
"""
|
|
43
|
+
Check configuration
|
|
44
|
+
|
|
45
|
+
:param conf: configuration to check
|
|
46
|
+
|
|
47
|
+
:return: overloaded configuration
|
|
48
|
+
:rtype: dict
|
|
49
|
+
"""
|
|
50
|
+
default_filling = {
|
|
51
|
+
"fill_with_geoid": "b0",
|
|
52
|
+
"interpolate_from_borders": "b1",
|
|
53
|
+
"fill_with_endogenous_dem": "b2",
|
|
54
|
+
"fill_with_exogenous_dem": "b3",
|
|
55
|
+
}
|
|
56
|
+
overloaded_conf = conf.copy()
|
|
57
|
+
# Make relative paths absolutes
|
|
58
|
+
for band in overloaded_conf["bands"]:
|
|
59
|
+
overloaded_conf["bands"][band]["path"] = (
|
|
60
|
+
make_relative_path_absolute(
|
|
61
|
+
overloaded_conf["bands"][band]["path"], self.config_dir
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
# Check consistency between files
|
|
65
|
+
b0_path = overloaded_conf["bands"]["b0"]["path"]
|
|
66
|
+
b0_size = inputs.rasterio_get_size(b0_path)
|
|
67
|
+
b0_transform = inputs.rasterio_get_transform(b0_path)
|
|
68
|
+
for band in overloaded_conf["bands"]:
|
|
69
|
+
band_path = overloaded_conf["bands"][band]["path"]
|
|
70
|
+
band_id = overloaded_conf["bands"][band]["band"]
|
|
71
|
+
nb_bands = inputs.rasterio_get_nb_bands(band_path)
|
|
72
|
+
if band_id >= nb_bands:
|
|
73
|
+
raise RuntimeError(
|
|
74
|
+
"Band id {} is not valid for sensor which "
|
|
75
|
+
"has only {} bands".format(band_id, nb_bands)
|
|
76
|
+
)
|
|
77
|
+
if band_path != b0_path:
|
|
78
|
+
band_size = inputs.rasterio_get_size(band_path)
|
|
79
|
+
band_transform = inputs.rasterio_get_transform(band_path)
|
|
80
|
+
if b0_size != band_size:
|
|
81
|
+
raise RuntimeError(
|
|
82
|
+
"The files {} and {} do not have the same size"
|
|
83
|
+
"but are in the same image".format(b0_path, band_path)
|
|
84
|
+
)
|
|
85
|
+
if b0_transform != band_transform:
|
|
86
|
+
raise RuntimeError(
|
|
87
|
+
"The files {} and {} do not have the same size"
|
|
88
|
+
"but are in the same image".format(
|
|
89
|
+
b0_transform,
|
|
90
|
+
band_transform,
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
overloaded_conf["main_file"] = overloaded_conf["bands"]["b0"]["path"]
|
|
94
|
+
overloaded_conf["filling"] = conf.get("filling", default_filling)
|
|
95
|
+
overloaded_conf["texture_bands"] = conf.get("texture_bands", None)
|
|
96
|
+
if overloaded_conf["texture_bands"] is not None:
|
|
97
|
+
for texture_band in overloaded_conf["texture_bands"]:
|
|
98
|
+
if texture_band not in overloaded_conf["bands"]:
|
|
99
|
+
raise RuntimeError(
|
|
100
|
+
"Texture band {} not found in bands {} "
|
|
101
|
+
"of sensor image".format(
|
|
102
|
+
texture_band, overloaded_conf["bands"]
|
|
103
|
+
)
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
sensor_schema = {
|
|
107
|
+
"loader": str,
|
|
108
|
+
"main_file": str,
|
|
109
|
+
"bands": dict,
|
|
110
|
+
"filling": dict,
|
|
111
|
+
"texture_bands": Or(None, [str]),
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# Check conf
|
|
115
|
+
checker = Checker(sensor_schema)
|
|
116
|
+
checker.validate(overloaded_conf)
|
|
117
|
+
|
|
118
|
+
return overloaded_conf
|
|
119
|
+
|
|
120
|
+
def set_pivot_format(self):
|
|
121
|
+
self.pivot_format = self.used_config
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
# limitations under the License.
|
|
20
20
|
#
|
|
21
21
|
"""
|
|
22
|
-
this module contains the
|
|
22
|
+
this module contains the PivotImageSensorLoader class.
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
from json_checker import Checker, Or
|
|
@@ -33,10 +33,10 @@ from cars.pipelines.parameters.sensor_loaders.sensor_loader_template import (
|
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
@SensorLoader.register("
|
|
37
|
-
class
|
|
36
|
+
@SensorLoader.register("pivot_image")
|
|
37
|
+
class PivotImageSensorLoader(SensorLoaderTemplate):
|
|
38
38
|
"""
|
|
39
|
-
Pivot sensor loader : used by CARS to read inputs
|
|
39
|
+
Pivot image sensor loader : used by CARS to read inputs
|
|
40
40
|
"""
|
|
41
41
|
|
|
42
42
|
def check_conf(self, conf):
|
|
@@ -59,7 +59,7 @@ class PivotSensorLoader(SensorLoaderTemplate):
|
|
|
59
59
|
# Check consistency between files
|
|
60
60
|
b0_path = overloaded_conf["bands"]["b0"]["path"]
|
|
61
61
|
b0_size = inputs.rasterio_get_size(b0_path)
|
|
62
|
-
b0_transform = inputs.
|
|
62
|
+
b0_transform = inputs.rasterio_get_transform(b0_path)
|
|
63
63
|
for band in overloaded_conf["bands"]:
|
|
64
64
|
band_path = overloaded_conf["bands"][band]["path"]
|
|
65
65
|
band_id = overloaded_conf["bands"][band]["band"]
|
|
@@ -71,7 +71,7 @@ class PivotSensorLoader(SensorLoaderTemplate):
|
|
|
71
71
|
)
|
|
72
72
|
if band_path != b0_path:
|
|
73
73
|
band_size = inputs.rasterio_get_size(band_path)
|
|
74
|
-
band_transform = inputs.
|
|
74
|
+
band_transform = inputs.rasterio_get_transform(band_path)
|
|
75
75
|
if b0_size != band_size:
|
|
76
76
|
raise RuntimeError(
|
|
77
77
|
"The files {} and {} do not have the same size"
|
|
@@ -85,15 +85,7 @@ class PivotSensorLoader(SensorLoaderTemplate):
|
|
|
85
85
|
band_transform,
|
|
86
86
|
)
|
|
87
87
|
)
|
|
88
|
-
overloaded_conf["main_file"] =
|
|
89
|
-
if overloaded_conf["main_file"] is None:
|
|
90
|
-
overloaded_conf["main_file"] = overloaded_conf["bands"]["b0"][
|
|
91
|
-
"path"
|
|
92
|
-
]
|
|
93
|
-
else:
|
|
94
|
-
overloaded_conf["main_file"] = make_relative_path_absolute(
|
|
95
|
-
overloaded_conf["main_file"], self.config_dir
|
|
96
|
-
)
|
|
88
|
+
overloaded_conf["main_file"] = overloaded_conf["bands"]["b0"]["path"]
|
|
97
89
|
overloaded_conf["texture_bands"] = conf.get("texture_bands", None)
|
|
98
90
|
if overloaded_conf["texture_bands"] is not None:
|
|
99
91
|
for texture_band in overloaded_conf["texture_bands"]:
|
|
@@ -105,12 +97,9 @@ class PivotSensorLoader(SensorLoaderTemplate):
|
|
|
105
97
|
)
|
|
106
98
|
)
|
|
107
99
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
)
|
|
112
|
-
else:
|
|
113
|
-
overloaded_conf[sens_cst.INPUT_NODATA] = None
|
|
100
|
+
overloaded_conf[sens_cst.INPUT_NODATA] = conf.get(
|
|
101
|
+
sens_cst.INPUT_NODATA, 0
|
|
102
|
+
)
|
|
114
103
|
|
|
115
104
|
sensor_schema = {
|
|
116
105
|
"loader": str,
|
|
@@ -38,9 +38,7 @@ class SensorLoader:
|
|
|
38
38
|
# sensor loaders
|
|
39
39
|
available_loaders = {}
|
|
40
40
|
|
|
41
|
-
def __new__(
|
|
42
|
-
cls, app_name: str, cfg: dict, input_type: str, config_dir: str
|
|
43
|
-
):
|
|
41
|
+
def __new__(cls, app_name: str, cfg: dict, config_dir: str):
|
|
44
42
|
"""
|
|
45
43
|
Return the instance of sensor loader associated with the sensor loader
|
|
46
44
|
name given as parameter
|
|
@@ -51,10 +49,10 @@ class SensorLoader:
|
|
|
51
49
|
:type cfg: dictionary
|
|
52
50
|
"""
|
|
53
51
|
|
|
54
|
-
return cls.create_app(app_name, cfg,
|
|
52
|
+
return cls.create_app(app_name, cfg, config_dir)
|
|
55
53
|
|
|
56
54
|
@classmethod
|
|
57
|
-
def create_app(cls, name: str, cfg: dict,
|
|
55
|
+
def create_app(cls, name: str, cfg: dict, config_dir: str):
|
|
58
56
|
"""
|
|
59
57
|
Factory command to create the sensor loader
|
|
60
58
|
Return the instance of sensor loader associated with the sensor loader
|
|
@@ -72,7 +70,7 @@ class SensorLoader:
|
|
|
72
70
|
except KeyError:
|
|
73
71
|
logging.error("No sensor loader named {0} supported".format(name))
|
|
74
72
|
return None
|
|
75
|
-
loader = loader_class(cfg,
|
|
73
|
+
loader = loader_class(cfg, config_dir)
|
|
76
74
|
return loader
|
|
77
75
|
|
|
78
76
|
@classmethod
|
|
@@ -30,14 +30,12 @@ class SensorLoaderTemplate:
|
|
|
30
30
|
Class for general specification of a sensor loader
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
|
-
def __init__(self, conf,
|
|
33
|
+
def __init__(self, conf, config_dir):
|
|
34
34
|
"""
|
|
35
35
|
Init function of SensorLoaderTemplate
|
|
36
36
|
|
|
37
37
|
:param conf: configuration for sensor loader
|
|
38
|
-
:param input_type: type of input : image or classification
|
|
39
38
|
"""
|
|
40
|
-
self.input_type = input_type
|
|
41
39
|
self.config_dir = config_dir
|
|
42
40
|
self.used_config = self.check_conf(conf)
|
|
43
41
|
|
|
@@ -91,14 +91,12 @@ class PipelineTemplate(metaclass=ABCMeta): # pylint: disable=R0903
|
|
|
91
91
|
"""
|
|
92
92
|
|
|
93
93
|
@abstractmethod
|
|
94
|
-
def check_output(self, conf
|
|
94
|
+
def check_output(self, conf):
|
|
95
95
|
"""
|
|
96
96
|
Check the output given
|
|
97
97
|
|
|
98
98
|
:param conf: configuration of output
|
|
99
99
|
:type conf: dict
|
|
100
|
-
:param pipeline: name of corresponding pipeline
|
|
101
|
-
:type pipeline_name: str
|
|
102
100
|
|
|
103
101
|
:return overloader output
|
|
104
102
|
:rtype : dict
|