cars 1.0.0a3__cp313-cp313-win_amd64.whl → 1.0.0a4__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cars might be problematic. Click here for more details.
- 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.cp313-win_amd64.dll.a +0 -0
- cars/applications/dense_matching/cpp/dense_matching_cpp.cp313-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.cp313-win_amd64.dll.a +0 -0
- cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp313-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
|
@@ -160,6 +160,7 @@ class PointCloudOutlierRemoval(ScalingApplicationTemplate, metaclass=ABCMeta):
|
|
|
160
160
|
|
|
161
161
|
"""
|
|
162
162
|
|
|
163
|
+
# pylint: disable=too-many-positional-arguments
|
|
163
164
|
def __register_epipolar_dataset__(
|
|
164
165
|
self,
|
|
165
166
|
epipolar_point_cloud,
|
|
@@ -350,7 +351,7 @@ class PointCloudOutlierRemoval(ScalingApplicationTemplate, metaclass=ABCMeta):
|
|
|
350
351
|
)
|
|
351
352
|
|
|
352
353
|
@abstractmethod
|
|
353
|
-
def run(
|
|
354
|
+
def run( # pylint: disable=too-many-positional-arguments
|
|
354
355
|
self,
|
|
355
356
|
merged_point_cloud,
|
|
356
357
|
orchestrator=None,
|
|
@@ -31,7 +31,7 @@ import outlier_filter # pylint:disable=E0401
|
|
|
31
31
|
import pandas
|
|
32
32
|
from scipy.spatial import cKDTree # pylint: disable=no-name-in-module
|
|
33
33
|
|
|
34
|
-
from cars.applications.
|
|
34
|
+
from cars.applications.triangulation import pc_transform
|
|
35
35
|
|
|
36
36
|
# CARS imports
|
|
37
37
|
from cars.core import constants as cst
|
|
@@ -82,7 +82,9 @@ def small_component_filtering(
|
|
|
82
82
|
clusters_distance_threshold=clusters_distance_threshold_float,
|
|
83
83
|
)
|
|
84
84
|
|
|
85
|
-
return filter_cloud(
|
|
85
|
+
return pc_transform.filter_cloud(
|
|
86
|
+
cloud, index_elt_to_remove, filtered_elt_pos
|
|
87
|
+
)
|
|
86
88
|
|
|
87
89
|
|
|
88
90
|
def detect_small_components(
|
|
@@ -188,6 +190,7 @@ def detect_small_components(
|
|
|
188
190
|
# ##### statistical filtering ######
|
|
189
191
|
|
|
190
192
|
|
|
193
|
+
# pylint: disable=too-many-positional-arguments
|
|
191
194
|
def statistical_outlier_filtering(
|
|
192
195
|
cloud: pandas.DataFrame,
|
|
193
196
|
k: int,
|
|
@@ -228,7 +231,9 @@ def statistical_outlier_filtering(
|
|
|
228
231
|
use_median=use_median,
|
|
229
232
|
)
|
|
230
233
|
|
|
231
|
-
return filter_cloud(
|
|
234
|
+
return pc_transform.filter_cloud(
|
|
235
|
+
cloud, index_elt_to_remove, filtered_elt_pos
|
|
236
|
+
)
|
|
232
237
|
|
|
233
238
|
|
|
234
239
|
def detect_statistical_outliers(
|
|
@@ -339,9 +344,9 @@ def epipolar_small_components(
|
|
|
339
344
|
return cloud
|
|
340
345
|
|
|
341
346
|
|
|
347
|
+
# pylint: disable=too-many-positional-arguments
|
|
342
348
|
def epipolar_statistical_filtering(
|
|
343
349
|
epipolar_ds,
|
|
344
|
-
epsg,
|
|
345
350
|
k=15,
|
|
346
351
|
filtering_constant=0.0,
|
|
347
352
|
mean_factor=1.0,
|
|
@@ -354,8 +359,6 @@ def epipolar_statistical_filtering(
|
|
|
354
359
|
|
|
355
360
|
:param epipolar_ds: epipolar dataset to filter
|
|
356
361
|
:type epipolar_ds: xr.Dataset
|
|
357
|
-
:param epsg: epsg code of the CRS used to compute distances
|
|
358
|
-
:type epsg: int
|
|
359
362
|
:param statistical_k: k
|
|
360
363
|
:type statistical_k: int
|
|
361
364
|
:param std_dev_factor: std factor
|
|
@@ -370,8 +373,6 @@ def epipolar_statistical_filtering(
|
|
|
370
373
|
|
|
371
374
|
"""
|
|
372
375
|
|
|
373
|
-
projection.point_cloud_conversion_dataset(epipolar_ds, epsg)
|
|
374
|
-
|
|
375
376
|
if not np.all(np.isnan(epipolar_ds[cst.Z])):
|
|
376
377
|
|
|
377
378
|
outlier_filter.epipolar_statistical_outlier_filtering(
|
|
@@ -27,9 +27,7 @@ import copy
|
|
|
27
27
|
|
|
28
28
|
# Standard imports
|
|
29
29
|
import logging
|
|
30
|
-
import math
|
|
31
30
|
import os
|
|
32
|
-
import time
|
|
33
31
|
|
|
34
32
|
# Third party imports
|
|
35
33
|
import numpy as np
|
|
@@ -39,14 +37,13 @@ from pyproj import CRS
|
|
|
39
37
|
# CARS imports
|
|
40
38
|
import cars.orchestrator.orchestrator as ocht
|
|
41
39
|
from cars.applications import application_constants
|
|
42
|
-
from cars.applications.point_cloud_fusion import (
|
|
43
|
-
pc_fusion_algo,
|
|
44
|
-
pc_fusion_wrappers,
|
|
45
|
-
)
|
|
46
40
|
from cars.applications.point_cloud_outlier_removal import (
|
|
47
41
|
abstract_outlier_removal_app as pc_removal,
|
|
48
42
|
)
|
|
49
|
-
from cars.applications.point_cloud_outlier_removal import
|
|
43
|
+
from cars.applications.point_cloud_outlier_removal import (
|
|
44
|
+
outlier_removal_algo,
|
|
45
|
+
)
|
|
46
|
+
from cars.applications.triangulation import pc_transform
|
|
50
47
|
from cars.applications.triangulation.triangulation_wrappers import (
|
|
51
48
|
generate_point_cloud_file_names,
|
|
52
49
|
)
|
|
@@ -79,7 +76,6 @@ class SmallComponents(
|
|
|
79
76
|
self.used_method = self.used_config["method"]
|
|
80
77
|
|
|
81
78
|
# small components
|
|
82
|
-
self.activated = self.used_config["activated"]
|
|
83
79
|
self.on_ground_margin = self.used_config["on_ground_margin"]
|
|
84
80
|
self.connection_distance = self.used_config["connection_distance"]
|
|
85
81
|
self.nb_points_threshold = self.used_config["nb_points_threshold"]
|
|
@@ -121,10 +117,6 @@ class SmallComponents(
|
|
|
121
117
|
overloaded_conf["save_by_pair"] = conf.get("save_by_pair", False)
|
|
122
118
|
|
|
123
119
|
# small components
|
|
124
|
-
overloaded_conf["activated"] = conf.get(
|
|
125
|
-
"activated", True
|
|
126
|
-
) # if false, the following
|
|
127
|
-
# parameters are unused
|
|
128
120
|
# on_ground_margin:
|
|
129
121
|
# margin added to the on ground region to not filter
|
|
130
122
|
# points clusters
|
|
@@ -161,7 +153,6 @@ class SmallComponents(
|
|
|
161
153
|
point_cloud_fusion_schema = {
|
|
162
154
|
"method": str,
|
|
163
155
|
"save_by_pair": bool,
|
|
164
|
-
"activated": bool,
|
|
165
156
|
"on_ground_margin": int,
|
|
166
157
|
"connection_distance": And(float, lambda x: x > 0),
|
|
167
158
|
"nb_points_threshold": And(int, lambda x: x > 0),
|
|
@@ -196,18 +187,12 @@ class SmallComponents(
|
|
|
196
187
|
:rtype: float
|
|
197
188
|
|
|
198
189
|
"""
|
|
190
|
+
tot = 10000 * superposing_point_clouds / point_cloud_resolution
|
|
199
191
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
else:
|
|
205
|
-
tot = 10000 * superposing_point_clouds / point_cloud_resolution
|
|
206
|
-
|
|
207
|
-
import_ = 200 # MiB
|
|
208
|
-
tile_size = int(
|
|
209
|
-
np.sqrt(float(((max_ram_per_worker - import_) * 2**23)) / tot)
|
|
210
|
-
)
|
|
192
|
+
import_ = 200 # MiB
|
|
193
|
+
tile_size = int(
|
|
194
|
+
np.sqrt(float(((max_ram_per_worker - import_) * 2**23)) / tot)
|
|
195
|
+
)
|
|
211
196
|
|
|
212
197
|
logging.info(
|
|
213
198
|
"Estimated optimal tile size for small"
|
|
@@ -234,11 +219,7 @@ class SmallComponents(
|
|
|
234
219
|
:return: margin
|
|
235
220
|
:rtype: int
|
|
236
221
|
"""
|
|
237
|
-
|
|
238
|
-
margin = 0
|
|
239
|
-
|
|
240
|
-
if self.activated:
|
|
241
|
-
margin = self.half_epipolar_size
|
|
222
|
+
margin = self.half_epipolar_size
|
|
242
223
|
|
|
243
224
|
return margin
|
|
244
225
|
|
|
@@ -250,15 +231,11 @@ class SmallComponents(
|
|
|
250
231
|
:rtype: float
|
|
251
232
|
|
|
252
233
|
"""
|
|
253
|
-
|
|
254
|
-
on_ground_margin = 0
|
|
255
|
-
|
|
256
|
-
if self.activated:
|
|
257
|
-
on_ground_margin = self.on_ground_margin * resolution
|
|
234
|
+
on_ground_margin = self.on_ground_margin * resolution
|
|
258
235
|
|
|
259
236
|
return on_ground_margin
|
|
260
237
|
|
|
261
|
-
def run(
|
|
238
|
+
def run( # pylint: disable=too-many-positional-arguments
|
|
262
239
|
self,
|
|
263
240
|
merged_point_cloud,
|
|
264
241
|
orchestrator=None,
|
|
@@ -312,10 +289,6 @@ class SmallComponents(
|
|
|
312
289
|
|
|
313
290
|
:rtype: CarsDataset filled with xr.Dataset
|
|
314
291
|
"""
|
|
315
|
-
|
|
316
|
-
if not self.activated:
|
|
317
|
-
return merged_point_cloud
|
|
318
|
-
|
|
319
292
|
# Default orchestrator
|
|
320
293
|
if orchestrator is None:
|
|
321
294
|
# Create default sequential orchestrator for current application
|
|
@@ -327,244 +300,99 @@ class SmallComponents(
|
|
|
327
300
|
else:
|
|
328
301
|
self.orchestrator = orchestrator
|
|
329
302
|
|
|
330
|
-
if
|
|
331
|
-
(
|
|
332
|
-
filtered_point_cloud,
|
|
333
|
-
point_cloud_laz_file_name,
|
|
334
|
-
point_cloud_csv_file_name,
|
|
335
|
-
saving_info,
|
|
336
|
-
) = self.__register_pc_dataset__(
|
|
337
|
-
merged_point_cloud,
|
|
338
|
-
point_cloud_dir,
|
|
339
|
-
dump_dir,
|
|
340
|
-
app_name="small_components",
|
|
341
|
-
)
|
|
342
|
-
# Generate rasters
|
|
343
|
-
for col in range(filtered_point_cloud.shape[1]):
|
|
344
|
-
for row in range(filtered_point_cloud.shape[0]):
|
|
345
|
-
# update saving infos for potential replacement
|
|
346
|
-
full_saving_info = ocht.update_saving_infos(
|
|
347
|
-
saving_info, row=row, col=col
|
|
348
|
-
)
|
|
349
|
-
if merged_point_cloud.tiles[row][col] is not None:
|
|
350
|
-
# Delayed call to cloud filtering
|
|
351
|
-
filtered_point_cloud[
|
|
352
|
-
row, col
|
|
353
|
-
] = self.orchestrator.cluster.create_task(
|
|
354
|
-
small_component_removal_wrapper
|
|
355
|
-
)(
|
|
356
|
-
merged_point_cloud[row, col],
|
|
357
|
-
self.connection_distance,
|
|
358
|
-
self.nb_points_threshold,
|
|
359
|
-
self.clusters_distance_threshold,
|
|
360
|
-
save_by_pair=(self.save_by_pair),
|
|
361
|
-
point_cloud_csv_file_name=point_cloud_csv_file_name,
|
|
362
|
-
point_cloud_laz_file_name=point_cloud_laz_file_name,
|
|
363
|
-
saving_info=full_saving_info,
|
|
364
|
-
)
|
|
303
|
+
if dump_dir is None:
|
|
304
|
+
dump_dir = self.generate_unknown_dump_dir(self.orchestrator)
|
|
365
305
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
filtered_point_cloud, saving_info_epipolar = (
|
|
370
|
-
self.__register_epipolar_dataset__(
|
|
371
|
-
merged_point_cloud,
|
|
372
|
-
depth_map_dir,
|
|
373
|
-
dump_dir,
|
|
374
|
-
app_name="small_components",
|
|
375
|
-
pair_key=prefix,
|
|
376
|
-
)
|
|
306
|
+
if merged_point_cloud.dataset_type != "arrays":
|
|
307
|
+
raise RuntimeError(
|
|
308
|
+
"Only arrays is supported in small components removal"
|
|
377
309
|
)
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
laz_pc_dir_name,
|
|
383
|
-
csv_pc_dir_name,
|
|
384
|
-
saving_info_flatten,
|
|
385
|
-
) = self.__register_pc_dataset__(
|
|
310
|
+
prefix = os.path.basename(dump_dir)
|
|
311
|
+
# Save as depth map
|
|
312
|
+
filtered_point_cloud, saving_info_epipolar = (
|
|
313
|
+
self.__register_epipolar_dataset__(
|
|
386
314
|
merged_point_cloud,
|
|
387
|
-
|
|
315
|
+
depth_map_dir,
|
|
388
316
|
dump_dir,
|
|
389
317
|
app_name="small_components",
|
|
318
|
+
pair_key=prefix,
|
|
390
319
|
)
|
|
320
|
+
)
|
|
391
321
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
322
|
+
# Save as point cloud
|
|
323
|
+
(
|
|
324
|
+
flatten_filtered_point_cloud,
|
|
325
|
+
laz_pc_dir_name,
|
|
326
|
+
csv_pc_dir_name,
|
|
327
|
+
saving_info_flatten,
|
|
328
|
+
) = self.__register_pc_dataset__(
|
|
329
|
+
merged_point_cloud,
|
|
330
|
+
point_cloud_dir,
|
|
331
|
+
dump_dir,
|
|
332
|
+
app_name="small_components",
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
# initialize empty index file for point cloud product if official
|
|
336
|
+
# product is requested
|
|
337
|
+
pc_index = None
|
|
338
|
+
if point_cloud_dir:
|
|
339
|
+
pc_index = {}
|
|
397
340
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
341
|
+
# Generate rasters
|
|
342
|
+
for col in range(filtered_point_cloud.shape[1]):
|
|
343
|
+
for row in range(filtered_point_cloud.shape[0]):
|
|
401
344
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
345
|
+
# update saving infos for potential replacement
|
|
346
|
+
full_saving_info_epipolar = ocht.update_saving_infos(
|
|
347
|
+
saving_info_epipolar, row=row, col=col
|
|
348
|
+
)
|
|
349
|
+
full_saving_info_flatten = None
|
|
350
|
+
if saving_info_flatten is not None:
|
|
351
|
+
full_saving_info_flatten = ocht.update_saving_infos(
|
|
352
|
+
saving_info_flatten, row=row, col=col
|
|
405
353
|
)
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
354
|
+
if merged_point_cloud[row][col] is not None:
|
|
355
|
+
csv_pc_file_name, laz_pc_file_name = (
|
|
356
|
+
generate_point_cloud_file_names(
|
|
357
|
+
csv_pc_dir_name,
|
|
358
|
+
laz_pc_dir_name,
|
|
359
|
+
row,
|
|
360
|
+
col,
|
|
361
|
+
pc_index,
|
|
362
|
+
pair_key=prefix,
|
|
410
363
|
)
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
self.clusters_distance_threshold,
|
|
435
|
-
self.half_epipolar_size,
|
|
436
|
-
window,
|
|
437
|
-
overlap,
|
|
438
|
-
point_cloud_csv_file_name=csv_pc_file_name,
|
|
439
|
-
point_cloud_laz_file_name=laz_pc_file_name,
|
|
440
|
-
saving_info_epipolar=full_saving_info_epipolar,
|
|
441
|
-
saving_info_flatten=full_saving_info_flatten,
|
|
442
|
-
)
|
|
443
|
-
|
|
444
|
-
# update point cloud index
|
|
445
|
-
if point_cloud_dir:
|
|
446
|
-
self.orchestrator.update_index(pc_index)
|
|
364
|
+
)
|
|
365
|
+
window = merged_point_cloud.tiling_grid[row, col]
|
|
366
|
+
overlap = filtered_point_cloud.overlaps[row, col]
|
|
367
|
+
# Delayed call to cloud filtering
|
|
368
|
+
(
|
|
369
|
+
filtered_point_cloud[row, col],
|
|
370
|
+
flatten_filtered_point_cloud[row, col],
|
|
371
|
+
) = self.orchestrator.cluster.create_task(
|
|
372
|
+
epipolar_small_component_removal_wrapper, nout=2
|
|
373
|
+
)(
|
|
374
|
+
merged_point_cloud[row, col],
|
|
375
|
+
self.connection_distance,
|
|
376
|
+
self.nb_points_threshold,
|
|
377
|
+
self.clusters_distance_threshold,
|
|
378
|
+
self.half_epipolar_size,
|
|
379
|
+
window,
|
|
380
|
+
overlap,
|
|
381
|
+
epsg=epsg,
|
|
382
|
+
point_cloud_csv_file_name=csv_pc_file_name,
|
|
383
|
+
point_cloud_laz_file_name=laz_pc_file_name,
|
|
384
|
+
saving_info_epipolar=full_saving_info_epipolar,
|
|
385
|
+
saving_info_flatten=full_saving_info_flatten,
|
|
386
|
+
)
|
|
447
387
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
"this input data "
|
|
452
|
-
"format"
|
|
453
|
-
)
|
|
388
|
+
# update point cloud index
|
|
389
|
+
if point_cloud_dir:
|
|
390
|
+
self.orchestrator.update_index(pc_index)
|
|
454
391
|
|
|
455
392
|
return filtered_point_cloud
|
|
456
393
|
|
|
457
394
|
|
|
458
|
-
|
|
459
|
-
cloud,
|
|
460
|
-
connection_distance,
|
|
461
|
-
nb_points_threshold,
|
|
462
|
-
clusters_distance_threshold,
|
|
463
|
-
save_by_pair: bool = False,
|
|
464
|
-
point_cloud_csv_file_name=None,
|
|
465
|
-
point_cloud_laz_file_name=None,
|
|
466
|
-
saving_info=None,
|
|
467
|
-
):
|
|
468
|
-
"""
|
|
469
|
-
Small components outlier removal
|
|
470
|
-
|
|
471
|
-
:param cloud: cloud to filter
|
|
472
|
-
:type cloud: pandas DataFrame
|
|
473
|
-
:param connection_distance: connection distance
|
|
474
|
-
:type connection_distance: float
|
|
475
|
-
:param nb_points_threshold:
|
|
476
|
-
:type nb_points_threshold: int
|
|
477
|
-
:param clusters_distance_threshold:
|
|
478
|
-
:type clusters_distance_threshold: float
|
|
479
|
-
:param save_by_pair: save point cloud as pair
|
|
480
|
-
:type save_by_pair: bool
|
|
481
|
-
:param point_cloud_csv_file_name: write point cloud as CSV in filename
|
|
482
|
-
(if None, the point cloud is not written as csv)
|
|
483
|
-
:type point_cloud_csv_file_name: str
|
|
484
|
-
:param point_cloud_laz_file_name: write point cloud as laz in filename
|
|
485
|
-
(if None, the point cloud is not written as laz)
|
|
486
|
-
:type point_cloud_laz_file_name: str
|
|
487
|
-
:param saving_info: saving infos
|
|
488
|
-
:type saving_info: dict
|
|
489
|
-
|
|
490
|
-
:return: filtered cloud
|
|
491
|
-
:rtype: pandas DataFrame
|
|
492
|
-
|
|
493
|
-
"""
|
|
494
|
-
|
|
495
|
-
# Copy input cloud
|
|
496
|
-
new_cloud = cloud.copy()
|
|
497
|
-
new_cloud.attrs = copy.deepcopy(cloud.attrs)
|
|
498
|
-
|
|
499
|
-
# Get current epsg
|
|
500
|
-
cloud_attributes = cars_dataset.get_attributes(new_cloud)
|
|
501
|
-
cloud_epsg = cloud_attributes["epsg"]
|
|
502
|
-
current_epsg = cloud_epsg
|
|
503
|
-
|
|
504
|
-
# Check if can be used to filter
|
|
505
|
-
spatial_ref = CRS.from_epsg(cloud_epsg)
|
|
506
|
-
if spatial_ref.is_geographic:
|
|
507
|
-
logging.debug(
|
|
508
|
-
"The points cloud to filter is not in a cartographic system. "
|
|
509
|
-
"The filter's default parameters might not be adapted "
|
|
510
|
-
"to this referential. Please, convert the points "
|
|
511
|
-
"cloud to ECEF to ensure a proper point_cloud."
|
|
512
|
-
)
|
|
513
|
-
# Convert to epsg = 4978
|
|
514
|
-
cartographic_epsg = 4978
|
|
515
|
-
|
|
516
|
-
projection.point_cloud_conversion_dataframe(
|
|
517
|
-
new_cloud, current_epsg, cartographic_epsg
|
|
518
|
-
)
|
|
519
|
-
current_epsg = cartographic_epsg
|
|
520
|
-
|
|
521
|
-
# Filter point cloud
|
|
522
|
-
tic = time.process_time()
|
|
523
|
-
(
|
|
524
|
-
new_cloud,
|
|
525
|
-
_,
|
|
526
|
-
) = outlier_removal_algo.small_component_filtering(
|
|
527
|
-
new_cloud,
|
|
528
|
-
connection_distance,
|
|
529
|
-
nb_points_threshold,
|
|
530
|
-
clusters_distance_threshold,
|
|
531
|
-
)
|
|
532
|
-
toc = time.process_time()
|
|
533
|
-
logging.debug(
|
|
534
|
-
"Small component cloud filtering done in {} seconds".format(toc - tic)
|
|
535
|
-
)
|
|
536
|
-
|
|
537
|
-
# Conversion to UTM
|
|
538
|
-
projection.point_cloud_conversion_dataframe(
|
|
539
|
-
new_cloud, cloud_epsg, current_epsg
|
|
540
|
-
)
|
|
541
|
-
# Update attributes
|
|
542
|
-
cloud_attributes["epsg"] = current_epsg
|
|
543
|
-
cars_dataset.fill_dataframe(
|
|
544
|
-
new_cloud, saving_info=saving_info, attributes=cloud_attributes
|
|
545
|
-
)
|
|
546
|
-
|
|
547
|
-
# save point cloud in worker
|
|
548
|
-
if point_cloud_csv_file_name:
|
|
549
|
-
cars_dataset.run_save_points(
|
|
550
|
-
new_cloud,
|
|
551
|
-
point_cloud_csv_file_name,
|
|
552
|
-
save_by_pair=save_by_pair,
|
|
553
|
-
overwrite=True,
|
|
554
|
-
point_cloud_format="csv",
|
|
555
|
-
)
|
|
556
|
-
if point_cloud_laz_file_name:
|
|
557
|
-
cars_dataset.run_save_points(
|
|
558
|
-
new_cloud,
|
|
559
|
-
point_cloud_laz_file_name,
|
|
560
|
-
save_by_pair=save_by_pair,
|
|
561
|
-
overwrite=True,
|
|
562
|
-
point_cloud_format="laz",
|
|
563
|
-
)
|
|
564
|
-
|
|
565
|
-
return new_cloud
|
|
566
|
-
|
|
567
|
-
|
|
395
|
+
# pylint: disable=too-many-positional-arguments
|
|
568
396
|
def epipolar_small_component_removal_wrapper(
|
|
569
397
|
cloud,
|
|
570
398
|
connection_distance,
|
|
@@ -573,6 +401,7 @@ def epipolar_small_component_removal_wrapper(
|
|
|
573
401
|
half_epipolar_size,
|
|
574
402
|
window,
|
|
575
403
|
overlap,
|
|
404
|
+
epsg=None,
|
|
576
405
|
point_cloud_csv_file_name=None,
|
|
577
406
|
point_cloud_laz_file_name=None,
|
|
578
407
|
saving_info_epipolar=None,
|
|
@@ -649,19 +478,19 @@ def epipolar_small_component_removal_wrapper(
|
|
|
649
478
|
if point_cloud_csv_file_name or point_cloud_laz_file_name:
|
|
650
479
|
# Convert epipolar array into point cloud
|
|
651
480
|
flatten_filtered_cloud, cloud_epsg = (
|
|
652
|
-
|
|
653
|
-
|
|
481
|
+
pc_transform.depth_map_dataset_to_dataframe(
|
|
482
|
+
filtered_cloud, current_epsg
|
|
654
483
|
)
|
|
655
484
|
)
|
|
656
485
|
# Convert to UTM
|
|
657
|
-
if
|
|
486
|
+
if epsg is not None and cloud_epsg != epsg:
|
|
658
487
|
projection.point_cloud_conversion_dataframe(
|
|
659
|
-
flatten_filtered_cloud, cloud_epsg,
|
|
488
|
+
flatten_filtered_cloud, cloud_epsg, epsg
|
|
660
489
|
)
|
|
661
|
-
cloud_epsg =
|
|
490
|
+
cloud_epsg = epsg
|
|
662
491
|
|
|
663
492
|
# Fill attributes for LAZ saving
|
|
664
|
-
color_type =
|
|
493
|
+
color_type = pc_transform.get_color_type([filtered_cloud])
|
|
665
494
|
|
|
666
495
|
attributes = {
|
|
667
496
|
"epsg": cloud_epsg,
|