cars 1.0.0a1__cp312-cp312-win_amd64.whl → 1.0.0a2__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 +4 -4
- cars/applications/dem_generation/dem_generation_wrappers.py +5 -1
- cars/applications/dem_generation/dichotomic_generation_app.py +21 -6
- cars/applications/dem_generation/rasterization_app.py +70 -27
- cars/applications/dense_match_filling/abstract_dense_match_filling_app.py +4 -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/fill_disp_algo.py +41 -12
- cars/applications/dense_match_filling/plane_app.py +11 -0
- cars/applications/dense_match_filling/zero_padding_app.py +11 -1
- cars/applications/dense_matching/census_mccnn_sgm_app.py +262 -545
- 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 +59 -11
- cars/applications/dense_matching/dense_matching_wrappers.py +51 -31
- cars/applications/dense_matching/disparity_grid_algo.py +572 -0
- cars/applications/grid_generation/grid_correction_app.py +0 -53
- cars/applications/grid_generation/transform_grid.py +5 -5
- cars/applications/point_cloud_fusion/pc_fusion_algo.py +17 -11
- cars/applications/point_cloud_fusion/pc_fusion_wrappers.py +3 -4
- cars/applications/rasterization/rasterization_algo.py +20 -27
- cars/applications/rasterization/rasterization_wrappers.py +6 -5
- cars/applications/rasterization/simple_gaussian_app.py +2 -14
- cars/applications/sparse_matching/sparse_matching_wrappers.py +0 -49
- cars/applications/triangulation/line_of_sight_intersection_app.py +1 -1
- cars/applications/triangulation/triangulation_wrappers.py +2 -1
- cars/bundleadjustment.py +51 -11
- cars/cars.py +15 -5
- cars/core/constants.py +1 -1
- cars/core/geometry/abstract_geometry.py +54 -11
- cars/core/geometry/shareloc_geometry.py +59 -14
- cars/orchestrator/registry/saver_registry.py +0 -78
- cars/pipelines/default/default_pipeline.py +23 -26
- cars/pipelines/parameters/depth_map_inputs.py +22 -67
- cars/pipelines/parameters/dsm_inputs.py +16 -29
- cars/pipelines/parameters/sensor_inputs.py +20 -21
- cars/pipelines/parameters/sensor_loaders/basic_sensor_loader.py +3 -3
- cars/pipelines/parameters/sensor_loaders/pivot_sensor_loader.py +2 -2
- cars/pipelines/parameters/sensor_loaders/sensor_loader.py +4 -6
- cars/pipelines/parameters/sensor_loaders/sensor_loader_template.py +2 -2
- cars/pipelines/pipeline.py +8 -8
- cars/pipelines/unit/unit_pipeline.py +103 -196
- cars/starter.py +20 -1
- cars-1.0.0a2.dist-info/DELVEWHEEL +2 -0
- {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/METADATA +3 -2
- {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/RECORD +48 -47
- cars-1.0.0a1.dist-info/DELVEWHEEL +0 -2
- {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/WHEEL +0 -0
- {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/entry_points.txt +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -40,15 +40,20 @@ from scipy.interpolate import (
|
|
|
40
40
|
RegularGridInterpolator,
|
|
41
41
|
)
|
|
42
42
|
|
|
43
|
-
# CARS imports
|
|
44
|
-
from cars.applications.dense_matching import (
|
|
45
|
-
dense_matching_constants as dense_match_cst,
|
|
46
|
-
)
|
|
47
43
|
from cars.applications.dense_matching import dense_matching_wrappers as dm_wrap
|
|
44
|
+
|
|
45
|
+
# CARS imports
|
|
48
46
|
from cars.core import constants as cst
|
|
47
|
+
from cars.core import inputs
|
|
49
48
|
|
|
50
49
|
|
|
51
|
-
def compute_disparity_grid(
|
|
50
|
+
def compute_disparity_grid(
|
|
51
|
+
disp_range_grid,
|
|
52
|
+
left_image_object,
|
|
53
|
+
right_image_object,
|
|
54
|
+
used_band,
|
|
55
|
+
threshold_disp_range_to_borders,
|
|
56
|
+
):
|
|
52
57
|
"""
|
|
53
58
|
Compute dense disparity grids min and max for pandora
|
|
54
59
|
superposable to left image
|
|
@@ -61,20 +66,30 @@ def compute_disparity_grid(disp_range_grid, left_image_object):
|
|
|
61
66
|
:return disp min map, disp_max_map
|
|
62
67
|
:rtype np.ndarray, np.ndarray
|
|
63
68
|
"""
|
|
69
|
+
|
|
70
|
+
disp_min_grid_arr, _ = inputs.rasterio_read_as_array(
|
|
71
|
+
disp_range_grid["grid_min_path"]
|
|
72
|
+
)
|
|
73
|
+
disp_max_grid_arr, _ = inputs.rasterio_read_as_array(
|
|
74
|
+
disp_range_grid["grid_max_path"]
|
|
75
|
+
)
|
|
76
|
+
row_range = disp_range_grid["row_range"]
|
|
77
|
+
col_range = disp_range_grid["col_range"]
|
|
78
|
+
|
|
64
79
|
# Create interpolators
|
|
65
80
|
interp_min = RegularGridInterpolator(
|
|
66
81
|
(
|
|
67
|
-
|
|
68
|
-
|
|
82
|
+
row_range,
|
|
83
|
+
col_range,
|
|
69
84
|
),
|
|
70
|
-
|
|
85
|
+
disp_min_grid_arr,
|
|
71
86
|
)
|
|
72
87
|
interp_max = RegularGridInterpolator(
|
|
73
88
|
(
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
row_range,
|
|
90
|
+
col_range,
|
|
76
91
|
),
|
|
77
|
-
|
|
92
|
+
disp_max_grid_arr,
|
|
78
93
|
)
|
|
79
94
|
|
|
80
95
|
# Interpolate disp on grid
|
|
@@ -88,6 +103,39 @@ def compute_disparity_grid(disp_range_grid, left_image_object):
|
|
|
88
103
|
disp_min_grid = interp_min((row_grid, col_grid)).astype("float32")
|
|
89
104
|
disp_max_grid = interp_max((row_grid, col_grid)).astype("float32")
|
|
90
105
|
|
|
106
|
+
# Compute extremums of disparity considering left image borders
|
|
107
|
+
if threshold_disp_range_to_borders:
|
|
108
|
+
disp_min_from_borders = np.zeros_like(disp_min_grid)
|
|
109
|
+
disp_max_from_borders = np.zeros_like(disp_max_grid)
|
|
110
|
+
right_msk = (
|
|
111
|
+
np.array(right_image_object[cst.EPI_MSK].loc[used_band]) == 0
|
|
112
|
+
)
|
|
113
|
+
index_of_first_valid_pixel = np.argmax(right_msk, axis=1)
|
|
114
|
+
index_of_last_valid_pixel = np.argmax(
|
|
115
|
+
np.flip(right_msk, axis=1), axis=1
|
|
116
|
+
)
|
|
117
|
+
index_of_last_valid_pixel = (
|
|
118
|
+
right_msk.shape[1] - index_of_last_valid_pixel
|
|
119
|
+
)
|
|
120
|
+
any_valid_pixel_exists = np.any(right_msk, axis=1)
|
|
121
|
+
right_msk_indices = zip( # noqa: B905
|
|
122
|
+
index_of_first_valid_pixel,
|
|
123
|
+
index_of_last_valid_pixel,
|
|
124
|
+
any_valid_pixel_exists,
|
|
125
|
+
)
|
|
126
|
+
for row_id, (first, last, exists) in enumerate(right_msk_indices):
|
|
127
|
+
if exists:
|
|
128
|
+
disp_min_from_borders[row_id, first:last] = np.flip(
|
|
129
|
+
np.arange(first - last, 0)
|
|
130
|
+
)
|
|
131
|
+
disp_max_from_borders[row_id, first:last] = np.flip(
|
|
132
|
+
np.arange(0, last - first)
|
|
133
|
+
)
|
|
134
|
+
disp_min_from_borders = np.minimum(disp_max_grid, disp_min_from_borders)
|
|
135
|
+
disp_max_from_borders = np.maximum(disp_min_grid, disp_max_from_borders)
|
|
136
|
+
disp_min_grid = np.maximum(disp_min_from_borders, disp_min_grid)
|
|
137
|
+
disp_max_grid = np.minimum(disp_max_from_borders, disp_max_grid)
|
|
138
|
+
|
|
91
139
|
# Interpolation might create min > max
|
|
92
140
|
disp_min_grid, disp_max_grid = dm_wrap.to_safe_disp_grid(
|
|
93
141
|
disp_min_grid, disp_max_grid
|
|
@@ -658,17 +658,32 @@ def add_confidence(
|
|
|
658
658
|
disp.confidence_measure.indicator
|
|
659
659
|
)
|
|
660
660
|
for key in confidence_measure_indicator_list:
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
661
|
+
if key == "confidence_from_ambiguity.cars_1":
|
|
662
|
+
confidence_idx = list(disp.confidence_measure.indicator).index(key)
|
|
663
|
+
|
|
664
|
+
output_dataset["ambiguity"] = xr.DataArray(
|
|
665
|
+
1
|
|
666
|
+
- np.copy(
|
|
667
|
+
disp.confidence_measure.data[
|
|
668
|
+
:,
|
|
669
|
+
:,
|
|
670
|
+
confidence_idx,
|
|
671
|
+
]
|
|
672
|
+
),
|
|
673
|
+
dims=[cst.ROW, cst.COL],
|
|
674
|
+
)
|
|
675
|
+
else:
|
|
676
|
+
confidence_idx = list(disp.confidence_measure.indicator).index(key)
|
|
677
|
+
output_dataset[str(key)] = xr.DataArray(
|
|
678
|
+
np.copy(
|
|
679
|
+
disp.confidence_measure.data[
|
|
680
|
+
:,
|
|
681
|
+
:,
|
|
682
|
+
confidence_idx,
|
|
683
|
+
]
|
|
684
|
+
),
|
|
685
|
+
dims=[cst.ROW, cst.COL],
|
|
686
|
+
)
|
|
672
687
|
|
|
673
688
|
|
|
674
689
|
def to_safe_disp_grid(grid_disp_min, grid_disp_max):
|
|
@@ -880,34 +895,39 @@ def confidence_filtering(
|
|
|
880
895
|
:type conf_filtering: dict
|
|
881
896
|
"""
|
|
882
897
|
|
|
883
|
-
|
|
884
|
-
|
|
898
|
+
data_risk_inf = dataset[requested_confidence[0]].values
|
|
899
|
+
data_risk_sup = dataset[requested_confidence[1]].values
|
|
900
|
+
risk_range = data_risk_sup - data_risk_inf
|
|
901
|
+
|
|
902
|
+
data_bounds_inf = dataset[requested_confidence[2]].values
|
|
903
|
+
data_bounds_sup = dataset[requested_confidence[3]].values
|
|
904
|
+
bounds_range = data_bounds_sup - data_bounds_inf
|
|
905
|
+
|
|
906
|
+
disp_min = dataset["disp_min_grid"].values
|
|
907
|
+
disp_max = dataset["disp_max_grid"].values
|
|
908
|
+
|
|
909
|
+
risk_ratio = risk_range / (disp_max - disp_min)
|
|
910
|
+
bounds_ratio = bounds_range / (disp_max - disp_min)
|
|
885
911
|
|
|
886
912
|
with warnings.catch_warnings():
|
|
887
913
|
warnings.simplefilter("ignore", category=RuntimeWarning)
|
|
888
914
|
nan_ratio = generic_filter(
|
|
889
915
|
disp_map, nan_ratio_func, size=conf_filtering["win_nanratio"]
|
|
890
916
|
)
|
|
891
|
-
var_map = generic_filter(
|
|
892
|
-
data_risk, np.nanmean, size=conf_filtering["win_mean_risk_max"]
|
|
893
|
-
)
|
|
894
917
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
| (data_bounds_sup <= conf_filtering["lower_bound"])
|
|
898
|
-
) | (
|
|
899
|
-
(var_map > conf_filtering["risk_max"])
|
|
900
|
-
& (nan_ratio > conf_filtering["nan_threshold"])
|
|
918
|
+
bounds_mask = (bounds_ratio > conf_filtering["bounds_ratio_threshold"]) & (
|
|
919
|
+
bounds_range > conf_filtering["bounds_range_threshold"]
|
|
901
920
|
)
|
|
902
|
-
|
|
921
|
+
risk_mask = (risk_ratio > conf_filtering["risk_ratio_threshold"]) & (
|
|
922
|
+
risk_range > conf_filtering["risk_range_threshold"]
|
|
923
|
+
)
|
|
924
|
+
mask = bounds_mask | risk_mask
|
|
903
925
|
dataset["disp"].values[mask] = np.nan
|
|
904
926
|
dataset["disp_msk"].values[mask] = 0
|
|
905
927
|
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
dataset["confidence_from_mean_risk_max"] = var_mean_risk
|
|
913
|
-
dataset["confidence_from_nanratio"] = var_nan_ratio
|
|
928
|
+
mask = (nan_ratio > conf_filtering["nan_threshold"]) & (
|
|
929
|
+
(bounds_range > conf_filtering["bounds_range_threshold"])
|
|
930
|
+
| (risk_range > conf_filtering["risk_range_threshold"])
|
|
931
|
+
)
|
|
932
|
+
dataset["disp"].values[mask] = np.nan
|
|
933
|
+
dataset["disp_msk"].values[mask] = 0
|