Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-377

TSDF Weight Update

Problem

Fuse a new signed-distance measurement into a TSDF voxel.

The running average is (value * weight + obs) / (weight + 1), with the weight incremented by 1 and capped at max_weight. Return [value, weight] rounded to 4 decimal places.

Hint

Long observation sequences keep refining the mean until the weight saturates.

Test cases

case 1
in: [0,0,0.5,10]
expected: [0.5,1]
case 2
in: [1,1,0,10]
expected: [0.5,2]
case 3
in: [0.2,4,0.4,4]
expected: [0.24,4]
case 4
in: [0,0,0,1]
expected: [0,1]
Starter codePython
def tsdf_update(value, weight, obs, max_weight):
    # Your code here
    pass

4 test cases · run your code against them in the editor