parameters: (arguments)
docstring: Clean depthmap by checking consistency with neighbors.
docstring_summary: Clean depthmap by checking consistency with neighbors.
docstring_tokens: Clean depthmap by checking consistency with neighbors .
function: def clean_depthmap(arguments):
      """Clean depthmap by checking consistency with neighbors."""
      log.setup()
  
      data: UndistortedDataSet = arguments[0]
      neighbors = arguments[1]
      shot = arguments[2]
  
      if data.clean_depthmap_exists(shot.id):
          logger.info("Using precomputed clean depthmap {}".format(shot.id))
          return
      logger.info("Cleaning depthmap for image {}".format(shot.id))
  
      dc = pydense.DepthmapCleaner()
      dc.set_same_depth_threshold(data.config["depthmap_same_depth_threshold"])
      dc.set_min_consistent_views(data.config["depthmap_min_consistent_views"])
      add_views_to_depth_cleaner(data, neighbors, dc)
      depth = dc.clean()
  
      # Save and display results
      raw_depth, raw_plane, raw_score, raw_nghbr, nghbrs = data.load_raw_depthmap(shot.id)
      data.save_clean_depthmap(shot.id, depth, raw_plane, raw_score)
  
      if data.config["depthmap_save_debug_files"]:
          image = data.load_undistorted_image(shot.id)
          image = scale_down_image(image, depth.shape[1], depth.shape[0])
          ply = depthmap_to_ply(shot, depth, image)
          with io.open_wt(data.depthmap_file(shot.id, "clean.npz.ply")) as fout:
              fout.write(ply)
  
      if data.config.get("interactive"):
          import matplotlib.pyplot as plt
  
          plt.figure()
          plt.suptitle("Shot: " + shot.id)
          plt.subplot(2, 2, 1)
          plt.imshow(raw_depth)
          plt.colorbar()
          plt.subplot(2, 2, 2)
          plt.imshow(depth)
          plt.colorbar()
          plt.show()
function_tokens: def clean_depthmap ( arguments ) : log . setup ( ) data : UndistortedDataSet = arguments [ 0 ] neighbors = arguments [ 1 ] shot = arguments [ 2 ] if data . clean_depthmap_exists ( shot . id ) : logger . info ( "Using precomputed clean depthmap {}" . format ( shot . id ) ) return logger . info ( "Cleaning depthmap for image {}" . format ( shot . id ) ) dc = pydense . DepthmapCleaner ( ) dc . set_same_depth_threshold ( data . config [ "depthmap_same_depth_threshold" ] ) dc . set_min_consistent_views ( data . config [ "depthmap_min_consistent_views" ] ) add_views_to_depth_cleaner ( data , neighbors , dc ) depth = dc . clean ( ) # Save and display results raw_depth , raw_plane , raw_score , raw_nghbr , nghbrs = data . load_raw_depthmap ( shot . id ) data . save_clean_depthmap ( shot . id , depth , raw_plane , raw_score ) if data . config [ "depthmap_save_debug_files" ] : image = data . load_undistorted_image ( shot . id ) image = scale_down_image ( image , depth . shape [ 1 ] , depth . shape [ 0 ] ) ply = depthmap_to_ply ( shot , depth , image ) with io . open_wt ( data . depthmap_file ( shot . id , "clean.npz.ply" ) ) as fout : fout . write ( ply ) if data . config . get ( "interactive" ) : import matplotlib . pyplot as plt plt . figure ( ) plt . suptitle ( "Shot: " + shot . id ) plt . subplot ( 2 , 2 , 1 ) plt . imshow ( raw_depth ) plt . colorbar ( ) plt . subplot ( 2 , 2 , 2 ) plt . imshow ( depth ) plt . colorbar ( ) plt . show ( )