cars 1.0.0a1__cp313-cp313-musllinux_1_2_i686.whl → 1.0.0a2__cp313-cp313-musllinux_1_2_i686.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.

Files changed (42) hide show
  1. cars/applications/dem_generation/dem_generation_wrappers.py +5 -1
  2. cars/applications/dem_generation/dichotomic_generation_app.py +21 -6
  3. cars/applications/dem_generation/rasterization_app.py +70 -27
  4. cars/applications/dense_match_filling/abstract_dense_match_filling_app.py +4 -0
  5. cars/applications/dense_match_filling/fill_disp_algo.py +41 -12
  6. cars/applications/dense_match_filling/plane_app.py +11 -0
  7. cars/applications/dense_match_filling/zero_padding_app.py +11 -1
  8. cars/applications/dense_matching/census_mccnn_sgm_app.py +262 -545
  9. cars/applications/dense_matching/dense_matching_algo.py +59 -11
  10. cars/applications/dense_matching/dense_matching_wrappers.py +51 -31
  11. cars/applications/dense_matching/disparity_grid_algo.py +572 -0
  12. cars/applications/grid_generation/grid_correction_app.py +0 -53
  13. cars/applications/grid_generation/transform_grid.py +5 -5
  14. cars/applications/point_cloud_fusion/pc_fusion_algo.py +17 -11
  15. cars/applications/point_cloud_fusion/pc_fusion_wrappers.py +3 -4
  16. cars/applications/rasterization/rasterization_algo.py +20 -27
  17. cars/applications/rasterization/rasterization_wrappers.py +6 -5
  18. cars/applications/rasterization/simple_gaussian_app.py +2 -14
  19. cars/applications/sparse_matching/sparse_matching_wrappers.py +0 -49
  20. cars/applications/triangulation/line_of_sight_intersection_app.py +1 -1
  21. cars/applications/triangulation/triangulation_wrappers.py +2 -1
  22. cars/bundleadjustment.py +51 -11
  23. cars/cars.py +15 -5
  24. cars/core/constants.py +1 -1
  25. cars/core/geometry/abstract_geometry.py +54 -11
  26. cars/core/geometry/shareloc_geometry.py +59 -14
  27. cars/orchestrator/registry/saver_registry.py +0 -78
  28. cars/pipelines/default/default_pipeline.py +23 -26
  29. cars/pipelines/parameters/depth_map_inputs.py +22 -67
  30. cars/pipelines/parameters/dsm_inputs.py +16 -29
  31. cars/pipelines/parameters/sensor_inputs.py +20 -21
  32. cars/pipelines/parameters/sensor_loaders/basic_sensor_loader.py +3 -3
  33. cars/pipelines/parameters/sensor_loaders/pivot_sensor_loader.py +2 -2
  34. cars/pipelines/parameters/sensor_loaders/sensor_loader.py +4 -6
  35. cars/pipelines/parameters/sensor_loaders/sensor_loader_template.py +2 -2
  36. cars/pipelines/pipeline.py +8 -8
  37. cars/pipelines/unit/unit_pipeline.py +103 -196
  38. cars/starter.py +20 -1
  39. {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/METADATA +3 -2
  40. {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/RECORD +187 -186
  41. {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/WHEEL +0 -0
  42. {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/entry_points.txt +0 -0
@@ -35,6 +35,7 @@ from affine import Affine
35
35
  from rasterio.coords import BoundingBox
36
36
  from rasterio.enums import Resampling
37
37
  from rasterio.warp import calculate_default_transform, reproject
38
+ from scipy.ndimage import median_filter
38
39
 
39
40
  from cars.core import preprocessing
40
41
 
@@ -243,7 +244,7 @@ def reverse_dem(input_dem):
243
244
  out_dem.nodata = -nodata
244
245
 
245
246
 
246
- def downsample_dem(input_dem, scale):
247
+ def downsample_dem(input_dem, scale, median_filter_size=7):
247
248
  """
248
249
  Downsample median DEM with median resampling
249
250
 
@@ -277,6 +278,9 @@ def downsample_dem(input_dem, scale):
277
278
  resampling=Resampling.med,
278
279
  )
279
280
 
281
+ # Median filter as post-processing
282
+ output = median_filter(output, size=median_filter_size)
283
+
280
284
  with rio.open(input_dem, "w", **metadata) as dst:
281
285
  dst.write(output, 1)
282
286
 
@@ -175,7 +175,8 @@ class DichotomicGeneration(DemGeneration, short_name="dichotomic"):
175
175
  self,
176
176
  triangulated_matches_list,
177
177
  output_dir,
178
- geoid_path,
178
+ input_geoid,
179
+ output_geoid,
179
180
  dem_roi_to_use=None,
180
181
  initial_elevation=None,
181
182
  cars_orchestrator=None,
@@ -188,7 +189,8 @@ class DichotomicGeneration(DemGeneration, short_name="dichotomic"):
188
189
  :type triangulated_matches_list: list(pandas.Dataframe)
189
190
  :param output_dir: directory to save dem
190
191
  :type output_dir: str
191
- :param geoid_path: geoid path
192
+ :param input_geoid: input geoid path
193
+ :param output_geoid: output geoid path
192
194
  :param cars_orchrestrator: the main cars orchestrator
193
195
  :param dem_roi_to_use: dem roi polygon to use as roi
194
196
  :param initial_elevation: the path to the initial elevation file
@@ -208,6 +210,11 @@ class DichotomicGeneration(DemGeneration, short_name="dichotomic"):
208
210
  # Generate point cloud
209
211
  epsg = 4326
210
212
 
213
+ # Optimize the case when input and output geoid are the same
214
+ if output_geoid is True:
215
+ input_geoid = False
216
+ output_geoid = False
217
+
211
218
  for pair_pc in triangulated_matches_list:
212
219
  # convert to degrees for geoid offset
213
220
  if pair_pc.attrs["epsg"] != epsg:
@@ -312,9 +319,14 @@ class DichotomicGeneration(DemGeneration, short_name="dichotomic"):
312
319
  # Transform to lon lat
313
320
  projection.point_cloud_conversion_dataset(alti_zeros_dataset, 4326)
314
321
 
315
- geoid_offset = triangulation_wrappers.geoid_offset(
316
- alti_zeros_dataset, geoid_path
317
- )
322
+ if input_geoid:
323
+ input_geoid = triangulation_wrappers.geoid_offset(
324
+ alti_zeros_dataset, input_geoid
325
+ )
326
+ if output_geoid:
327
+ output_geoid = triangulation_wrappers.geoid_offset(
328
+ alti_zeros_dataset, output_geoid
329
+ )
318
330
 
319
331
  # fillnodata
320
332
  valid = np.isfinite(list_z_grid[0])
@@ -323,7 +335,10 @@ class DichotomicGeneration(DemGeneration, short_name="dichotomic"):
323
335
  list_z_grid[idx] = rasterio.fill.fillnodata(
324
336
  list_z_grid[idx], mask=valid, max_search_distance=msd
325
337
  )
326
- list_z_grid[idx] += geoid_offset[cst.Z].values
338
+ if input_geoid:
339
+ list_z_grid[idx] += input_geoid[cst.Z].values
340
+ if output_geoid:
341
+ list_z_grid[idx] -= output_geoid[cst.Z].values
327
342
 
328
343
  dem_median = list_z_grid[0]
329
344
  dem_min = list_z_grid[1]
@@ -86,7 +86,12 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
86
86
  self.morphological_filters_size = self.used_config[
87
87
  "morphological_filters_size"
88
88
  ]
89
- self.median_filter_size = self.used_config["median_filter_size"]
89
+ self.preprocessing_median_filter_size = self.used_config[
90
+ "preprocessing_median_filter_size"
91
+ ]
92
+ self.postprocessing_median_filter_size = self.used_config[
93
+ "postprocessing_median_filter_size"
94
+ ]
90
95
  self.dem_median_output_resolution = self.used_config[
91
96
  "dem_median_output_resolution"
92
97
  ]
@@ -134,8 +139,11 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
134
139
  overloaded_conf["morphological_filters_size"] = conf.get(
135
140
  "morphological_filters_size", 30
136
141
  )
137
- overloaded_conf["median_filter_size"] = conf.get(
138
- "median_filter_size", 5
142
+ overloaded_conf["preprocessing_median_filter_size"] = conf.get(
143
+ "preprocessing_median_filter_size", 5
144
+ )
145
+ overloaded_conf["postprocessing_median_filter_size"] = conf.get(
146
+ "postprocessing_median_filter_size", 7
139
147
  )
140
148
  overloaded_conf["dem_median_output_resolution"] = conf.get(
141
149
  "dem_median_output_resolution", 30
@@ -164,12 +172,13 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
164
172
  application_constants.SAVE_INTERMEDIATE_DATA: bool,
165
173
  "margin": And(Or(float, int), lambda x: x > 0),
166
174
  "morphological_filters_size": And(int, lambda x: x > 0),
167
- "median_filter_size": And(int, lambda x: x > 0),
175
+ "preprocessing_median_filter_size": And(int, lambda x: x > 0),
176
+ "postprocessing_median_filter_size": And(int, lambda x: x > 0),
168
177
  "dem_median_output_resolution": And(int, lambda x: x > 0),
169
178
  "fillnodata_max_search_distance": And(int, lambda x: x > 0),
170
179
  "min_dem": And(Or(int, float), lambda x: x < 0),
171
180
  "max_dem": And(Or(int, float), lambda x: x > 0),
172
- "height_margin": And(Or(float, int), lambda x: x > 0),
181
+ "height_margin": Or(list, float, int),
173
182
  "bulldozer_max_object_size": And(int, lambda x: x > 0),
174
183
  "compute_stats": bool,
175
184
  "coregistration": bool,
@@ -191,7 +200,8 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
191
200
  dem_min_file_name,
192
201
  dem_max_file_name,
193
202
  dem_median_file_name,
194
- geoid_path,
203
+ input_geoid,
204
+ output_geoid,
195
205
  initial_elevation=None,
196
206
  cars_orchestrator=None,
197
207
  ):
@@ -208,7 +218,8 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
208
218
  :type dem_max_file_name: str
209
219
  :param dem_median_file_name: path of dem_median
210
220
  :type dem_median_file_name: str
211
- :param geoid_path: geoid path
221
+ :param input_geoid: input geoid path
222
+ :param output_geoid: output geoid path
212
223
  :param dem_roi_to_use: dem roi polygon to use as roi
213
224
 
214
225
  :return: dem data computed with mean, min and max.
@@ -220,6 +231,11 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
220
231
  # Generate point cloud
221
232
  epsg = 4326
222
233
 
234
+ # Optimize the case when input and output geoid are the same
235
+ if output_geoid is True:
236
+ input_geoid = False
237
+ output_geoid = False
238
+
223
239
  resolution_in_meters = self.resolution
224
240
 
225
241
  # rasterize point cloud
@@ -275,24 +291,45 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
275
291
  not_filled_pixels = dem_data == nodata
276
292
 
277
293
  # Add geoid
278
- with rio.open(geoid_path) as in_geoid:
279
- # Reproject the geoid data to match the DSM
280
- input_geoid_data = np.empty(
281
- dem_data.shape, dtype=in_geoid.dtypes[0]
282
- )
294
+ if input_geoid:
295
+ with rio.open(input_geoid) as in_geoid:
296
+ # Reproject the geoid data to match the DSM
297
+ input_geoid_data = np.empty(
298
+ dem_data.shape, dtype=in_geoid.dtypes[0]
299
+ )
283
300
 
284
- logging.info("Reprojection of geoid data")
301
+ logging.info("Reprojection of geoid data")
285
302
 
286
- reproject(
287
- source=rio.band(in_geoid, 1),
288
- destination=input_geoid_data,
289
- src_transform=in_geoid.transform,
290
- src_crs=in_geoid.crs,
291
- dst_transform=profile["transform"],
292
- dst_crs=profile["crs"],
293
- resampling=Resampling.bilinear,
294
- )
295
- dem_data -= input_geoid_data
303
+ reproject(
304
+ source=rio.band(in_geoid, 1),
305
+ destination=input_geoid_data,
306
+ src_transform=in_geoid.transform,
307
+ src_crs=in_geoid.crs,
308
+ dst_transform=profile["transform"],
309
+ dst_crs=profile["crs"],
310
+ resampling=Resampling.bilinear,
311
+ )
312
+ dem_data -= input_geoid_data
313
+
314
+ if output_geoid:
315
+ with rio.open(input_geoid) as in_geoid:
316
+ # Reproject the geoid data to match the DSM
317
+ input_geoid_data = np.empty(
318
+ dem_data.shape, dtype=in_geoid.dtypes[0]
319
+ )
320
+
321
+ logging.info("Reprojection of geoid data")
322
+
323
+ reproject(
324
+ source=rio.band(in_geoid, 1),
325
+ destination=input_geoid_data,
326
+ src_transform=in_geoid.transform,
327
+ src_crs=in_geoid.crs,
328
+ dst_transform=profile["transform"],
329
+ dst_crs=profile["crs"],
330
+ resampling=Resampling.bilinear,
331
+ )
332
+ dem_data += input_geoid_data
296
333
 
297
334
  # apply morphological filters and height margin
298
335
  footprint = skimage.morphology.disk(
@@ -314,7 +351,10 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
314
351
  dem_median = skimage.filters.median(
315
352
  dem_data,
316
353
  footprint=np.ones(
317
- (self.median_filter_size, self.median_filter_size)
354
+ (
355
+ self.preprocessing_median_filter_size,
356
+ self.preprocessing_median_filter_size,
357
+ )
318
358
  ),
319
359
  )
320
360
 
@@ -329,13 +369,13 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
329
369
  dem_median[eroded_mask] = nodata
330
370
  dem_max[eroded_mask] = nodata
331
371
 
332
- # Rectify pixels where DEM min < DEM - min_depth
372
+ # Rectify pixels where DEM min < DEM median + min_depth
333
373
  dem_min = np.where(
334
- dem_median - dem_min < self.min_dem,
374
+ dem_min - dem_median < self.min_dem,
335
375
  dem_median + self.min_dem,
336
376
  dem_min,
337
377
  )
338
- # Rectify pixels where DEM max > DEM + max_height
378
+ # Rectify pixels where DEM max > DEM median + max_height
339
379
  dem_max = np.where(
340
380
  dem_max - dem_median > self.max_dem,
341
381
  dem_median + self.max_dem,
@@ -369,12 +409,14 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
369
409
  downsample_dem(
370
410
  dem_median_path_out,
371
411
  scale=self.dem_median_output_resolution / resolution_in_meters,
412
+ median_filter_size=self.postprocessing_median_filter_size,
372
413
  )
373
414
 
374
415
  # Launch Bulldozer on dem min
375
416
  saved_transform = edit_transform(
376
417
  dem_min_path, resolution=resolution_in_meters
377
418
  )
419
+ logging.info("Launch Bulldozer on DEM min")
378
420
  temp_output_path = launch_bulldozer(
379
421
  dem_min_path,
380
422
  os.path.join(output_dir, "dem_min_bulldozer"),
@@ -390,6 +432,7 @@ class Rasterization(DemGeneration, short_name="bulldozer_on_raster"):
390
432
  dem_max_path, resolution=resolution_in_meters
391
433
  )
392
434
  reverse_dem(dem_max_path)
435
+ logging.info("Launch Bulldozer on DEM max")
393
436
  temp_output_path = launch_bulldozer(
394
437
  dem_max_path,
395
438
  os.path.join(output_dir, "dem_max_bulldozer"),
@@ -163,6 +163,7 @@ class DenseMatchFilling(ApplicationTemplate, metaclass=ABCMeta):
163
163
  pair_folder,
164
164
  pair_key,
165
165
  app_name=None,
166
+ nodata_epi_disp=0,
166
167
  ):
167
168
  """
168
169
  Create dataset and registered the output in the orchestrator
@@ -177,6 +178,8 @@ class DenseMatchFilling(ApplicationTemplate, metaclass=ABCMeta):
177
178
  :type pair_key: str
178
179
  :param app_name: application name for file names
179
180
  :type app_name: str
181
+ :param nodata_epi_disp: the nodata for the epi disp
182
+ :type nodata_epi_disp: int
180
183
 
181
184
  """
182
185
  if app_name is None:
@@ -204,6 +207,7 @@ class DenseMatchFilling(ApplicationTemplate, metaclass=ABCMeta):
204
207
  cst_disp.MAP,
205
208
  new_epipolar_disparity_map,
206
209
  cars_ds_name="epi_disp_" + app_name + "_filled",
210
+ nodata=nodata_epi_disp,
207
211
  )
208
212
 
209
213
  self.orchestrator.add_to_save_lists(
@@ -59,6 +59,7 @@ def fill_central_area_using_plane( # noqa: C901
59
59
  nb_pix: int,
60
60
  percent_to_erode: float,
61
61
  class_index: list,
62
+ fill_valid_pixels: bool,
62
63
  ):
63
64
  """
64
65
  Finds central area of invalid region and estimates disparity values
@@ -91,6 +92,8 @@ def fill_central_area_using_plane( # noqa: C901
91
92
  :type percent_to_erode: float
92
93
  :param class_index: list of tag to use
93
94
  :type class_index: list(str)
95
+ :param fill_valid_pixels: option to fill valid pixels
96
+ :type fill_valid_pixels: bool
94
97
 
95
98
  :return: mask of invalid region that hasn't been filled yet
96
99
  (original invalid region - central area)
@@ -233,11 +236,16 @@ def fill_central_area_using_plane( # noqa: C901
233
236
  )
234
237
 
235
238
  # Exclude pixels outside of epipolar footprint
236
- central_area = np.logical_and(
237
- central_area,
239
+ mask = (
238
240
  disp_map[cst.EPI_MSK].values
239
- != mask_cst.NO_DATA_IN_EPIPOLAR_RECTIFICATION,
241
+ != mask_cst.NO_DATA_IN_EPIPOLAR_RECTIFICATION
240
242
  )
243
+ if not fill_valid_pixels:
244
+ # Exclude valid pixels
245
+ mask = np.logical_and(
246
+ mask, disp_map["disp_msk"].values == 0
247
+ )
248
+ central_area = np.logical_and(central_area, mask)
241
249
 
242
250
  variable_disp = calculate_disp_plane(
243
251
  band_disp_values,
@@ -302,7 +310,12 @@ def calculate_disp_plane(
302
310
  return val
303
311
 
304
312
 
305
- def fill_area_borders_using_interpolation(disp_map, masks_to_fill, options):
313
+ def fill_area_borders_using_interpolation(
314
+ disp_map,
315
+ masks_to_fill,
316
+ options,
317
+ fill_valid_pixels,
318
+ ):
306
319
  """
307
320
  Raster interpolation command
308
321
  :param disp_map: disparity values
@@ -311,6 +324,8 @@ def fill_area_borders_using_interpolation(disp_map, masks_to_fill, options):
311
324
  :type masks_to_fill: list(2D np.array (row, col))
312
325
  :param options: parameters for interpolation methods
313
326
  :type options: dict
327
+ :param fill_valid_pixels: option to fill valid pixels
328
+ :type fill_valid_pixels: bool
314
329
  """
315
330
  # Copy input data - disparity values + mask with values to fill
316
331
  raster = np.copy(disp_map["disp"].values)
@@ -318,11 +333,14 @@ def fill_area_borders_using_interpolation(disp_map, masks_to_fill, options):
318
333
  # Interpolation step
319
334
  for mask_to_fill in masks_to_fill:
320
335
  # Exclude pixels outside of epipolar footprint
321
- mask_to_fill = np.logical_and(
322
- mask_to_fill,
336
+ mask = (
323
337
  disp_map[cst.EPI_MSK].values
324
- != mask_cst.NO_DATA_IN_EPIPOLAR_RECTIFICATION,
338
+ != mask_cst.NO_DATA_IN_EPIPOLAR_RECTIFICATION
325
339
  )
340
+ if not fill_valid_pixels:
341
+ # Exclude valid pixels
342
+ mask = np.logical_and(mask, disp_map["disp_msk"].values == 0)
343
+ mask_to_fill = np.logical_and(mask_to_fill, mask)
326
344
 
327
345
  interpol_raster = fill_wrap.make_raster_interpolation(
328
346
  raster, mask_to_fill, options
@@ -346,6 +364,7 @@ def fill_disp_using_plane(
346
364
  percent_to_erode: float,
347
365
  interp_options: dict,
348
366
  classification,
367
+ fill_valid_pixels,
349
368
  ) -> xr.Dataset:
350
369
  """
351
370
  Fill disparity map holes
@@ -372,6 +391,8 @@ def fill_disp_using_plane(
372
391
  :type interp_options: dict
373
392
  :param classification: list of tag to use
374
393
  :type classification: list(str)
394
+ :param fill_valid_pixels: option to fill valid pixels
395
+ :type fill_valid_pixels: bool
375
396
  """
376
397
 
377
398
  border_region = fill_central_area_using_plane(
@@ -385,18 +406,21 @@ def fill_disp_using_plane(
385
406
  nb_pix,
386
407
  percent_to_erode,
387
408
  classification,
409
+ fill_valid_pixels,
388
410
  )
389
411
 
390
412
  fill_area_borders_using_interpolation(
391
413
  disp_map,
392
414
  border_region,
393
415
  interp_options,
416
+ fill_valid_pixels,
394
417
  )
395
418
 
396
419
 
397
420
  def fill_disp_using_zero_padding(
398
421
  disp_map: xr.Dataset,
399
422
  class_index,
423
+ fill_valid_pixels,
400
424
  ) -> xr.Dataset:
401
425
  """
402
426
  Fill disparity map holes
@@ -405,6 +429,8 @@ def fill_disp_using_zero_padding(
405
429
  :type disp_map: xr.Dataset
406
430
  :param class_index: class index according to the classification tag
407
431
  :type class_index: int
432
+ :param fill_valid_pixels: option to fill valid pixels
433
+ :type fill_valid_pixels: bool
408
434
  """
409
435
  # get index of the application class config
410
436
  # according the coords classif band
@@ -414,14 +440,17 @@ def fill_disp_using_zero_padding(
414
440
  disp_map, class_index
415
441
  )
416
442
  # Exclude pixels outside of epipolar footprint
417
- stack_index = np.logical_and(
418
- stack_index,
443
+ mask = (
419
444
  disp_map[cst.EPI_MSK].values
420
- != mask_cst.NO_DATA_IN_EPIPOLAR_RECTIFICATION,
445
+ != mask_cst.NO_DATA_IN_EPIPOLAR_RECTIFICATION
421
446
  )
422
- # set disparity value to np.nan where the class is
447
+ if not fill_valid_pixels:
448
+ # Exclude valid pixels
449
+ mask = np.logical_and(mask, disp_map["disp_msk"].values == 0)
450
+ stack_index = np.logical_and(stack_index, mask)
451
+ # set disparity value to zero where the class is
423
452
  # non zero value and masked region
424
- disp_map["disp"].values[stack_index] = np.nan
453
+ disp_map["disp"].values[stack_index] = 0
425
454
  disp_map["disp_msk"].values[stack_index] = 255
426
455
  disp_map[cst.EPI_MSK].values[stack_index] = 0
427
456
  # Add a band to disparity dataset to memorize which pixels are filled
@@ -84,6 +84,7 @@ class PlaneFill(
84
84
  self.nb_pix = self.used_config["nb_pix"]
85
85
  self.percent_to_erode = self.used_config["percent_to_erode"]
86
86
  self.classification = self.used_config["classification"]
87
+ self.fill_valid_pixels = self.used_config["fill_valid_pixels"]
87
88
  # Saving files
88
89
  self.save_intermediate_data = self.used_config["save_intermediate_data"]
89
90
 
@@ -126,6 +127,9 @@ class PlaneFill(
126
127
  overloaded_conf["nb_pix"] = conf.get("nb_pix", 20)
127
128
  overloaded_conf["percent_to_erode"] = conf.get("percent_to_erode", 0.2)
128
129
  overloaded_conf["classification"] = conf.get("classification", None)
130
+ overloaded_conf["fill_valid_pixels"] = conf.get(
131
+ "fill_valid_pixels", True
132
+ )
129
133
  # Saving files
130
134
  overloaded_conf["save_intermediate_data"] = conf.get(
131
135
  "save_intermediate_data", False
@@ -144,6 +148,7 @@ class PlaneFill(
144
148
  "nb_pix": Or(None, int),
145
149
  "percent_to_erode": Or(None, float),
146
150
  "classification": Or(None, [str]),
151
+ "fill_valid_pixels": bool,
147
152
  }
148
153
 
149
154
  # Check conf
@@ -242,6 +247,7 @@ class PlaneFill(
242
247
  pair_folder,
243
248
  pair_key,
244
249
  app_name="plane",
250
+ nodata_epi_disp=-9999,
245
251
  )
246
252
 
247
253
  # Get saving infos in order to save tiles when they are computed
@@ -380,6 +386,7 @@ class PlaneFill(
380
386
  nb_pix=self.nb_pix,
381
387
  percent_to_erode=self.percent_to_erode,
382
388
  interp_options=interp_options,
389
+ fill_valid_pixels=self.fill_valid_pixels,
383
390
  saving_info=full_saving_info,
384
391
  )
385
392
 
@@ -405,6 +412,7 @@ def fill_disparity_plane_wrapper(
405
412
  nb_pix=20,
406
413
  percent_to_erode=0.3,
407
414
  interp_options=None,
415
+ fill_valid_pixels=True,
408
416
  saving_info=None,
409
417
  ):
410
418
  """
@@ -434,6 +442,8 @@ def fill_disparity_plane_wrapper(
434
442
  :type percent_to_erode: float
435
443
  :param interp_options: interp_options
436
444
  :type interp_options: dict
445
+ :param fill_valid_pixels: option to fill valid pixels
446
+ :type fill_valid_pixels: bool
437
447
  :param saving_info: saving infos
438
448
  :type saving_info: dict
439
449
 
@@ -469,6 +479,7 @@ def fill_disparity_plane_wrapper(
469
479
  percent_to_erode,
470
480
  interp_options,
471
481
  classification,
482
+ fill_valid_pixels,
472
483
  )
473
484
 
474
485
  # Find xarray Dataset corresponding to current tile
@@ -67,6 +67,7 @@ class ZerosPadding(
67
67
  # get conf
68
68
  self.used_method = self.used_config["method"]
69
69
  self.classification = self.used_config["classification"]
70
+ self.fill_valid_pixels = self.used_config["fill_valid_pixels"]
70
71
 
71
72
  # Saving files
72
73
  self.save_intermediate_data = self.used_config["save_intermediate_data"]
@@ -93,6 +94,9 @@ class ZerosPadding(
93
94
  overloaded_conf["method"] = conf.get("method", "zero_padding")
94
95
 
95
96
  overloaded_conf["classification"] = conf.get("classification", None)
97
+ overloaded_conf["fill_valid_pixels"] = conf.get(
98
+ "fill_valid_pixels", True
99
+ )
96
100
  # Saving files
97
101
  overloaded_conf["save_intermediate_data"] = conf.get(
98
102
  "save_intermediate_data", False
@@ -102,6 +106,7 @@ class ZerosPadding(
102
106
  "method": str,
103
107
  "save_intermediate_data": bool,
104
108
  "classification": Or(None, [str]),
109
+ "fill_valid_pixels": bool,
105
110
  }
106
111
 
107
112
  # Check conf
@@ -179,6 +184,7 @@ class ZerosPadding(
179
184
  pair_folder,
180
185
  pair_key,
181
186
  app_name="zero_padding",
187
+ nodata_epi_disp=-9999,
182
188
  )
183
189
 
184
190
  # Get saving infos in order to save tiles when they are computed
@@ -229,6 +235,7 @@ class ZerosPadding(
229
235
  window,
230
236
  overlap,
231
237
  classif_index=self.classification,
238
+ fill_valid_pixels=self.fill_valid_pixels,
232
239
  saving_info=full_saving_info,
233
240
  )
234
241
 
@@ -247,6 +254,7 @@ def fill_disparity_zeros_wrapper(
247
254
  window,
248
255
  overlap,
249
256
  classif_index,
257
+ fill_valid_pixels,
250
258
  saving_info=None,
251
259
  ):
252
260
  """
@@ -260,6 +268,8 @@ def fill_disparity_zeros_wrapper(
260
268
  :type overlap: list
261
269
  :param class_index: class index according to the classification tag
262
270
  :type class_index: list
271
+ :param fill_valid_pixels: option to fill valid pixels
272
+ :type fill_valid_pixels: bool
263
273
  :param saving_info: saving infos
264
274
  :type saving_info: dict
265
275
 
@@ -268,7 +278,7 @@ def fill_disparity_zeros_wrapper(
268
278
  """
269
279
  # Add a band to disparity dataset to memorize which pixels are filled
270
280
  disp = fd_wrappers.add_empty_filling_band(disp, ["zeros_padding"])
271
- fd_algo.fill_disp_using_zero_padding(disp, classif_index)
281
+ fd_algo.fill_disp_using_zero_padding(disp, classif_index, fill_valid_pixels)
272
282
  result = copy.copy(disp)
273
283
 
274
284
  # Fill with attributes