PIXELBANKv9.1.0
Menu

Weighted Depth Fusion

Fuse multiple depth estimates using weighted averaging.

When we have depth estimates from multiple stereo pairs or viewpoints, we can combine them to get a more robust estimate. Weighted averaging gives more influence to confident estimates:

Zfused=βˆ‘iwiβ‹…Ziβˆ‘iwiZ_{fused} = \frac{\sum_i w_i \cdot Z_i}{\sum_i w_i}

where:

  • ZiZ_i is the depth estimate from source ii
  • wiw_i is the confidence/weight for that estimate
  • ZfusedZ_{fused} is the final fused depth

Weights typically come from matching confidence, geometric consistency, or photo consistency scores.

Example:

Input:
fuse_depths([5.0, 5.2, 4.8], [1.0, 0.5, 0.5])
Output:
5.0
Reasoning:

Fusing 3 depth estimates with different weights:

  • Weighted sum: 5.0Γ—1.0 + 5.2Γ—0.5 + 4.8Γ—0.5 = 5.0 + 2.6 + 2.4 = 10.0
  • Total weight: 1.0 + 0.5 + 0.5 = 2.0
  • Fused depth: 10.0 / 2.0 = 5.0
  • The high-confidence estimate (5.0) dominates.

Constraints:

  • depths: list of depth values from different sources
  • weights: list of confidence weights (positive values)
  • Return fused depth rounded to 4 decimal places
πŸ”’

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.